Skip to content

Commit

Permalink
refs #21687 error of the verification card before saving
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan202 committed Dec 16, 2019
1 parent 752cfd6 commit 9d5e7a0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion classes/MethodBraintreeOfficial.php
Original file line number Diff line number Diff line change
Expand Up @@ -768,14 +768,25 @@ public function sale($cart, $token_payment)
'options' => array('verifyCard' => true),
));

if (isset($payment_method->verification) && $payment_method->verification->status != 'verified') {
if (isset($payment_method->verification) && $payment_method->verification != null &&
isset($payment_method->verification->status) && $payment_method->verification->status != 'verified') {
$error_msg = $module->l('Card verification respond with status', get_class($this)).' '.$payment_method->verification->status.'. ';
$error_msg .= $module->l('The reason : ', get_class($this)).' '.$payment_method->verification->processorResponseText.'. ';

if ($payment_method->verification->gatewayRejectionReason) {
$error_msg .= $module->l('Rejection reason : ', get_class($this)).' '.$payment_method->verification->gatewayRejectionReason;
}

throw new Exception($error_msg, '00000');
}

if ($payment_method instanceof Braintree\Result\Error) {
$error_msg = $module->l('Card verification is failed. ', get_class($this));
$error_msg .= $module->l('The reason : ', get_class($this)).' '.$payment_method->message.'. ';

throw new Exception($error_msg, '00000');
}

$paymentMethodToken = $payment_method->paymentMethod->token;
}
$options['storeInVaultOnSuccess'] = true;
Expand Down

0 comments on commit 9d5e7a0

Please sign in to comment.