mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
38 lines
886 B
JavaScript
38 lines
886 B
JavaScript
import Spinner from '../../../../ppcp-button/resources/js/modules/Helper/Spinner';
|
|
import BaseHandler from './BaseHandler';
|
|
import CheckoutActionHandler from '../../../../ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler';
|
|
import TransactionInfo from '../Helper/TransactionInfo';
|
|
|
|
class PayNowHandler extends BaseHandler {
|
|
validateContext() {
|
|
if ( this.ppcpConfig?.locations_with_subscription_product?.payorder ) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
transactionInfo() {
|
|
return new Promise( async ( resolve, reject ) => {
|
|
const data = this.ppcpConfig.pay_now;
|
|
|
|
resolve(
|
|
new TransactionInfo(
|
|
data.total,
|
|
data.currency_code,
|
|
data.country_code,
|
|
true
|
|
)
|
|
);
|
|
} );
|
|
}
|
|
|
|
actionHandler() {
|
|
return new CheckoutActionHandler(
|
|
this.ppcpConfig,
|
|
this.errorHandler(),
|
|
new Spinner()
|
|
);
|
|
}
|
|
}
|
|
|
|
export default PayNowHandler;
|