Skip to content

Commit 23745fe

Browse files
committed
Merge remote-tracking branch 'mpi/MC-17358' into PR-08-2210
2 parents c090069 + 942bcf8 commit 23745fe

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

app/code/Magento/Braintree/Gateway/Validator/ErrorCodeValidator.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ public function __invoke($response)
2727
return [true, [__('Transaction is successful.')]];
2828
}
2929

30-
return [false, $this->getErrorCodes($response->errors)];
30+
$errorCodes = $this->getErrorCodes($response->errors);
31+
if (isset($response->transaction->status) && $response->transaction->status === 'gateway_rejected') {
32+
$errorCodes[] = $response->transaction->gatewayRejectionReason;
33+
}
34+
if (isset($response->transaction->status) && $response->transaction->status === 'processor_declined') {
35+
$errorCodes[] = $response->transaction->processorResponseCode;
36+
}
37+
38+
return [false, $errorCodes];
3139
}
3240

3341
/**

app/code/Magento/Braintree/etc/braintree_error_mapping.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<message code="81716" translate="true">Credit card number must be 12-19 digits.</message>
2121
<message code="81723" translate="true">Cardholder name is too long.</message>
2222
<message code="81736" translate="true">CVV verification failed.</message>
23+
<message code="cvv" translate="true">CVV verification failed.</message>
2324
<message code="81737" translate="true">Postal code verification failed.</message>
2425
<message code="81750" translate="true">Credit card number is prohibited.</message>
2526
<message code="81801" translate="true">Addresses must have at least one field filled in.</message>

dev/tests/integration/testsuite/Magento/Checkout/Api/PaymentInformationManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function testSavePaymentInformationAndPlaceOrderWithErrors(string $area,
9494
]
9595
]
9696
];
97-
$response = new Error(['errors' => $errors]);
97+
$response = new Error(['errors' => $errors, 'transaction' => ['status' => 'declined']]);
9898

9999
$this->client->method('placeRequest')
100100
->willReturn(['object' => $response]);

0 commit comments

Comments
 (0)