Merge pull request #1543 from Safelite/feature/skiener/CSR-1796

CSR-1796 | Payment-method promo bug
This commit is contained in:
scottkiener 2023-11-17 11:01:12 -05:00 committed by GitHub
commit be09641046
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -183,8 +183,11 @@ export default {
"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 +211,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,