🔊 Improve logging for “initiatePaymentRequest”

This commit is contained in:
Philipp Stracker 2025-02-26 16:36:35 +01:00
parent 7035e1edbc
commit 83d6998cd5
No known key found for this signature in database

View file

@ -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() {