fix(utils,core-flows): subtotal calculation and returns location (#13497)
* fix(utils,core-flows): subtotal calculation and returns location * changeset * fix test * var * rm extra field from test * fix original total * fix partial refunds and pending difference * fix test * fix test * test * extract to util * original total and update payment when receive return * original_subtotal * default fields * test * calculate pending difference * revert claims test * pending difference * creadit line fix * if
This commit is contained in:
committed by
GitHub
parent
4736c58da5
commit
9563ee446f
@@ -32,7 +32,35 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
await api.post(`/admin/claims/${claim.id}/request`, {}, adminHeaders)
|
||||
const createdClaim = await api.post(
|
||||
`/admin/claims/${claim.id}/request`,
|
||||
{},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const returnOrder = createdClaim.data.return
|
||||
const returnId = returnOrder.id
|
||||
await api.post(`/admin/returns/${returnId}/receive`, {}, adminHeaders)
|
||||
|
||||
let lineItem = returnOrder.items[0].item
|
||||
await api.post(
|
||||
`/admin/returns/${returnId}/receive-items`,
|
||||
{
|
||||
items: [
|
||||
{
|
||||
id: lineItem.id,
|
||||
quantity: returnOrder.items[0].quantity,
|
||||
},
|
||||
],
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
await api.post(
|
||||
`/admin/returns/${returnId}/receive/confirm`,
|
||||
{},
|
||||
adminHeaders
|
||||
)
|
||||
}
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -64,10 +92,6 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
|
||||
describe("with outstanding amount due to claim", () => {
|
||||
beforeEach(async () => {
|
||||
await createClaim({ order })
|
||||
})
|
||||
|
||||
it("should capture an authorized payment", async () => {
|
||||
const payment = order.payment_collections[0].payments[0]
|
||||
|
||||
@@ -189,6 +213,8 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
await createClaim({ order })
|
||||
|
||||
const refundReason = (
|
||||
await api.post(
|
||||
`/admin/refund-reasons`,
|
||||
@@ -253,6 +279,8 @@ medusaIntegrationTestRunner({
|
||||
)
|
||||
).data.refund_reason
|
||||
|
||||
await createClaim({ order })
|
||||
|
||||
await api.post(
|
||||
`/admin/payments/${payment.id}/refund`,
|
||||
{
|
||||
@@ -311,6 +339,8 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
await createClaim({ order })
|
||||
|
||||
await api.post(
|
||||
`/admin/payments/${payment.id}/refund`,
|
||||
{ amount: 25 },
|
||||
|
||||
Reference in New Issue
Block a user