Skip to content

Commit

Permalink
Merge pull request #787 from buckaroo-it/BP-2537-prefilled-email-also…
Browse files Browse the repository at this point in the history
…-for-customer-users

BP-2537 prefilled email also for customer users
  • Loading branch information
LucianTuriacArnia authored Aug 31, 2023
2 parents 3f23cbb + 0780aee commit cc9e41c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions view/frontend/web/js/view/payment/method-renderer/payperemail.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,29 @@ 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 (typeof customerData === 'object' && customerData.hasOwnProperty('email')) {
this.email(customerData.email);
this.updateState(
'buckaroo_magento2_payperemail_Email',
customerData.email.length > 0
);
}

if(quote.guestEmail) {
this.email(quote.guestEmail);
this.updateState(
Expand Down

0 comments on commit cc9e41c

Please sign in to comment.