mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
♻️ Extract createOrder into the main function body
This commit is contained in:
parent
c4a269780f
commit
d6e66fd55c
1 changed files with 5 additions and 6 deletions
|
@ -870,11 +870,7 @@ class GooglepayButton extends PaymentButton {
|
|||
return isApproved;
|
||||
};
|
||||
|
||||
const processPaymentPromise = async ( resolve ) => {
|
||||
const id = await this.contextHandler.createOrder();
|
||||
|
||||
this.log( 'createOrder', id );
|
||||
|
||||
const processPaymentPromise = async ( resolve, id ) => {
|
||||
const isApprovedByPayPal = await checkPayPalApproval( id );
|
||||
|
||||
if ( ! isApprovedByPayPal ) {
|
||||
|
@ -900,7 +896,10 @@ class GooglepayButton extends PaymentButton {
|
|||
setPayerData( payer );
|
||||
|
||||
try {
|
||||
await processPaymentPromise( resolve );
|
||||
const orderId = await this.contextHandler.createOrder();
|
||||
this.log( 'createOrder', orderId );
|
||||
|
||||
await processPaymentPromise( resolve, orderId );
|
||||
} catch ( err ) {
|
||||
resolve( paymentError( err.message ) );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue