🔀 Merge branch 'trunk'

# Conflicts:
#	modules/ppcp-googlepay/resources/js/GooglepayButton.js
This commit is contained in:
Philipp Stracker 2024-08-07 14:30:12 +02:00
commit 31867b17d6
No known key found for this signature in database
21 changed files with 485 additions and 1682 deletions

View file

@ -4,7 +4,7 @@ import CheckoutActionHandler from '../../../../ppcp-button/resources/js/modules/
import FormValidator from '../../../../ppcp-button/resources/js/modules/Helper/FormValidator';
class CheckoutHandler extends BaseHandler {
transactionInfo() {
validateForm() {
return new Promise( async ( resolve, reject ) => {
try {
const spinner = new Spinner();
@ -23,7 +23,7 @@ class CheckoutHandler extends BaseHandler {
: null;
if ( ! formValidator ) {
resolve( super.transactionInfo() );
resolve();
return;
}
@ -42,7 +42,7 @@ class CheckoutHandler extends BaseHandler {
reject();
} else {
resolve( super.transactionInfo() );
resolve();
}
} );
} catch ( error ) {

View file

@ -213,14 +213,24 @@ class GooglepayButton extends PaymentButton {
onButtonClick() {
this.log( 'onButtonClick' );
const paymentDataRequest = this.paymentDataRequest();
this.contextHandler.validateForm().then(
() => {
window.ppcpFundingSource = 'googlepay';
this.log( 'onButtonClick: paymentDataRequest', paymentDataRequest );
const paymentDataRequest = this.paymentDataRequest();
// Do this on another place like on create order endpoint handler.
window.ppcpFundingSource = 'googlepay';
this.log(
'onButtonClick: paymentDataRequest',
paymentDataRequest,
this.context
);
this.paymentsClient.loadPaymentData( paymentDataRequest );
this.paymentsClient.loadPaymentData( paymentDataRequest );
},
() => {
console.error( '[GooglePayButton] Form validation failed.' );
}
);
}
paymentDataRequest() {