CSR-1796 | Payment-method promo bug

Revalidated promos were not being reflected at page-level memory correctly
This commit is contained in:
Scott Kiener 2023-11-17 10:54:32 -05:00
parent 6ac87dbe32
commit ad508dd639

View file

@ -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,