woocommerce-paypal-payments/modules/ppcp-googlepay/resources/js/Context/PayNowHandler.js
2024-08-13 18:41:42 +02:00

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;