mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Add ApplePay preview in admin settings.
This commit is contained in:
parent
eb956d9db6
commit
118e49cfde
10 changed files with 343 additions and 19 deletions
|
@ -4,6 +4,7 @@ import CheckoutHandler from "./CheckoutHandler";
|
|||
import CartBlockHandler from "./CartBlockHandler";
|
||||
import CheckoutBlockHandler from "./CheckoutBlockHandler";
|
||||
import MiniCartHandler from "./MiniCartHandler";
|
||||
import PreviewHandler from "./PreviewHandler";
|
||||
|
||||
class ContextHandlerFactory {
|
||||
|
||||
|
@ -22,6 +23,8 @@ class ContextHandlerFactory {
|
|||
return new CartBlockHandler(buttonConfig, ppcpConfig);
|
||||
case 'checkout-block':
|
||||
return new CheckoutBlockHandler(buttonConfig, ppcpConfig);
|
||||
case 'preview':
|
||||
return new PreviewHandler(buttonConfig, ppcpConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
37
modules/ppcp-applepay/resources/js/Context/PreviewHandler.js
Normal file
37
modules/ppcp-applepay/resources/js/Context/PreviewHandler.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
import BaseHandler from "./BaseHandler";
|
||||
|
||||
class PreviewHandler extends BaseHandler {
|
||||
|
||||
constructor(buttonConfig, ppcpConfig, externalHandler) {
|
||||
super(buttonConfig, ppcpConfig, externalHandler);
|
||||
}
|
||||
|
||||
transactionInfo() {
|
||||
// We need to return something as ApplePay button initialization expects valid data.
|
||||
return {
|
||||
countryCode: "US",
|
||||
currencyCode: "USD",
|
||||
totalPrice: "10.00",
|
||||
totalPriceStatus: "FINAL"
|
||||
}
|
||||
}
|
||||
|
||||
createOrder() {
|
||||
throw new Error('Create order fail. This is just a preview.');
|
||||
}
|
||||
|
||||
approveOrder(data, actions) {
|
||||
throw new Error('Approve order fail. This is just a preview.');
|
||||
}
|
||||
|
||||
actionHandler() {
|
||||
throw new Error('Action handler fail. This is just a preview.');
|
||||
}
|
||||
|
||||
errorHandler() {
|
||||
throw new Error('Error handler fail. This is just a preview.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default PreviewHandler;
|
Loading…
Add table
Add a link
Reference in a new issue