mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
♻️ Simplify the payment flow before order approval
This commit is contained in:
parent
ca76d33aa3
commit
7b579bfc9b
1 changed files with 7 additions and 8 deletions
|
@ -946,15 +946,14 @@ class GooglepayButton extends PaymentButton {
|
|||
|
||||
if ( ! isApprovedByPayPal ) {
|
||||
result = paymentError( 'TRANSACTION FAILED' );
|
||||
} else if ( isApprovedByPayPal === 'action_required' ) {
|
||||
await initiatePayerAction( orderId );
|
||||
const success = await captureOrderServerSide( orderId );
|
||||
if ( success ) {
|
||||
result = paymentResponse( 'SUCCESS' );
|
||||
} else {
|
||||
result = paymentError( 'FAILED TO APPROVE' );
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* This payment requires a 3DS verification before we can process the order.
|
||||
*/
|
||||
if ( isApprovedByPayPal === 'action_required' ) {
|
||||
await initiatePayerAction( orderId );
|
||||
}
|
||||
|
||||
const success = await approveOrderServerSide( orderId );
|
||||
|
||||
if ( success ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue