Migrate Google Pay to the new script loader

This commit is contained in:
Daniel Dudzic 2024-10-07 15:30:27 +02:00
parent 07bedc4460
commit 869a47f3cd
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
5 changed files with 59 additions and 36 deletions

View file

@ -3,7 +3,8 @@ import GooglepayButton from './GooglepayButton';
import ContextHandlerFactory from './Context/ContextHandlerFactory';
class GooglepayManager {
constructor( buttonConfig, ppcpConfig ) {
constructor( namespace, buttonConfig, ppcpConfig ) {
this.namespace = namespace;
this.buttonConfig = buttonConfig;
this.ppcpConfig = ppcpConfig;
this.googlePayConfig = null;
@ -52,7 +53,9 @@ class GooglepayManager {
try {
if ( ! this.googlePayConfig ) {
// Gets GooglePay configuration of the PayPal merchant.
this.googlePayConfig = await paypal.Googlepay().config();
this.googlePayConfig = await window[ this.namespace ]
.Googlepay()
.config();
}
if ( ! this.transactionInfo ) {