mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Refactor GooglePay contect handlers to reuse action handlers.
This commit is contained in:
parent
318217acb9
commit
c6379ca980
8 changed files with 78 additions and 64 deletions
|
@ -4,6 +4,9 @@ import SimulateCart from "../../../../ppcp-button/resources/js/modules/Helper/Si
|
|||
import ErrorHandler from "../../../../ppcp-button/resources/js/modules/ErrorHandler";
|
||||
import UpdateCart from "../../../../ppcp-button/resources/js/modules/Helper/UpdateCart";
|
||||
import BaseHandler from "./BaseHandler";
|
||||
import CheckoutActionHandler
|
||||
from "../../../../ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler";
|
||||
import Spinner from "../../../../ppcp-button/resources/js/modules/Helper/Spinner";
|
||||
|
||||
class SingleProductHandler extends BaseHandler {
|
||||
|
||||
|
@ -48,23 +51,16 @@ class SingleProductHandler extends BaseHandler {
|
|||
});
|
||||
}
|
||||
|
||||
createOrder() {
|
||||
const errorHandler = new ErrorHandler(
|
||||
this.ppcpConfig.labels.error.generic,
|
||||
document.querySelector('.woocommerce-notices-wrapper')
|
||||
);
|
||||
|
||||
const actionHandler = new SingleProductActionHandler(
|
||||
actionHandler() {
|
||||
return new SingleProductActionHandler(
|
||||
this.ppcpConfig,
|
||||
new UpdateCart(
|
||||
this.ppcpConfig.ajax.change_cart.endpoint,
|
||||
this.ppcpConfig.ajax.change_cart.nonce,
|
||||
),
|
||||
document.querySelector('form.cart'),
|
||||
errorHandler,
|
||||
this.errorHandler(),
|
||||
);
|
||||
|
||||
return actionHandler.configuration().createOrder();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue