Skip to content

Commit

Permalink
Merge branch 'main' into ECP-9598
Browse files Browse the repository at this point in the history
  • Loading branch information
candemiralp authored Jan 24, 2025
2 parents 0794084 + 3d64adc commit 8eae68c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 23 deletions.
14 changes: 11 additions & 3 deletions view/frontend/web/js/actions/updatePaypalOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ define([
'Adyen_ExpressCheckout/js/helpers/getIsLoggedIn',
'Adyen_ExpressCheckout/js/model/maskedId',
'Adyen_ExpressCheckout/js/helpers/getMaskedIdFromCart',
'Adyen_Payment/js/helper/currencyHelper'
], function (
storage,
urlBuilder,
getIsLoggedIn,
maskedIdModel,
getMaskedIdFromCart
getMaskedIdFromCart,
currencyHelper
) {
'use strict';

Expand All @@ -36,7 +38,10 @@ define([
type: 'Shipping',
amount: {
currency: currency,
value: Math.round(selectedShippingMethod.amount.value * 100)
value: currencyHelper.formatAmount(
Math.round(selectedShippingMethod.amount.value),
currency
)
},
selected: true
};
Expand All @@ -51,7 +56,10 @@ define([
type: 'Shipping',
amount: {
currency: currency,
value: Math.round(shippingMethods[i].amount * 100)
value: currencyHelper.formatAmount(
Math.round(shippingMethods[i].amount),
currency
)
},
selected: i === 0
};
Expand Down
42 changes: 25 additions & 17 deletions view/frontend/web/js/applepay/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ define([
'Adyen_ExpressCheckout/js/model/totals',
'Adyen_ExpressCheckout/js/model/currency',
'Adyen_ExpressCheckout/js/helpers/getCurrentPage',
'Adyen_ExpressCheckout/js/model/virtualQuote'
],
'Adyen_ExpressCheckout/js/model/virtualQuote',
'Adyen_Payment/js/helper/currencyHelper'
],
function (
Component,
$t,
Expand Down Expand Up @@ -64,7 +65,8 @@ define([
totalsModel,
currencyModel,
getCurrentPage,
virtualQuoteModel
virtualQuoteModel,
currencyHelper
) {
'use strict';

Expand Down Expand Up @@ -265,8 +267,14 @@ define([
},
amount: {
value: this.isProductView
? formatAmount(totalsModel().getTotal() * 100)
: formatAmount(getCartSubtotal() * 100),
? currencyHelper.formatAmount(
totalsModel().getTotal(),
currency
)
: currencyHelper.formatAmount(
getCartSubtotal(),
currency
),
currency: currency
},
isExpress: true,
Expand Down Expand Up @@ -295,16 +303,16 @@ define([

// Get the address.
let address = event.shippingContact,
// Create a payload.
// Create a payload.
payload = {
address: {
city: address.locality,
region: address.administrativeArea,
country_id: address.countryCode.toUpperCase(),
postcode: address.postalCode,
save_in_address_book: 0
}
};
address: {
city: address.locality,
region: address.administrativeArea,
country_id: address.countryCode.toUpperCase(),
postcode: address.postalCode,
save_in_address_book: 0
}
};

self.shippingAddress = payload.address;

Expand Down Expand Up @@ -406,9 +414,9 @@ define([
.done((response) => {
self.afterSetTotalsInfo(response, shippingMethod, self.isProductView, resolve);
}).fail((e) => {
console.error('Adyen ApplePay: Unable to get totals', e);
reject($t('We\'re unable to fetch the cart totals for you. Please try an alternative payment method.'));
});
console.error('Adyen ApplePay: Unable to get totals', e);
reject($t('We\'re unable to fetch the cart totals for you. Please try an alternative payment method.'));
});
});
},

Expand Down
14 changes: 11 additions & 3 deletions view/frontend/web/js/paypal_express/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ define([
'Adyen_ExpressCheckout/js/model/maskedId',
'Adyen_ExpressCheckout/js/helpers/getCurrentPage',
'Adyen_ExpressCheckout/js/helpers/getMaskedIdFromCart',
'Adyen_Payment/js/helper/currencyHelper'
], function (
Component,
$t,
Expand Down Expand Up @@ -77,7 +78,8 @@ define([
virtualQuoteModel,
maskedIdModel,
getCurrentPage,
getMaskedIdFromCart
getMaskedIdFromCart,
currencyHelper
) {
'use strict';

Expand Down Expand Up @@ -300,8 +302,14 @@ define([
amount: {
currency: currency,
value: this.isProductView
? formatAmount(totalsModel().getTotal() * 100)
: formatAmount(getCartSubtotal() * 100)
? currencyHelper.formatAmount(
totalsModel().getTotal(),
currency
)
: currencyHelper.formatAmount(
getCartSubtotal(),
currency
)
},
onSubmit: (state, component) => {
const paymentData = state.data;
Expand Down

0 comments on commit 8eae68c

Please sign in to comment.