2023-10-13 17:57:03 +01:00
|
|
|
import Spinner from "../../../../ppcp-button/resources/js/modules/Helper/Spinner";
|
|
|
|
import BaseHandler from "./BaseHandler";
|
|
|
|
import CheckoutActionHandler
|
|
|
|
from "../../../../ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler";
|
|
|
|
|
|
|
|
class PayNowHandler extends BaseHandler {
|
|
|
|
|
2023-11-13 17:36:18 +00:00
|
|
|
validateContext() {
|
|
|
|
if ( this.ppcpConfig?.locations_with_subscription_product?.payorder ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-10-13 17:57:03 +01:00
|
|
|
shippingAllowed() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
transactionInfo() {
|
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
|
const data = this.ppcpConfig['pay_now'];
|
|
|
|
|
|
|
|
resolve({
|
|
|
|
countryCode: data.country_code,
|
|
|
|
currencyCode: data.currency_code,
|
|
|
|
totalPriceStatus: 'FINAL',
|
|
|
|
totalPrice: data.total_str
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
actionHandler() {
|
|
|
|
return new CheckoutActionHandler(
|
|
|
|
this.ppcpConfig,
|
|
|
|
this.errorHandler(),
|
|
|
|
new Spinner()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PayNowHandler;
|