From d3ddc625d8af0c6e1bd423a5c21557b29845bf42 Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Wed, 26 Feb 2025 17:52:44 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Start=20to=20simplify=20pr?= =?UTF-8?q?ocessPayment=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ppcp-googlepay/resources/js/GooglepayButton.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/ppcp-googlepay/resources/js/GooglepayButton.js b/modules/ppcp-googlepay/resources/js/GooglepayButton.js index 9e58fbca5..6df3320af 100644 --- a/modules/ppcp-googlepay/resources/js/GooglepayButton.js +++ b/modules/ppcp-googlepay/resources/js/GooglepayButton.js @@ -808,6 +808,8 @@ class GooglepayButton extends PaymentButton { async processPayment( paymentData ) { this.logGroup( 'processPayment' ); + let result; + const payer = payerDataFromPaymentResponse( paymentData ); const paymentError = ( reason ) => { @@ -891,14 +893,13 @@ class GooglepayButton extends PaymentButton { } }; - const addBillingDataToSession = () => { - moduleStorage.setPayer( payer ); - setPayerData( payer ); - }; return new Promise( async ( resolve ) => { try { - addBillingDataToSession(); + // Add billing data to session. + moduleStorage.setPayer( payer ); + setPayerData( payer ); + await processPaymentPromise( resolve ); } catch ( err ) { resolve( paymentError( err.message ) );