From d1bb87755353b04c6bceaa9e43038348dde0fcb0 Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Mon, 7 Oct 2024 11:00:39 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Update=20the=20constructor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/js/ApplepayButton.js | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/modules/ppcp-applepay/resources/js/ApplepayButton.js b/modules/ppcp-applepay/resources/js/ApplepayButton.js index f79d347c0..a7688700c 100644 --- a/modules/ppcp-applepay/resources/js/ApplepayButton.js +++ b/modules/ppcp-applepay/resources/js/ApplepayButton.js @@ -93,21 +93,29 @@ class ApplePayButton extends PaymentButton { */ initialPaymentRequest = null; - constructor( context, externalHandler, buttonConfig, ppcpConfig ) { - apmButtonsInit( ppcpConfig ); + constructor( + context, + externalHandler, + buttonConfig, + ppcpConfig, + contextHandler + ) { + // Disable debug output in the browser console: + // buttonConfig.is_debug = false; - this.context = context; - this.externalHandler = externalHandler; - this.buttonConfig = buttonConfig; - this.ppcpConfig = ppcpConfig; + super( + context, + externalHandler, + buttonConfig, + ppcpConfig, + contextHandler + ); - this.contextHandler = ContextHandlerFactory.create( - this.context, - this.buttonConfig, - this.ppcpConfig - ); + this.init = this.init.bind( this ); + this.onPaymentAuthorized = this.onPaymentAuthorized.bind( this ); + this.onButtonClick = this.onButtonClick.bind( this ); - this.refreshContextData(); + this.log( 'Create instance' ); } /**