fix(core-flows): refresh payment collection (#13103)
This commit is contained in:
committed by
GitHub
parent
a48063ec26
commit
f6736d9661
5
.changeset/light-gorillas-play.md
Normal file
5
.changeset/light-gorillas-play.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/core-flows": patch
|
||||
---
|
||||
|
||||
fix(core-flows): refresh payment collection using raw total
|
||||
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user