Skip to content

Commit

Permalink
fix(core-flows): return refunded when all captured payments have been…
Browse files Browse the repository at this point in the history
… refunded (#10923)

what:

- returns refunded when all captured payments have been refunded
  • Loading branch information
riqwan authored Jan 13, 2025
1 parent 60dc8f6 commit 7232a8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sixty-peaches-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/core-flows": patch
---

fix(core-flows): return refunded when all captured payments have been refunded
5 changes: 4 additions & 1 deletion packages/core/core-flows/src/order/utils/aggregate-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ export const getLastPaymentStatus = (order: OrderDetailDTO) => {
}

if (paymentStatus[PaymentStatus.REFUNDED] > 0) {
if (paymentStatus[PaymentStatus.REFUNDED] === totalPaymentExceptCanceled) {
if (
paymentStatus[PaymentStatus.REFUNDED] ===
paymentStatus[PaymentStatus.CAPTURED]
) {
return PaymentStatus.REFUNDED
}

Expand Down

0 comments on commit 7232a8a

Please sign in to comment.