fix(core-flows): refresh payment collection (#13103)

This commit is contained in:
Carlos R. L. Rodrigues
2025-07-31 09:06:20 -03:00
committed by GitHub
parent a48063ec26
commit f6736d9661
3 changed files with 8 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/core-flows": patch
---
fix(core-flows): refresh payment collection using raw total

View File

@@ -120,7 +120,7 @@ export const refreshPaymentCollectionForCartWorkflow = createWorkflow(
return {
selector: { id: cart.payment_collection.id },
update: {
amount: cart.total,
amount: cart.raw_total,
currency_code: cart.currency_code,
},
}

View File

@@ -26,7 +26,7 @@ export const getLastPaymentStatus = (order: OrderDetailDTO) => {
(isDefined(paymentCollection.amount) &&
MathBN.eq(paymentCollection.amount, 0))
) {
paymentStatus[PaymentStatus.CAPTURED] += MathBN.eq(
paymentStatus[PaymentStatus.CAPTURED] += MathBN.gte(
paymentCollection.captured_amount as number,
paymentCollection.amount
)
@@ -35,7 +35,7 @@ export const getLastPaymentStatus = (order: OrderDetailDTO) => {
}
if (MathBN.gt(paymentCollection.refunded_amount ?? 0, 0)) {
paymentStatus[PaymentStatus.REFUNDED] += MathBN.eq(
paymentStatus[PaymentStatus.REFUNDED] += MathBN.gte(
paymentCollection.refunded_amount as number,
paymentCollection.amount
)