Skip to content

Commit

Permalink
[ECP-8452] Update maximum giftcard discount allowed to transaction li…
Browse files Browse the repository at this point in the history
…mit (#406)

* [ECP-8452] Updated giftcard amount to transaction limit

* [ECP-8452] Updated giftcard amount to transaction limit

---------

Co-authored-by: sushmita <[email protected]>
  • Loading branch information
SushmitaThakur and sushmita authored Aug 9, 2023
1 parent 9eb7a11 commit 936772d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Resources/app/storefront/src/cart/cart.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ export default class CartPlugin extends Plugin {
reject(response.resultCode);
} else {
// 0. compare balance to total amount to be paid
const balance = parseFloat(response.balance.value);
let remainingGiftcardBalanceMinorUnits = (balance - adyenGiftcardsConfiguration.totalInMinorUnits);
if (balance >= adyenGiftcardsConfiguration.totalInMinorUnits) {
const consumableBalance = response.transactionLimit ? parseFloat(response.transactionLimit.value) : parseFloat(response.balance.value);
let remainingGiftcardBalanceMinorUnits = (consumableBalance - adyenGiftcardsConfiguration.totalInMinorUnits);
if (consumableBalance >= adyenGiftcardsConfiguration.totalInMinorUnits) {
this.remainingGiftcardBalance = (remainingGiftcardBalanceMinorUnits / this.minorUnitsQuotient).toFixed(2);
this.setGiftcardAsPaymentMethod(data, remainingGiftcardBalanceMinorUnits);
} else {
this.remainingAmount = ((adyenGiftcardsConfiguration.totalInMinorUnits - balance) / this.minorUnitsQuotient).toFixed(2);
this.saveGiftcardStateData(data, balance.toString(), 0, this.selectedGiftcard.id);
this.remainingAmount = ((adyenGiftcardsConfiguration.totalInMinorUnits - consumableBalance) / this.minorUnitsQuotient).toFixed(2);
this.saveGiftcardStateData(data, consumableBalance.toString(), 0, this.selectedGiftcard.id);
}

this.remainingBalanceField.style.display = 'block';
Expand Down

0 comments on commit 936772d

Please sign in to comment.