From ad508dd6391c79585864fac18b1685999a461d70 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Fri, 17 Nov 2023 10:54:32 -0500 Subject: [PATCH 1/2] CSR-1796 | Payment-method promo bug Revalidated promos were not being reflected at page-level memory correctly --- src/layouts/payment-method/payment-method.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index df63a8576..8226d4b57 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -182,9 +182,10 @@ export default { pricedLineItemsToTax, "payment-method" ); - + + // Add newly validated promos to the array to get taxed const newValidatedPromos = validatePromoResponse?.orderPromos ?? []; - + newValidatedPromos.push(...(revalidatePromoResponse ? revalidatePromoResponse.promoLineItems : [])); pricedLineItemsToTax.push(...newValidatedPromos); // End of promo logic @@ -208,9 +209,7 @@ export default { const lineItems = mapTaxedLineItemsToStoreFormat(taxedLineItems, lineItemsFromStore); const taxedVaps = mapTaxedLineItemsToStoreFormat(taxedLineItems, availableVaps); - // Add items that were not in the store yet but added via query string promo validation - lineItems.promos = lineItems.promos ?? []; - lineItems.promos.push(...newValidatedPromos); + lineItems.promos = newValidatedPromos ?? []; const vapsToAddToCart = getVapsThatNeedToBeAddedToSatisfyPromos( newValidatedPromos, taxedVaps, From 66e8b99febef33d1aab9f2ad049390bbb9459740 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Fri, 17 Nov 2023 10:55:26 -0500 Subject: [PATCH 2/2] Formatting --- src/layouts/payment-method/payment-method.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 8226d4b57..5dcb819d2 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -182,10 +182,12 @@ export default { pricedLineItemsToTax, "payment-method" ); - + // Add newly validated promos to the array to get taxed const newValidatedPromos = validatePromoResponse?.orderPromos ?? []; - newValidatedPromos.push(...(revalidatePromoResponse ? revalidatePromoResponse.promoLineItems : [])); + newValidatedPromos.push( + ...(revalidatePromoResponse ? revalidatePromoResponse.promoLineItems : []) + ); pricedLineItemsToTax.push(...newValidatedPromos); // End of promo logic