From 83d6998cd50f3b8b7e059d39c2c1843c8b7bb854 Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Wed, 26 Feb 2025 16:36:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20Improve=20logging=20for=20?= =?UTF-8?q?=E2=80=9CinitiatePaymentRequest=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/js/GooglepayButton.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/ppcp-googlepay/resources/js/GooglepayButton.js b/modules/ppcp-googlepay/resources/js/GooglepayButton.js index 51ea2a450..1780dd6bc 100644 --- a/modules/ppcp-googlepay/resources/js/GooglepayButton.js +++ b/modules/ppcp-googlepay/resources/js/GooglepayButton.js @@ -533,7 +533,7 @@ class GooglepayButton extends PaymentButton { * Show Google Pay payment sheet when Google Pay payment button is clicked */ onButtonClick() { - this.log( 'onButtonClick' ); + this.logGroup( 'onButtonClick' ); const initiatePaymentRequest = async () => { window.ppcpFundingSource = 'googlepay'; @@ -545,7 +545,16 @@ class GooglepayButton extends PaymentButton { this.context ); - return this.paymentsClient.loadPaymentData( paymentDataRequest ); + return this.paymentsClient + .loadPaymentData( paymentDataRequest ) + .then( ( paymentData ) => { + this.log( 'loadPaymentData response:', paymentData ); + return paymentData; + } ) + .catch( ( error ) => { + this.error( 'loadPaymentData failed:', error ); + throw error; + } ); }; const validateForm = async () => { @@ -577,7 +586,8 @@ class GooglepayButton extends PaymentButton { validateForm() .then( getTransactionInfo ) - .then( initiatePaymentRequest ); + .then( initiatePaymentRequest ) + .finally( () => this.logGroup() ) } paymentDataRequest() {