mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-03 08:37:53 +08:00
Add GooglePay context handler classes
This commit is contained in:
parent
6a205d1413
commit
4a1d369ad2
11 changed files with 494 additions and 159 deletions
|
@ -0,0 +1,31 @@
|
|||
import SingleProductHandler from "./SingleProductHandler";
|
||||
import CartHandler from "./CartHandler";
|
||||
import CheckoutHandler from "./CheckoutHandler";
|
||||
import CartBlockHandler from "./CartBlockHandler";
|
||||
import CheckoutBlockHandler from "./CheckoutBlockHandler";
|
||||
|
||||
class ContextHandlerFactory {
|
||||
|
||||
static create(context, buttonConfig, ppcpConfig) {
|
||||
switch (context) {
|
||||
case 'product':
|
||||
return new SingleProductHandler(buttonConfig, ppcpConfig);
|
||||
case 'cart':
|
||||
return new CartHandler(buttonConfig, ppcpConfig);
|
||||
case 'checkout':
|
||||
return new CheckoutHandler(buttonConfig, ppcpConfig);
|
||||
case 'pay-now':
|
||||
// todo
|
||||
return null;
|
||||
case 'mini-cart':
|
||||
// todo
|
||||
return null;
|
||||
case 'cart-block':
|
||||
return new CartBlockHandler(buttonConfig, ppcpConfig);
|
||||
case 'checkout-block':
|
||||
return new CheckoutBlockHandler(buttonConfig, ppcpConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ContextHandlerFactory;
|
Loading…
Add table
Add a link
Reference in a new issue