hotfix: Claim return shipping (#244)

This commit is contained in:
Oliver Windall Juhl
2021-04-29 15:46:56 +02:00
committed by GitHub
parent 7cd9fd487e
commit bf4e8d8ff8
4 changed files with 103 additions and 37 deletions
+13 -24
View File
@@ -100,31 +100,20 @@ describe("ClaimService", () => {
expect(withTransactionMock).toHaveBeenCalledWith("return")
expect(returnService.create).toHaveBeenCalledTimes(1)
expect(returnService.create).toHaveBeenCalledWith(
{
claim_order_id: "claim_134",
shipping_method: {
option_id: "opt_13",
price: 0,
},
items: [
{
item_id: "itm_1",
quantity: 1,
},
],
expect(returnService.create).toHaveBeenCalledWith({
order_id: "1234",
claim_order_id: "claim_134",
shipping_method: {
option_id: "opt_13",
price: 0,
},
{
id: "1234",
region_id: "order_region",
items: [
{
id: "itm_1",
unit_price: 8000,
},
],
}
)
items: [
{
item_id: "itm_1",
quantity: 1,
},
],
})
expect(withTransactionMock).toHaveBeenCalledWith("lineItem")
expect(lineItemService.generate).toHaveBeenCalledTimes(1)
+10 -12
View File
@@ -252,18 +252,16 @@ class ClaimService extends BaseService {
}
if (return_shipping) {
await this.returnService_.withTransaction(manager).create(
{
claim_order_id: result.id,
items: claim_items.map(ci => ({
item_id: ci.item_id,
quantity: ci.quantity,
metadata: ci.metadata,
})),
shipping_method: return_shipping,
},
order
)
await this.returnService_.withTransaction(manager).create({
order_id: order.id,
claim_order_id: result.id,
items: claim_items.map(ci => ({
item_id: ci.item_id,
quantity: ci.quantity,
metadata: ci.metadata,
})),
shipping_method: return_shipping,
})
}
await this.eventBus_