From dba0b50c505ac56b4d8ca06a4ce17fc941919d56 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 26 Oct 2022 10:36:36 +1100 Subject: [PATCH] Minor fixes for braintree 3DS --- app/PaymentDrivers/Braintree/CreditCard.php | 11 +++++++++-- public/js/clients/payments/braintree-credit-card.js | 2 +- public/mix-manifest.json | 2 +- .../js/clients/payments/braintree-credit-card.js | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/PaymentDrivers/Braintree/CreditCard.php b/app/PaymentDrivers/Braintree/CreditCard.php index 001fc5f33f95..daf14090a37f 100644 --- a/app/PaymentDrivers/Braintree/CreditCard.php +++ b/app/PaymentDrivers/Braintree/CreditCard.php @@ -126,6 +126,12 @@ class CreditCard ], ]; + // uses the same auth id twice when this is enabled. + + // if($state['server_response']?->threeDSecureInfo){ + // $data['threeDSecureAuthenticationId'] = $state['server_response']?->threeDSecureInfo?->threeDSecureAuthenticationId; + // } + if ($this->braintree->company_gateway->getConfigField('merchantAccountId')) { /** https://developer.paypal.com/braintree/docs/reference/request/transaction/sale/php#full-example */ $data['merchantAccountId'] = $this->braintree->company_gateway->getConfigField('merchantAccountId'); @@ -224,7 +230,8 @@ class CreditCard */ private function processUnsuccessfulPayment($response) { - $this->braintree->sendFailureMail($response->transaction->additionalProcessorResponse); + + $this->braintree->sendFailureMail($response?->transaction?->additionalProcessorResponse); $message = [ 'server_response' => $response, @@ -240,7 +247,7 @@ class CreditCard $this->braintree->client->company, ); - throw new PaymentFailed($response->transaction->additionalProcessorResponse, $response->transaction->processorResponseCode); + throw new PaymentFailed($response?->transaction?->additionalProcessorResponse ?: 'Unhandled error, please contact merchant', $response?->transaction?->processorResponseCode ?: 500); } private function storePaymentMethod($method, $customer_reference) diff --git a/public/js/clients/payments/braintree-credit-card.js b/public/js/clients/payments/braintree-credit-card.js index 974c09213e62..307751827ef4 100644 --- a/public/js/clients/payments/braintree-credit-card.js +++ b/public/js/clients/payments/braintree-credit-card.js @@ -1,2 +1,2 @@ /*! For license information please see braintree-credit-card.js.LICENSE.txt */ -(()=>{function e(e,t){for(var n=0;n{function e(e,t){for(var n=0;n { dropinInstance.requestPaymentMethod({ threeDSecure: { + challengeRequested:true, amount: params.amount, email: params.email, billingAddress: {