feat(core-flows,dashboard): add fixes to allow only outbound or inbound claims (#8590)

what:

- allows completing claim with only inbound items
- allows completing claim with only outbound items
- validates against creating claims when an active change order is present
This commit is contained in:
Riqwan Thamir
2024-08-14 21:09:05 +00:00
committed by GitHub
parent a45ff1c147
commit 4cb28531e5
12 changed files with 579 additions and 293 deletions
@@ -0,0 +1,12 @@
import { AdminPaymentCollection } from "@medusajs/types"
export const getTotalCaptured = (
paymentCollections: AdminPaymentCollection[]
) =>
paymentCollections.reduce((acc, paymentCollection) => {
acc =
acc +
((paymentCollection.captured_amount as number) -
(paymentCollection.refunded_amount as number))
return acc
}, 0)