Skip to content

Commit f6736d9

Browse files
fix(core-flows): refresh payment collection (#13103)
1 parent a48063e commit f6736d9

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.changeset/light-gorillas-play.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@medusajs/core-flows": patch
3+
---
4+
5+
fix(core-flows): refresh payment collection using raw total

packages/core/core-flows/src/cart/workflows/refresh-payment-collection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const refreshPaymentCollectionForCartWorkflow = createWorkflow(
120120
return {
121121
selector: { id: cart.payment_collection.id },
122122
update: {
123-
amount: cart.total,
123+
amount: cart.raw_total,
124124
currency_code: cart.currency_code,
125125
},
126126
}

packages/core/core-flows/src/order/utils/aggregate-status.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const getLastPaymentStatus = (order: OrderDetailDTO) => {
2626
(isDefined(paymentCollection.amount) &&
2727
MathBN.eq(paymentCollection.amount, 0))
2828
) {
29-
paymentStatus[PaymentStatus.CAPTURED] += MathBN.eq(
29+
paymentStatus[PaymentStatus.CAPTURED] += MathBN.gte(
3030
paymentCollection.captured_amount as number,
3131
paymentCollection.amount
3232
)
@@ -35,7 +35,7 @@ export const getLastPaymentStatus = (order: OrderDetailDTO) => {
3535
}
3636

3737
if (MathBN.gt(paymentCollection.refunded_amount ?? 0, 0)) {
38-
paymentStatus[PaymentStatus.REFUNDED] += MathBN.eq(
38+
paymentStatus[PaymentStatus.REFUNDED] += MathBN.gte(
3939
paymentCollection.refunded_amount as number,
4040
paymentCollection.amount
4141
)

0 commit comments

Comments
 (0)