mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Add ButtonOptions support for the Google Pay button
This commit is contained in:
parent
7832f853ff
commit
b117ff9b7c
9 changed files with 305 additions and 93 deletions
|
@ -3,10 +3,11 @@ import GooglepayButton from './GooglepayButton';
|
|||
import ContextHandlerFactory from './Context/ContextHandlerFactory';
|
||||
|
||||
class GooglepayManager {
|
||||
constructor( namespace, buttonConfig, ppcpConfig ) {
|
||||
constructor( namespace, buttonConfig, ppcpConfig, buttonAttributes = {} ) {
|
||||
this.namespace = namespace;
|
||||
this.buttonConfig = buttonConfig;
|
||||
this.ppcpConfig = ppcpConfig;
|
||||
this.buttonAttributes = buttonAttributes;
|
||||
this.googlePayConfig = null;
|
||||
this.transactionInfo = null;
|
||||
this.contextHandler = null;
|
||||
|
@ -26,13 +27,18 @@ class GooglepayManager {
|
|||
bootstrap.handler,
|
||||
buttonConfig,
|
||||
ppcpConfig,
|
||||
this.contextHandler
|
||||
this.contextHandler,
|
||||
this.buttonAttributes
|
||||
);
|
||||
|
||||
this.buttons.push( button );
|
||||
|
||||
const initButton = () => {
|
||||
button.configure( this.googlePayConfig, this.transactionInfo );
|
||||
button.configure(
|
||||
this.googlePayConfig,
|
||||
this.transactionInfo,
|
||||
this.buttonAttributes
|
||||
);
|
||||
button.init();
|
||||
};
|
||||
|
||||
|
@ -70,7 +76,8 @@ class GooglepayManager {
|
|||
for ( const button of this.buttons ) {
|
||||
button.configure(
|
||||
this.googlePayConfig,
|
||||
this.transactionInfo
|
||||
this.transactionInfo,
|
||||
this.buttonAttributes
|
||||
);
|
||||
button.init();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue