Merge branch 'trunk' into PCP-2157-apple-pay-add-support-for-pay-now-page

# Conflicts:
#	modules/ppcp-applepay/resources/js/Context/SingleProductHandler.js
This commit is contained in:
Pedro Silva 2023-10-31 10:40:02 +00:00
commit cb753cf47c
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
23 changed files with 762 additions and 413 deletions

View file

@ -23,18 +23,17 @@ class ApplepayButton {
this.ppcpConfig
);
//PRODUCT DETAIL PAGE
this.refreshContextData();
this.updated_contact_info = []
this.selectedShippingMethod = []
this.nonce = document.getElementById('woocommerce-process-checkout-nonce').value
this.nonce = document.getElementById('woocommerce-process-checkout-nonce')?.value
this.log = function() {
if ( this.buttonConfig.is_debug ) {
console.log('[ApplePayButton]', ...arguments);
}
}
this.refreshContextData();
}
init(config) {
@ -265,6 +264,8 @@ class ApplepayButton {
case 'product':
// Refresh product data that makes the price change.
this.productQuantity = document.querySelector('input.qty').value;
this.products = this.contextHandler.products();
this.log('Products updated', this.products);
break;
}
}
@ -394,6 +395,7 @@ class ApplepayButton {
return {
action: 'ppcp_update_shipping_contact',
product_id: product_id,
products: JSON.stringify(this.products),
caller_page: 'productDetail',
product_quantity: this.productQuantity,
simplified_contact: event.shippingContact,
@ -424,6 +426,7 @@ class ApplepayButton {
action: 'ppcp_update_shipping_method',
shipping_method: event.shippingMethod,
product_id: product_id,
products: JSON.stringify(this.products),
caller_page: 'productDetail',
product_quantity: this.productQuantity,
simplified_contact: this.updated_contact_info,
@ -461,6 +464,7 @@ class ApplepayButton {
action: 'ppcp_create_order',
'caller_page': this.context,
'product_id': this.buttonConfig.product.id ?? null,
'products': JSON.stringify(this.products),
'product_quantity': this.productQuantity ?? null,
'shipping_contact': shippingContact,
'billing_contact': billingContact,