Skip to content

fix: process_payment_validation no longer overrides admin 3DS authorize settings#123

Draft
Copilot wants to merge 2 commits intostagingfrom
copilot/sub-pr-121-again
Draft

fix: process_payment_validation no longer overrides admin 3DS authorize settings#123
Copilot wants to merge 2 commits intostagingfrom
copilot/sub-pr-121-again

Conversation

Copy link

Copilot AI commented Mar 4, 2026

The standalone condition after the switch unconditionally forced $appendMpi = true for all production/non-Cielo cases, making it impossible for the Authorize On Error/Failure/Unenrolled/Unsupported Brand settings to authorize through MPI failures.

Changes

  • process_payment_validation: Moves $isCielo computation before the switch and folds the production/non-Cielo guard into the default case, scoping it to unrecognized failure types only
// Before: standalone condition always overrode known-type switch decisions
switch ($failureType) {
    case '4': $appendMpi = ($this->auth3ds20_mpi_authorize_on_error === 'no'); break;
    // ...
    default:  $appendMpi = true; break;
}
if (!$this->test_mode && $failureType !== '3' && !$isCielo) {
    $appendMpi = true;  // silently clobbers switch result for cases 1/2/4/5
}

// After: guard lives inside default, known types are untouched
switch ($failureType) {
    case '4': $appendMpi = ($this->auth3ds20_mpi_authorize_on_error === 'no'); break;
    // ...
    default:  $appendMpi = !$this->test_mode && $failureType !== '3' && !$isCielo; break;
}

Behaviour summary:

Scenario Before After
Known type, admin set to authorize, prod non-Cielo ❌ blocked ✅ authorized
Unknown type, prod non-Cielo blocked blocked
Type 3, any env blocked (default case) ✅ authorized
Test mode / Cielo, unknown type blocked ✅ authorized

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…tion

Co-authored-by: willian-hf-rodrigues <140353340+willian-hf-rodrigues@users.noreply.github.com>
Copilot AI changed the title [WIP] Update improvements based on feedback from pull request #121 fix: process_payment_validation no longer overrides admin 3DS authorize settings Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants