Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECP-9559] Populate the shopper form fields of Oney 4X, 6X, 10X and 12X #2815

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
<item name="adyen_applepay" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-applepay-method</item>
<item name="adyen_boleto" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-boleto-method</item>
<item name="adyen_facilypay_3x" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-facilypay-3x-method</item>
<item name="adyen_facilypay_4x" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-facilypay-method</item>
<item name="adyen_facilypay_6x" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-facilypay-method</item>
<item name="adyen_facilypay_10x" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-facilypay-method</item>
<item name="adyen_facilypay_12x" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-facilypay-method</item>
<item name="adyen_googlepay" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-googlepay-method</item>
<item name="adyen_paypal" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-paypal-method</item>
<item name="adyen_giftcard" xsi:type="string">Adyen_Payment/js/view/payment/method-renderer/adyen-giftcard-method</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* See LICENSE.txt for license details.
*
* Author: Adyen <[email protected]>
*
* @deprecated This file will be removed on V10. Use `adyen-facilypay-method.js` instead.
*
*/
define(
[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2024 Adyen N.V. (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <[email protected]>
*/
define(
[
'Magento_Checkout/js/model/quote',
'Adyen_Payment/js/view/payment/method-renderer/adyen-pm-method',
],
function(
quote,
adyenPaymentMethod,
) {
return adyenPaymentMethod.extend({
initialize: function () {
this._super();
},
buildComponentConfiguration: function (paymentMethod, paymentMethodsExtraInfo) {
let baseComponentConfiguration = this._super();
let self = this;
let formattedShippingAddress = {};
let formattedBillingAddress = {};
let shopperDateOfBirth = '';
let email = {};

if (!!customerData.dob){
shopperDateOfBirth = customerData.dob;
}

if (!!customerData.email) {
email = customerData.email;
} else if (!!quote.guestEmail) {
email = quote.guestEmail;
};

if (!quote.isVirtual() && !!quote.shippingAddress()) {
formattedShippingAddress = self.getFormattedAddress(quote.shippingAddress());
}

if (!quote.isVirtual() && !!quote.billingAddress()) {
formattedBillingAddress = self.getFormattedAddress(quote.billingAddress());
}

if (formattedShippingAddress) {
baseComponentConfiguration.data.deliveryAddress = {
city: formattedShippingAddress.city,
country: formattedShippingAddress.country,
houseNumberOrName: formattedShippingAddress.houseNumber,
postalCode: formattedShippingAddress.postalCode,
street: formattedShippingAddress.street
}
}

if (formattedBillingAddress){
baseComponentConfiguration.data.personalDetails = {
firstName: formattedBillingAddress.firstName,
lastName: formattedBillingAddress.lastName,
telephoneNumber: formattedBillingAddress.telephone,
shopperEmail: email,
dateOfBirth: shopperDateOfBirth,
}
baseComponentConfiguration.data.billingAddress = {
city: formattedBillingAddress.city,
country: formattedBillingAddress.country,
houseNumberOrName: formattedBillingAddress.houseNumber,
postalCode: formattedBillingAddress.postalCode,
street: formattedBillingAddress.street,
}
}

return baseComponentConfiguration;
}
})
}
);
Loading