feat(core-flows,types,utils): make payment optional when cart balance is 0 (#11872)

what:

- make payment optional when cart balance is 0
This commit is contained in:
Riqwan Thamir
2025-03-17 20:03:22 +01:00
committed by GitHub
parent 5ab15a2988
commit 9dd62d93bd
9 changed files with 122 additions and 33 deletions

View File

@@ -768,7 +768,7 @@ describe("Total calculation", function () {
},
],
total: 48,
subtotal: 60,
subtotal: 100,
tax_total: 8,
discount_total: 22,
discount_subtotal: 20,

View File

@@ -208,8 +208,6 @@ export function decorateCartTotals(
taxRate: creditLinesSumTaxRate,
})
subtotal = MathBN.sub(subtotal, creditLinesSubtotal)
const taxTotal = MathBN.add(itemsTaxTotal, shippingTaxTotal)
const originalTaxTotal = MathBN.add(
@@ -222,7 +220,7 @@ export function decorateCartTotals(
// TODO: subtract (cart.gift_card_total + cart.gift_card_tax_total)
const tempTotal = MathBN.add(subtotal, taxTotal)
const total = MathBN.sub(tempTotal, discountSubtotal)
const total = MathBN.sub(tempTotal, discountSubtotal, creditLinesTotal)
const cart = cartLike as any