Block UI during onApprove callback on PayNow
Some checks are pending
CI / PHP 7.4 (push) Waiting to run
CI / PHP 8.0 (push) Waiting to run
CI / PHP 8.1 (push) Waiting to run
CI / PHP 8.2 (push) Waiting to run
CI / PHP 8.3 (push) Waiting to run
CI / PHP 8.4 (push) Waiting to run
PR Playground Demo / prepare_version (push) Waiting to run
PR Playground Demo / build_plugin (push) Blocked by required conditions
PR Playground Demo / create_archive (push) Blocked by required conditions
PR Playground Demo / Comment on PR with Playground details (push) Blocked by required conditions

This commit is contained in:
Himad M 2025-08-26 18:14:16 -04:00
parent 02d05dc579
commit da9f40980d
No known key found for this signature in database
GPG key ID: 5FC769E9888A7B98
2 changed files with 8 additions and 3 deletions

View file

@ -158,7 +158,7 @@ class CheckoutActionHandler {
};
return {
createOrder,
onApprove: onApprove( this, this.errorHandler, this.spinner ),
onApprove: onApprove( this, this.errorHandler ),
onCancel: () => {
spinner.unblock();
},

View file

@ -1,5 +1,8 @@
const onApprove = ( context, errorHandler, spinner ) => {
import Spinner from '../Helper/Spinner';
const onApprove = ( context, errorHandler ) => {
return ( data, actions ) => {
const spinner = Spinner.fullPage();
spinner.block();
errorHandler.clear();
@ -19,7 +22,6 @@ const onApprove = ( context, errorHandler, spinner ) => {
return res.json();
} )
.then( ( data ) => {
spinner.unblock();
if ( ! data.success ) {
if ( data.data.code === 100 ) {
errorHandler.message( data.data.message );
@ -35,6 +37,9 @@ const onApprove = ( context, errorHandler, spinner ) => {
throw new Error( data.data.message );
}
document.querySelector( '#place_order' ).click();
} )
.finally( () => {
spinner.unblock();
} );
};
};