From c7db298f7adb5c1caaaf01ca34bdd97871ca1eaa Mon Sep 17 00:00:00 2001 From: Lucian Turiac Date: Wed, 30 Aug 2023 20:22:38 +0300 Subject: [PATCH 1/2] BP-2537 - Prefilled email also for customer users --- .../web/js/view/payment/method-renderer/payperemail.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/view/frontend/web/js/view/payment/method-renderer/payperemail.js b/view/frontend/web/js/view/payment/method-renderer/payperemail.js index e1bb30d02..f81960029 100644 --- a/view/frontend/web/js/view/payment/method-renderer/payperemail.js +++ b/view/frontend/web/js/view/payment/method-renderer/payperemail.js @@ -100,6 +100,14 @@ define( } }, this); + if(customerData !== null) { + this.email(customerData.email); + this.updateState( + 'buckaroo_magento2_payperemail_Email', + customerData.email.length > 0 + ); + } + if(quote.guestEmail) { this.email(quote.guestEmail); this.updateState( From 0780aee7ebeaebf2fd318719f6f3affa9f7fe5b1 Mon Sep 17 00:00:00 2001 From: Lucian Turiac Date: Thu, 31 Aug 2023 13:21:41 +0300 Subject: [PATCH 2/2] BP-2537 - prefilled email for customer users PPE --- .../js/view/payment/method-renderer/payperemail.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/view/frontend/web/js/view/payment/method-renderer/payperemail.js b/view/frontend/web/js/view/payment/method-renderer/payperemail.js index f81960029..88b4cee98 100644 --- a/view/frontend/web/js/view/payment/method-renderer/payperemail.js +++ b/view/frontend/web/js/view/payment/method-renderer/payperemail.js @@ -85,22 +85,22 @@ define( ); quote.billingAddress.subscribe(function (address) { if(address !== null) { - this.firstName(address.firstname); - this.lastName(address.lastname); - this.middleName(address.middlename); + this.firstName(address.firstname || ''); + this.lastName(address.lastname || ''); + this.middleName(address.middlename || ''); this.updateState( 'buckaroo_magento2_payperemail_BillingFirstName', - address.firstname.length > 0 + address.firstname && address.firstname.length > 0 ); this.updateState( 'buckaroo_magento2_payperemail_BillingLastName', - address.lastname.length > 0 + address.lastname && address.lastname.length > 0 ); } }, this); - if(customerData !== null) { + if (typeof customerData === 'object' && customerData.hasOwnProperty('email')) { this.email(customerData.email); this.updateState( 'buckaroo_magento2_payperemail_Email',