Skip to content

Commit

Permalink
Bugfix/paypal express currency (#1139)
Browse files Browse the repository at this point in the history
* fix(SFI-863): paypal express currency

* chore(SFI-863): update unit tests

* chore(SFI-863): update unit tests
  • Loading branch information
shanikantsingh authored Aug 12, 2024
1 parent 6447a6f commit 6e02e0e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

exports[`paypal express getPaypalButtonConfig should return config when review page is enabled 1`] = `
{
"amount": {
"currency": "USD",
"value": 1000,
},
"configuration": {},
"isExpress": true,
"onAdditionalDetails": [Function],
Expand All @@ -18,6 +22,10 @@ exports[`paypal express getPaypalButtonConfig should return config when review p

exports[`paypal express getPaypalButtonConfig should return config when review page is not enabled 1`] = `
{
"amount": {
"currency": "USD",
"value": 1000,
},
"configuration": {},
"isExpress": true,
"onAdditionalDetails": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ describe('paypal express', () => {
})
describe('getPaypalButtonConfig',() => {
window.returnUrl = 'test_returnUrl';
window.basketAmount = '{"currency":"USD","value":1000}';
beforeEach(() => {
jest.clearAllMocks();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ function getGiftCardConfig() {
async: false,
success: (data) => {
giftcardBalance = data.balance;
document.querySelector('button[value="submit-payment"]').disabled =
false;
document.querySelector(
'button[value="submit-payment"]',
).disabled = false;
if (data.resultCode === constants.SUCCESS) {
const {
giftCardsInfoMessageContainer,
Expand All @@ -226,8 +227,9 @@ function getGiftCardConfig() {
initialPartialObject.totalDiscountedAmount;
});

document.querySelector('button[value="submit-payment"]').disabled =
true;
document.querySelector(
'button[value="submit-payment"]',
).disabled = true;
giftCardsInfoMessageContainer.innerHTML = '';
giftCardsInfoMessageContainer.classList.remove(
'gift-cards-info-message-container',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ function removeGiftCards() {
giftCardsInfoMessageContainer.classList.remove(
'gift-cards-info-message-container',
);
document.querySelector('button[value="submit-payment"]').disabled =
false;
document.querySelector(
'button[value="submit-payment"]',
).disabled = false;

if (res.resultCode === constants.RECEIVED) {
document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ function getPaypalButtonConfig(paypalConfig) {
showPayButton: true,
configuration: paypalConfig,
returnUrl: window.returnUrl,
amount: JSON.parse(window.basketAmount),
isExpress: true,
...(paypalReviewPageEnabled ? { userAction: 'continue' } : {}),
onSubmit: async (state, component) => {
Expand Down

0 comments on commit 6e02e0e

Please sign in to comment.