mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
prepare for bn codes
This commit is contained in:
parent
20d4786943
commit
e4a4ec3acb
6 changed files with 46 additions and 3 deletions
|
@ -55,6 +55,7 @@ document.addEventListener(
|
|||
}
|
||||
if (
|
||||
! document.querySelector(PayPalCommerceGateway.button.wrapper) &&
|
||||
! document.querySelector(PayPalCommerceGateway.button.mini_cart_wrapper) &&
|
||||
! document.querySelector(PayPalCommerceGateway.hosted_fields.wrapper)
|
||||
) {
|
||||
return;
|
||||
|
|
|
@ -11,11 +11,14 @@ class CartActionHandler {
|
|||
configuration() {
|
||||
const createOrder = (data, actions) => {
|
||||
const payer = payerData();
|
||||
const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?
|
||||
this.config.bn_codes[this.config.context] : '';
|
||||
return fetch(this.config.ajax.create_order.endpoint, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
nonce: this.config.ajax.create_order.nonce,
|
||||
purchase_units: [],
|
||||
bn_code:bnCode,
|
||||
payer
|
||||
}),
|
||||
}).then(function(res) {
|
||||
|
|
|
@ -12,11 +12,14 @@ class CheckoutActionHandler {
|
|||
|
||||
const createOrder = (data, actions) => {
|
||||
const payer = payerData();
|
||||
const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?
|
||||
this.config.bn_codes[this.config.context] : '';
|
||||
return fetch(this.config.ajax.create_order.endpoint, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
nonce: this.config.ajax.create_order.nonce,
|
||||
payer
|
||||
payer,
|
||||
bn_code:bnCode
|
||||
})
|
||||
}).then(function (res) {
|
||||
return res.json();
|
||||
|
|
|
@ -75,12 +75,15 @@ class SingleProductActionHandler {
|
|||
|
||||
const onResolve = (purchase_units) => {
|
||||
const payer = payerData();
|
||||
const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?
|
||||
this.config.bn_codes[this.config.context] : '';
|
||||
return fetch(this.config.ajax.create_order.endpoint, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
nonce: this.config.ajax.create_order.nonce,
|
||||
purchase_units,
|
||||
payer
|
||||
payer,
|
||||
bn_code:bnCode
|
||||
})
|
||||
}).then(function (res) {
|
||||
return res.json();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue