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-8452] Update maximum giftcard discount allowed to transaction limit #406

Merged
merged 2 commits into from
Aug 9, 2023
Merged
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
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
Loading