Add ButtonOptions support for the Google Pay button

This commit is contained in:
Daniel Dudzic 2024-11-07 01:00:53 +01:00
parent 7832f853ff
commit b117ff9b7c
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
9 changed files with 305 additions and 93 deletions

View file

@ -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();
}