Skip to content

Commit

Permalink
Fix parseInt() radix
Browse files Browse the repository at this point in the history
  • Loading branch information
candemiralp committed Jan 18, 2023
1 parent 8cc1970 commit ac9b3d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Resources/app/storefront/src/cart/cart.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class CartPlugin extends Plugin {
this.removeGiftcard();
}.bind(this));

if (parseInt(adyenGiftcardsConfiguration.giftcardDiscount)) {
if (parseInt(adyenGiftcardsConfiguration.giftcardDiscount, 10)) {
this.onGiftcardSelected();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export default class ConfirmOrderPlugin extends Plugin {
}
}.bind(this));

if (parseInt(adyenCheckoutOptions.payInFullWithGiftcard)) {
if (parseInt(adyenCheckoutOptions.adyenGiftcardSelected)) {
if (parseInt(adyenCheckoutOptions.payInFullWithGiftcard, 10)) {
if (parseInt(adyenCheckoutOptions.adyenGiftcardSelected, 10)) {
this.appendGiftcardSummary();
}
} else {
Expand Down Expand Up @@ -193,7 +193,10 @@ export default class ConfirmOrderPlugin extends Plugin {
}

createOrder(formData, extraParams) {
if (parseInt(adyenCheckoutOptions.giftcardDiscount) && !parseInt(adyenCheckoutOptions.payInFullWithGiftcard)) {
if (
parseInt(adyenCheckoutOptions.giftcardDiscount, 10) &&
!parseInt(adyenCheckoutOptions.payInFullWithGiftcard, 10)
) {
// create Adyen order for partial payments
this._client.post(
adyenCheckoutOptions.createOrderUrl,
Expand Down Expand Up @@ -553,7 +556,7 @@ export default class ConfirmOrderPlugin extends Plugin {
}

appendGiftcardSummary() {
if(parseInt(adyenCheckoutOptions.giftcardDiscount) && this.shoppingCartSummaryBlock.length) {
if(parseInt(adyenCheckoutOptions.giftcardDiscount, 10) && this.shoppingCartSummaryBlock.length) {
this.shoppingCartSummaryDetails = $('<dt class="col-7 checkout-aside-summary-label checkout-aside-summary-total adyen-giftcard-summary">Giftcard discount</dt>' +
'<dd class="col-5 checkout-aside-summary-value checkout-aside-summary-total adyen-giftcard-summary">' + adyenCheckoutOptions.currencySymbol + this.giftcardDiscount + '</dd>' +
'<dt class="col-7 checkout-aside-summary-label checkout-aside-summary-total adyen-giftcard-summary">Remaining amount</dt>' +
Expand Down

0 comments on commit ac9b3d8

Please sign in to comment.