@medusajs/order 0.1.3 → 1.0.0-rc-20241003153304
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -26
- package/dist/index.js.map +1 -1
- package/dist/joiner-config.d.ts +2 -5
- package/dist/joiner-config.d.ts.map +1 -0
- package/dist/joiner-config.js +21 -28
- package/dist/joiner-config.js.map +1 -1
- package/dist/migrations/Migration20240219102530.d.ts +1 -0
- package/dist/migrations/Migration20240219102530.d.ts.map +1 -0
- package/dist/migrations/Migration20240219102530.js +53 -19
- package/dist/migrations/Migration20240219102530.js.map +1 -1
- package/dist/migrations/Migration20240604100512.d.ts +5 -0
- package/dist/migrations/Migration20240604100512.d.ts.map +1 -0
- package/dist/migrations/Migration20240604100512.js +371 -0
- package/dist/migrations/Migration20240604100512.js.map +1 -0
- package/dist/migrations/Migration20240715102100.d.ts +5 -0
- package/dist/migrations/Migration20240715102100.d.ts.map +1 -0
- package/dist/migrations/Migration20240715102100.js +15 -0
- package/dist/migrations/Migration20240715102100.js.map +1 -0
- package/dist/migrations/Migration20240715174100.d.ts +5 -0
- package/dist/migrations/Migration20240715174100.d.ts.map +1 -0
- package/dist/migrations/Migration20240715174100.js +21 -0
- package/dist/migrations/Migration20240715174100.js.map +1 -0
- package/dist/migrations/Migration20240716081800.d.ts +5 -0
- package/dist/migrations/Migration20240716081800.d.ts.map +1 -0
- package/dist/migrations/Migration20240716081800.js +67 -0
- package/dist/migrations/Migration20240716081800.js.map +1 -0
- package/dist/migrations/Migration20240801085921.d.ts +5 -0
- package/dist/migrations/Migration20240801085921.d.ts.map +1 -0
- package/dist/migrations/Migration20240801085921.js +30 -0
- package/dist/migrations/Migration20240801085921.js.map +1 -0
- package/dist/migrations/Migration20240821164505.d.ts +6 -0
- package/dist/migrations/Migration20240821164505.d.ts.map +1 -0
- package/dist/migrations/Migration20240821164505.js +26 -0
- package/dist/migrations/Migration20240821164505.js.map +1 -0
- package/dist/migrations/Migration20240821170920.d.ts +6 -0
- package/dist/migrations/Migration20240821170920.d.ts.map +1 -0
- package/dist/migrations/Migration20240821170920.js +18 -0
- package/dist/migrations/Migration20240821170920.js.map +1 -0
- package/dist/migrations/Migration20240827133639.d.ts +6 -0
- package/dist/migrations/Migration20240827133639.d.ts.map +1 -0
- package/dist/migrations/Migration20240827133639.js +17 -0
- package/dist/migrations/Migration20240827133639.js.map +1 -0
- package/dist/migrations/Migration20240902195921.d.ts +6 -0
- package/dist/migrations/Migration20240902195921.d.ts.map +1 -0
- package/dist/migrations/Migration20240902195921.js +16 -0
- package/dist/migrations/Migration20240902195921.js.map +1 -0
- package/dist/migrations/Migration20240913092514.d.ts +6 -0
- package/dist/migrations/Migration20240913092514.d.ts.map +1 -0
- package/dist/migrations/Migration20240913092514.js +17 -0
- package/dist/migrations/Migration20240913092514.js.map +1 -0
- package/dist/models/address.d.ts +4 -3
- package/dist/models/address.d.ts.map +1 -0
- package/dist/models/address.js +22 -22
- package/dist/models/address.js.map +1 -1
- package/dist/models/adjustment-line.d.ts +5 -3
- package/dist/models/adjustment-line.d.ts.map +1 -0
- package/dist/models/adjustment-line.js +6 -1
- package/dist/models/adjustment-line.js.map +1 -1
- package/dist/models/claim-item-image.d.ts +19 -0
- package/dist/models/claim-item-image.d.ts.map +1 -0
- package/dist/models/claim-item-image.js +109 -0
- package/dist/models/claim-item-image.js.map +1 -0
- package/dist/models/claim-item.d.ts +29 -0
- package/dist/models/claim-item.d.ts.map +1 -0
- package/dist/models/claim-item.js +157 -0
- package/dist/models/claim-item.js.map +1 -0
- package/dist/models/claim.d.ts +37 -0
- package/dist/models/claim.d.ts.map +1 -0
- package/dist/models/claim.js +201 -0
- package/dist/models/claim.js.map +1 -0
- package/dist/models/exchange-item.d.ts +24 -0
- package/dist/models/exchange-item.d.ts.map +1 -0
- package/dist/models/exchange-item.js +138 -0
- package/dist/models/exchange-item.js.map +1 -0
- package/dist/models/exchange.d.ts +35 -0
- package/dist/models/exchange.d.ts.map +1 -0
- package/dist/models/exchange.js +194 -0
- package/dist/models/exchange.js.map +1 -0
- package/dist/models/index.d.ts +18 -9
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +26 -10
- package/dist/models/index.js.map +1 -1
- package/dist/models/line-item-adjustment.d.ts +5 -3
- package/dist/models/line-item-adjustment.d.ts.map +1 -0
- package/dist/models/line-item-adjustment.js +12 -12
- package/dist/models/line-item-adjustment.js.map +1 -1
- package/dist/models/line-item-tax-line.d.ts +5 -3
- package/dist/models/line-item-tax-line.d.ts.map +1 -0
- package/dist/models/line-item-tax-line.js +12 -12
- package/dist/models/line-item-tax-line.js.map +1 -1
- package/dist/models/line-item.d.ts +11 -8
- package/dist/models/line-item.d.ts.map +1 -0
- package/dist/models/line-item.js +58 -39
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/order-change-action.d.ts +17 -6
- package/dist/models/order-change-action.d.ts.map +1 -0
- package/dist/models/order-change-action.js +110 -8
- package/dist/models/order-change-action.js.map +1 -1
- package/dist/models/order-change.d.ts +18 -6
- package/dist/models/order-change.d.ts.map +1 -0
- package/dist/models/order-change.js +108 -6
- package/dist/models/order-change.js.map +1 -1
- package/dist/models/order-item.d.ts +10 -7
- package/dist/models/order-item.d.ts.map +1 -0
- package/dist/models/order-item.js +29 -19
- package/dist/models/order-item.js.map +1 -1
- package/dist/models/order-shipping-method.d.ts +17 -7
- package/dist/models/order-shipping-method.d.ts.map +1 -0
- package/dist/models/order-shipping-method.js +113 -33
- package/dist/models/order-shipping-method.js.map +1 -1
- package/dist/models/order-summary.d.ts +7 -8
- package/dist/models/order-summary.d.ts.map +1 -0
- package/dist/models/order-summary.js +14 -10
- package/dist/models/order-summary.js.map +1 -1
- package/dist/models/order.d.ts +13 -11
- package/dist/models/order.d.ts.map +1 -0
- package/dist/models/order.js +12 -2
- package/dist/models/order.js.map +1 -1
- package/dist/models/return-item.d.ts +31 -0
- package/dist/models/return-item.d.ts.map +1 -0
- package/dist/models/return-item.js +180 -0
- package/dist/models/return-item.js.map +1 -0
- package/dist/models/return-reason.d.ts +22 -0
- package/dist/models/return-reason.d.ts.map +1 -0
- package/dist/models/return-reason.js +122 -0
- package/dist/models/return-reason.js.map +1 -0
- package/dist/models/return.d.ts +41 -0
- package/dist/models/return.d.ts.map +1 -0
- package/dist/models/return.js +227 -0
- package/dist/models/return.js.map +1 -0
- package/dist/models/shipping-method-adjustment.d.ts +5 -3
- package/dist/models/shipping-method-adjustment.d.ts.map +1 -0
- package/dist/models/shipping-method-adjustment.js +12 -12
- package/dist/models/shipping-method-adjustment.js.map +1 -1
- package/dist/models/shipping-method-tax-line.d.ts +5 -3
- package/dist/models/shipping-method-tax-line.d.ts.map +1 -0
- package/dist/models/shipping-method-tax-line.js +12 -12
- package/dist/models/shipping-method-tax-line.js.map +1 -1
- package/dist/models/shipping-method.d.ts +10 -7
- package/dist/models/shipping-method.d.ts.map +1 -0
- package/dist/models/shipping-method.js +42 -24
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/tax-line.d.ts +4 -2
- package/dist/models/tax-line.d.ts.map +1 -0
- package/dist/models/tax-line.js +8 -1
- package/dist/models/tax-line.js.map +1 -1
- package/dist/models/transaction.d.ts +18 -6
- package/dist/models/transaction.d.ts.map +1 -0
- package/dist/models/transaction.js +133 -24
- package/dist/models/transaction.js.map +1 -1
- package/dist/repositories/claim.d.ts +9 -0
- package/dist/repositories/claim.d.ts.map +1 -0
- package/dist/repositories/claim.js +11 -0
- package/dist/repositories/claim.js.map +1 -0
- package/dist/repositories/exchange.d.ts +9 -0
- package/dist/repositories/exchange.d.ts.map +1 -0
- package/dist/repositories/exchange.js +11 -0
- package/dist/repositories/exchange.js.map +1 -0
- package/dist/repositories/index.d.ts +5 -2
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +8 -17
- package/dist/repositories/index.js.map +1 -1
- package/dist/repositories/order.d.ts +2 -4
- package/dist/repositories/order.d.ts.map +1 -0
- package/dist/repositories/order.js +3 -86
- package/dist/repositories/order.js.map +1 -1
- package/dist/repositories/return.d.ts +9 -0
- package/dist/repositories/return.d.ts.map +1 -0
- package/dist/repositories/return.js +11 -0
- package/dist/repositories/return.js.map +1 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +556 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/services/actions/cancel-claim.d.ts +3 -0
- package/dist/services/actions/cancel-claim.d.ts.map +1 -0
- package/dist/services/actions/cancel-claim.js +85 -0
- package/dist/services/actions/cancel-claim.js.map +1 -0
- package/dist/services/actions/cancel-exchange.d.ts +3 -0
- package/dist/services/actions/cancel-exchange.d.ts.map +1 -0
- package/dist/services/actions/cancel-exchange.js +71 -0
- package/dist/services/actions/cancel-exchange.js.map +1 -0
- package/dist/services/actions/cancel-fulfillment.d.ts +3 -0
- package/dist/services/actions/cancel-fulfillment.d.ts.map +1 -0
- package/dist/services/actions/cancel-fulfillment.js +31 -0
- package/dist/services/actions/cancel-fulfillment.js.map +1 -0
- package/dist/services/actions/cancel-return.d.ts +3 -0
- package/dist/services/actions/cancel-return.d.ts.map +1 -0
- package/dist/services/actions/cancel-return.js +69 -0
- package/dist/services/actions/cancel-return.js.map +1 -0
- package/dist/services/actions/create-claim.d.ts +3 -0
- package/dist/services/actions/create-claim.d.ts.map +1 -0
- package/dist/services/actions/create-claim.js +225 -0
- package/dist/services/actions/create-claim.js.map +1 -0
- package/dist/services/actions/create-exchange.d.ts +3 -0
- package/dist/services/actions/create-exchange.d.ts.map +1 -0
- package/dist/services/actions/create-exchange.js +191 -0
- package/dist/services/actions/create-exchange.js.map +1 -0
- package/dist/services/actions/create-return.d.ts +3 -0
- package/dist/services/actions/create-return.d.ts.map +1 -0
- package/dist/services/actions/create-return.js +100 -0
- package/dist/services/actions/create-return.js.map +1 -0
- package/dist/services/actions/index.d.ts +12 -0
- package/dist/services/actions/index.d.ts.map +1 -0
- package/dist/services/actions/index.js +28 -0
- package/dist/services/actions/index.js.map +1 -0
- package/dist/services/actions/receive-return.d.ts +3 -0
- package/dist/services/actions/receive-return.d.ts.map +1 -0
- package/dist/services/actions/receive-return.js +71 -0
- package/dist/services/actions/receive-return.js.map +1 -0
- package/dist/services/actions/register-delivery.d.ts +3 -0
- package/dist/services/actions/register-delivery.d.ts.map +1 -0
- package/dist/services/actions/register-delivery.js +29 -0
- package/dist/services/actions/register-delivery.js.map +1 -0
- package/dist/services/actions/register-fulfillment.d.ts +3 -0
- package/dist/services/actions/register-fulfillment.d.ts.map +1 -0
- package/dist/services/actions/register-fulfillment.js +29 -0
- package/dist/services/actions/register-fulfillment.js.map +1 -0
- package/dist/services/actions/register-shipment.d.ts +3 -0
- package/dist/services/actions/register-shipment.d.ts.map +1 -0
- package/dist/services/actions/register-shipment.js +37 -0
- package/dist/services/actions/register-shipment.js.map +1 -0
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +1 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/order-module-service.d.ts +191 -109
- package/dist/services/order-module-service.d.ts.map +1 -0
- package/dist/services/order-module-service.js +1165 -425
- package/dist/services/order-module-service.js.map +1 -1
- package/dist/services/order-service.d.ts +6 -5
- package/dist/services/order-service.d.ts.map +1 -0
- package/dist/services/order-service.js +2 -2
- package/dist/services/order-service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/address.d.ts +2 -1
- package/dist/types/address.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/line-item-adjustment.d.ts +2 -1
- package/dist/types/line-item-adjustment.d.ts.map +1 -0
- package/dist/types/line-item-tax-line.d.ts +1 -0
- package/dist/types/line-item-tax-line.d.ts.map +1 -0
- package/dist/types/line-item.d.ts +2 -1
- package/dist/types/line-item.d.ts.map +1 -0
- package/dist/types/order-change.d.ts +4 -0
- package/dist/types/order-change.d.ts.map +1 -0
- package/dist/types/order-change.js +3 -0
- package/dist/types/order-change.js.map +1 -0
- package/dist/types/order-detail.d.ts +3 -2
- package/dist/types/order-detail.d.ts.map +1 -0
- package/dist/types/order.d.ts +4 -3
- package/dist/types/order.d.ts.map +1 -0
- package/dist/types/return-reason.d.ts +5 -0
- package/dist/types/return-reason.d.ts.map +1 -0
- package/dist/types/return-reason.js +3 -0
- package/dist/types/return-reason.js.map +1 -0
- package/dist/types/shipping-method-adjustment.d.ts +2 -1
- package/dist/types/shipping-method-adjustment.d.ts.map +1 -0
- package/dist/types/shipping-method-tax-line.d.ts +1 -0
- package/dist/types/shipping-method-tax-line.d.ts.map +1 -0
- package/dist/types/shipping-method.d.ts +5 -1
- package/dist/types/shipping-method.d.ts.map +1 -0
- package/dist/types/tax-line.d.ts +2 -1
- package/dist/types/tax-line.d.ts.map +1 -0
- package/dist/types/transaction.d.ts +2 -1
- package/dist/types/transaction.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +41 -23
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/index.js +0 -1
- package/dist/types/utils/index.js.map +1 -1
- package/dist/utils/actions/cancel-item-fulfillment.d.ts +2 -0
- package/dist/utils/actions/cancel-item-fulfillment.d.ts.map +1 -0
- package/dist/utils/actions/cancel-item-fulfillment.js +34 -0
- package/dist/utils/actions/cancel-item-fulfillment.js.map +1 -0
- package/dist/utils/actions/cancel-return.d.ts +1 -0
- package/dist/utils/actions/cancel-return.d.ts.map +1 -0
- package/dist/utils/actions/cancel-return.js +9 -16
- package/dist/utils/actions/cancel-return.js.map +1 -1
- package/dist/utils/actions/deliver-item.d.ts +2 -0
- package/dist/utils/actions/deliver-item.d.ts.map +1 -0
- package/dist/utils/actions/deliver-item.js +38 -0
- package/dist/utils/actions/deliver-item.js.map +1 -0
- package/dist/utils/actions/fulfill-item.d.ts +1 -0
- package/dist/utils/actions/fulfill-item.d.ts.map +1 -0
- package/dist/utils/actions/fulfill-item.js +8 -12
- package/dist/utils/actions/fulfill-item.js.map +1 -1
- package/dist/utils/actions/index.d.ts +7 -1
- package/dist/utils/actions/index.d.ts.map +1 -0
- package/dist/utils/actions/index.js +6 -1
- package/dist/utils/actions/index.js.map +1 -1
- package/dist/utils/actions/item-add.d.ts +1 -0
- package/dist/utils/actions/item-add.d.ts.map +1 -0
- package/dist/utils/actions/item-add.js +17 -26
- package/dist/utils/actions/item-add.js.map +1 -1
- package/dist/utils/actions/item-remove.d.ts +1 -0
- package/dist/utils/actions/item-remove.d.ts.map +1 -0
- package/dist/utils/actions/item-remove.js +10 -30
- package/dist/utils/actions/item-remove.js.map +1 -1
- package/dist/utils/actions/item-update.d.ts +2 -0
- package/dist/utils/actions/item-update.d.ts.map +1 -0
- package/dist/utils/actions/item-update.js +37 -0
- package/dist/utils/actions/item-update.js.map +1 -0
- package/dist/utils/actions/receive-damaged-return-item.d.ts +1 -0
- package/dist/utils/actions/receive-damaged-return-item.d.ts.map +1 -0
- package/dist/utils/actions/receive-damaged-return-item.js +11 -37
- package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
- package/dist/utils/actions/receive-return-item.d.ts +1 -0
- package/dist/utils/actions/receive-return-item.d.ts.map +1 -0
- package/dist/utils/actions/receive-return-item.js +9 -38
- package/dist/utils/actions/receive-return-item.js.map +1 -1
- package/dist/utils/actions/reinstate-item.d.ts +2 -0
- package/dist/utils/actions/reinstate-item.d.ts.map +1 -0
- package/dist/utils/actions/reinstate-item.js +32 -0
- package/dist/utils/actions/reinstate-item.js.map +1 -0
- package/dist/utils/actions/return-item.d.ts +1 -0
- package/dist/utils/actions/return-item.d.ts.map +1 -0
- package/dist/utils/actions/return-item.js +10 -15
- package/dist/utils/actions/return-item.js.map +1 -1
- package/dist/utils/actions/ship-item.d.ts +1 -0
- package/dist/utils/actions/ship-item.d.ts.map +1 -0
- package/dist/utils/actions/ship-item.js +8 -12
- package/dist/utils/actions/ship-item.js.map +1 -1
- package/dist/utils/actions/shipping-add.d.ts +1 -0
- package/dist/utils/actions/shipping-add.d.ts.map +1 -0
- package/dist/utils/actions/shipping-add.js +18 -18
- package/dist/utils/actions/shipping-add.js.map +1 -1
- package/dist/utils/actions/shipping-remove.d.ts +2 -0
- package/dist/utils/actions/shipping-remove.d.ts.map +1 -0
- package/dist/utils/actions/shipping-remove.js +22 -0
- package/dist/utils/actions/shipping-remove.js.map +1 -0
- package/dist/utils/actions/write-off-item.d.ts +1 -0
- package/dist/utils/actions/write-off-item.d.ts.map +1 -0
- package/dist/utils/actions/write-off-item.js +8 -12
- package/dist/utils/actions/write-off-item.js.map +1 -1
- package/dist/utils/apply-order-changes.d.ts +18 -0
- package/dist/utils/apply-order-changes.d.ts.map +1 -0
- package/dist/utils/apply-order-changes.js +98 -0
- package/dist/utils/apply-order-changes.js.map +1 -0
- package/dist/utils/base-repository-find.d.ts +3 -0
- package/dist/utils/base-repository-find.d.ts.map +1 -0
- package/dist/utils/base-repository-find.js +154 -0
- package/dist/utils/base-repository-find.js.map +1 -0
- package/dist/utils/calculate-order-change.d.ts +12 -6
- package/dist/utils/calculate-order-change.d.ts.map +1 -0
- package/dist/utils/calculate-order-change.js +56 -187
- package/dist/utils/calculate-order-change.js.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/set-action-reference.d.ts +2 -0
- package/dist/utils/set-action-reference.d.ts.map +1 -0
- package/dist/utils/set-action-reference.js +10 -0
- package/dist/utils/set-action-reference.js.map +1 -0
- package/dist/utils/transform-order.d.ts +5 -4
- package/dist/utils/transform-order.d.ts.map +1 -0
- package/dist/utils/transform-order.js +138 -21
- package/dist/utils/transform-order.js.map +1 -1
- package/package.json +25 -26
- package/dist/module-definition.d.ts +0 -2
- package/dist/module-definition.js +0 -59
- package/dist/module-definition.js.map +0 -1
- package/dist/scripts/bin/run-seed.d.ts +0 -3
- package/dist/scripts/bin/run-seed.js +0 -49
- package/dist/scripts/bin/run-seed.js.map +0 -1
- package/dist/services/order-change-service.d.ts +0 -15
- package/dist/services/order-change-service.js +0 -96
- package/dist/services/order-change-service.js.map +0 -1
- package/dist/utils/action-key.d.ts +0 -13
- package/dist/utils/action-key.js +0 -18
- package/dist/utils/action-key.js.map +0 -1
- package/dist/utils/actions/cancel.d.ts +0 -1
- package/dist/utils/actions/cancel.js +0 -8
- package/dist/utils/actions/cancel.js.map +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create-exchange.js","sourceRoot":"","sources":["../../../src/services/actions/create-exchange.ts"],"names":[],"mappings":";;AAqPA,wCAwEC;AAxTD,qDAOkC;AAClC,qCAA8E;AAE9E,SAAS,+BAA+B,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK;IACtD,MAAM,iBAAiB,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAa,EAAE;QACjD,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,aAAa,EAAE,KAAK,CAAC,OAAO;QAC5B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,cAAc,EAAE,IAAI,CAAC,cAAc;KACpC,CAAC,CAAA;IAEF,MAAM,eAAe,GAAG,EAAE,CAAC,MAAM,CAAC,gBAAM,EAAE;QACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,aAAa,EAAE,KAAK,CAAC,OAAO;QAC5B,MAAM,EAAE,oBAAY,CAAC,SAAS;QAC9B,WAAW,EAAE,iBAAiB,CAAC,EAAE;QACjC,aAAa,EAAG,IAAI,CAAC,aAAyB,IAAI,IAAI;KACvD,CAAC,CAAA;IAEF,iBAAiB,CAAC,SAAS,GAAG,eAAe,CAAC,EAAE,CAAA;IAEhD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,CAAA;AAC/C,CAAC;AAED,SAAS,iBAAiB,CACxB,EAAE,EACF,IAAI,EACJ,iBAAiB,EACjB,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EACjB,eAAe,EACf,OAAO,EACP,aAAa,CACd,CAAA;IAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAC1C;QACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,iBAAiB,CAAC,EAAE;QACjC,SAAS,EAAE,eAAe,CAAC,EAAE;QAC7B,WAAW,EAAE,uBAAe,CAAC,QAAQ;QACrC,SAAS,EAAE,UAAU;QACrB,YAAY,EAAE,iBAAiB,CAAC,EAAE;QAClC,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO;KACR,EACD,aAAa,CACd,CAAA;IAED,MAAM,IAAA,kBAAU,EAAC;QACf,IAAI,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC;QACpD,IAAI,CAAC,oBAAoB,CAAC,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC;QAC7D,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC;KACrD,CAAC,CAAA;IAEF,OAAO,iBAAiB,CAAA;AAC1B,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create-return.d.ts","sourceRoot":"","sources":["../../../src/services/actions/create-return.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EACX,MAAM,2BAA2B,CAAA;AA6HlC,wBAAsB,YAAY,CAChC,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,UAAU,CAAC,oBAAoB,EACrC,aAAa,CAAC,EAAE,OAAO,gBA8BxB"}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createReturn = createReturn;
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
|
+
const _models_1 = require("../../models");
|
6
|
+
function createReturnReference(em, data, order) {
|
7
|
+
return em.create(_models_1.Return, {
|
8
|
+
order_id: data.order_id,
|
9
|
+
order_version: order.version,
|
10
|
+
status: utils_1.ReturnStatus.REQUESTED,
|
11
|
+
no_notification: data.no_notification,
|
12
|
+
refund_amount: data.refund_amount ?? null,
|
13
|
+
});
|
14
|
+
}
|
15
|
+
function createReturnItems(em, data, returnRef, actions) {
|
16
|
+
return data.items.map((item) => {
|
17
|
+
actions.push({
|
18
|
+
action: utils_1.ChangeActionType.RETURN_ITEM,
|
19
|
+
return_id: returnRef.id,
|
20
|
+
internal_note: item.internal_note,
|
21
|
+
reference: "return",
|
22
|
+
reference_id: returnRef.id,
|
23
|
+
details: {
|
24
|
+
reference_id: item.id,
|
25
|
+
quantity: item.quantity,
|
26
|
+
metadata: item.metadata,
|
27
|
+
},
|
28
|
+
});
|
29
|
+
return em.create(_models_1.ReturnItem, {
|
30
|
+
reason_id: item.reason_id,
|
31
|
+
return_id: returnRef.id,
|
32
|
+
item_id: item.id,
|
33
|
+
quantity: item.quantity,
|
34
|
+
note: item.note,
|
35
|
+
metadata: item.metadata,
|
36
|
+
});
|
37
|
+
});
|
38
|
+
}
|
39
|
+
async function processShippingMethod(service, data, returnRef, actions, sharedContext) {
|
40
|
+
let shippingMethodId;
|
41
|
+
if (!(0, utils_1.isDefined)(data.shipping_method)) {
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
if (!(0, utils_1.isString)(data.shipping_method)) {
|
45
|
+
const methods = await service.createOrderShippingMethods([
|
46
|
+
{
|
47
|
+
...data.shipping_method,
|
48
|
+
order_id: data.order_id,
|
49
|
+
return_id: returnRef.id,
|
50
|
+
},
|
51
|
+
], sharedContext);
|
52
|
+
shippingMethodId = methods[0].id;
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
shippingMethodId = data.shipping_method;
|
56
|
+
}
|
57
|
+
const method = await service.retrieveOrderShippingMethod(shippingMethodId, { relations: ["tax_lines", "adjustments"] }, sharedContext);
|
58
|
+
const calculatedAmount = (0, utils_1.getShippingMethodsTotals)([method], {})[method.id];
|
59
|
+
if (shippingMethodId) {
|
60
|
+
actions.push({
|
61
|
+
action: utils_1.ChangeActionType.SHIPPING_ADD,
|
62
|
+
reference: "order_shipping_method",
|
63
|
+
reference_id: shippingMethodId,
|
64
|
+
amount: calculatedAmount.total,
|
65
|
+
details: {
|
66
|
+
order_id: returnRef.order_id,
|
67
|
+
return_id: returnRef.id,
|
68
|
+
},
|
69
|
+
});
|
70
|
+
}
|
71
|
+
}
|
72
|
+
async function createOrderChange(service, data, returnRef, actions, sharedContext) {
|
73
|
+
return await service.createOrderChange_({
|
74
|
+
order_id: data.order_id,
|
75
|
+
return_id: returnRef.id,
|
76
|
+
change_type: utils_1.OrderChangeType.RETURN_REQUEST,
|
77
|
+
reference: "return",
|
78
|
+
reference_id: returnRef.id,
|
79
|
+
description: data.description,
|
80
|
+
internal_note: data.internal_note,
|
81
|
+
created_by: data.created_by,
|
82
|
+
metadata: data.metadata,
|
83
|
+
actions,
|
84
|
+
}, sharedContext);
|
85
|
+
}
|
86
|
+
async function createReturn(data, sharedContext) {
|
87
|
+
const order = await this.orderService_.retrieve(data.order_id, { relations: ["items"] }, sharedContext);
|
88
|
+
const em = sharedContext.transactionManager;
|
89
|
+
const returnRef = createReturnReference(em, data, order);
|
90
|
+
const actions = [];
|
91
|
+
returnRef.items = createReturnItems(em, data, returnRef, actions);
|
92
|
+
await processShippingMethod(this, data, returnRef, actions, sharedContext);
|
93
|
+
const change = await createOrderChange(this, data, returnRef, actions, sharedContext);
|
94
|
+
await (0, utils_1.promiseAll)([
|
95
|
+
this.createReturns([returnRef], sharedContext),
|
96
|
+
this.confirmOrderChange(change[0].id, sharedContext),
|
97
|
+
]);
|
98
|
+
return returnRef;
|
99
|
+
}
|
100
|
+
//# sourceMappingURL=create-return.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,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AAC;QACf,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;QAC9C,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC;KACrD,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export * from "./cancel-claim";
|
2
|
+
export * from "./cancel-exchange";
|
3
|
+
export * from "./cancel-fulfillment";
|
4
|
+
export * from "./cancel-return";
|
5
|
+
export * from "./create-claim";
|
6
|
+
export * from "./create-exchange";
|
7
|
+
export * from "./create-return";
|
8
|
+
export * from "./receive-return";
|
9
|
+
export * from "./register-delivery";
|
10
|
+
export * from "./register-fulfillment";
|
11
|
+
export * from "./register-shipment";
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./cancel-claim"), exports);
|
18
|
+
__exportStar(require("./cancel-exchange"), exports);
|
19
|
+
__exportStar(require("./cancel-fulfillment"), exports);
|
20
|
+
__exportStar(require("./cancel-return"), exports);
|
21
|
+
__exportStar(require("./create-claim"), exports);
|
22
|
+
__exportStar(require("./create-exchange"), exports);
|
23
|
+
__exportStar(require("./create-return"), exports);
|
24
|
+
__exportStar(require("./receive-return"), exports);
|
25
|
+
__exportStar(require("./register-delivery"), exports);
|
26
|
+
__exportStar(require("./register-fulfillment"), exports);
|
27
|
+
__exportStar(require("./register-shipment"), exports);
|
28
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,oDAAiC;AACjC,uDAAoC;AACpC,kDAA+B;AAC/B,iDAA8B;AAC9B,oDAAiC;AACjC,kDAA+B;AAC/B,mDAAgC;AAChC,sDAAmC;AACnC,yDAAsC;AACtC,sDAAmC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"receive-return.d.ts","sourceRoot":"","sources":["../../../src/services/actions/receive-return.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AA8E/D,wBAAsB,aAAa,CACjC,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,UAAU,CAAC,qBAAqB,EACtC,aAAa,CAAC,EAAE,OAAO,gBAmCxB"}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.receiveReturn = receiveReturn;
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
|
+
function createReturnItems(data) {
|
6
|
+
return data.items.map((item) => ({
|
7
|
+
action: utils_1.ChangeActionType.RECEIVE_RETURN_ITEM,
|
8
|
+
internal_note: item.internal_note,
|
9
|
+
reference: data.reference,
|
10
|
+
reference_id: data.reference_id,
|
11
|
+
details: {
|
12
|
+
reference_id: item.id,
|
13
|
+
quantity: item.quantity,
|
14
|
+
},
|
15
|
+
}));
|
16
|
+
}
|
17
|
+
async function createOrderChange(service, data, returnEntry, items, sharedContext) {
|
18
|
+
return await service.createOrderChange_({
|
19
|
+
order_id: returnEntry.order_id,
|
20
|
+
return_id: returnEntry.id,
|
21
|
+
reference: "return",
|
22
|
+
reference_id: returnEntry.id,
|
23
|
+
change_type: utils_1.OrderChangeType.RETURN_RECEIVE,
|
24
|
+
description: data.description,
|
25
|
+
internal_note: data.internal_note,
|
26
|
+
created_by: data.created_by,
|
27
|
+
metadata: data.metadata,
|
28
|
+
actions: items,
|
29
|
+
}, sharedContext);
|
30
|
+
}
|
31
|
+
function updateReturnItems(returnEntry, items) {
|
32
|
+
return returnEntry.items
|
33
|
+
.map((item) => {
|
34
|
+
const data = items.find((i) => i.details.reference_id === item.item_id);
|
35
|
+
if (!data)
|
36
|
+
return;
|
37
|
+
const receivedQuantity = utils_1.MathBN.add(item.received_quantity || 0, data.details.quantity);
|
38
|
+
item.received_quantity = receivedQuantity;
|
39
|
+
return {
|
40
|
+
id: item.id,
|
41
|
+
received_quantity: receivedQuantity,
|
42
|
+
};
|
43
|
+
})
|
44
|
+
.filter(Boolean);
|
45
|
+
}
|
46
|
+
function checkAllItemsReceived(returnEntry) {
|
47
|
+
return returnEntry.items.every((item) => utils_1.MathBN.eq(item.received_quantity, item.quantity));
|
48
|
+
}
|
49
|
+
function getReturnUpdateData(hasReceivedAllItems) {
|
50
|
+
return hasReceivedAllItems
|
51
|
+
? { status: utils_1.ReturnStatus.RECEIVED, received_at: new Date() }
|
52
|
+
: { status: utils_1.ReturnStatus.PARTIALLY_RECEIVED };
|
53
|
+
}
|
54
|
+
async function receiveReturn(data, sharedContext) {
|
55
|
+
const returnEntry = await this.retrieveReturn(data.return_id, {
|
56
|
+
select: ["id", "order_id"],
|
57
|
+
relations: ["items"],
|
58
|
+
}, sharedContext);
|
59
|
+
const items = createReturnItems(data);
|
60
|
+
const change = await createOrderChange(this, data, returnEntry, items, sharedContext);
|
61
|
+
await this.confirmOrderChange(change[0].id, sharedContext);
|
62
|
+
const retItemsToUpdate = updateReturnItems(returnEntry, items);
|
63
|
+
const hasReceivedAllItems = checkAllItemsReceived(returnEntry);
|
64
|
+
const retData = getReturnUpdateData(hasReceivedAllItems);
|
65
|
+
const [returnRef] = await (0, utils_1.promiseAll)([
|
66
|
+
this.updateReturns({ selector: { id: returnEntry.id }, data: retData }, sharedContext),
|
67
|
+
this.updateReturnItems(retItemsToUpdate, sharedContext),
|
68
|
+
]);
|
69
|
+
return returnRef;
|
70
|
+
}
|
71
|
+
//# sourceMappingURL=receive-return.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"receive-return.js","sourceRoot":"","sources":["../../../src/services/actions/receive-return.ts"],"names":[],"mappings":";;AA8EA,sCAsCC;AAnHD,qDAMkC;AAElC,SAAS,iBAAiB,CAAC,IAAI;IAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC/B,MAAM,EAAE,wBAAgB,CAAC,mBAAmB;QAC5C,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,OAAO,EAAE;YACP,YAAY,EAAE,I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CAChB,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EACnD,aAAa,CACd;QACD,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,aAAa,CAAC;KACxD,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"register-delivery.d.ts","sourceRoot":"","sources":["../../../src/services/actions/register-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAG/D,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,UAAU,CAAC,wBAAwB,EACzC,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.registerDelivery = registerDelivery;
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
|
+
async function registerDelivery(data, sharedContext) {
|
6
|
+
const items = data.items?.map((item) => {
|
7
|
+
return {
|
8
|
+
action: utils_1.ChangeActionType.DELIVER_ITEM,
|
9
|
+
internal_note: item.internal_note,
|
10
|
+
reference: data.reference,
|
11
|
+
reference_id: data.reference_id,
|
12
|
+
details: {
|
13
|
+
reference_id: item.id,
|
14
|
+
quantity: item.quantity,
|
15
|
+
metadata: item.metadata,
|
16
|
+
},
|
17
|
+
};
|
18
|
+
});
|
19
|
+
const change = await this.createOrderChange_({
|
20
|
+
order_id: data.order_id,
|
21
|
+
description: data.description,
|
22
|
+
internal_note: data.internal_note,
|
23
|
+
created_by: data.created_by,
|
24
|
+
metadata: data.metadata,
|
25
|
+
actions: items,
|
26
|
+
}, sharedContext);
|
27
|
+
await this.confirmOrderChange(change[0].id, sharedContext);
|
28
|
+
}
|
29
|
+
//# sourceMappingURL=register-delivery.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"register-delivery.js","sourceRoot":"","sources":["../../../src/services/actions/register-delivery.ts"],"names":[],"mappings":";;AAGA,4CAgCC;AAlCD,qDAA4D;AAErD,KAAK,UAAU,gBAAgB,CAEpC,IAAyC,EACzC,aAAuB;IAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACrC,OAAO;YACL,MAAM,EAAE,wBAAgB,CAAC,YAAY;YACrC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI,CAAC,EAAE;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB;SACF,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAC1C;QACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO,EAAE,KAAK;KACf,EACD,aAAa,CACd,CAAA;IAED,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;AAC5D,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"register-fulfillment.d.ts","sourceRoot":"","sources":["../../../src/services/actions/register-fulfillment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAG/D,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,UAAU,CAAC,2BAA2B,EAC5C,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.registerFulfillment = registerFulfillment;
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
|
+
async function registerFulfillment(data, sharedContext) {
|
6
|
+
const items = data.items.map((item) => {
|
7
|
+
return {
|
8
|
+
action: utils_1.ChangeActionType.FULFILL_ITEM,
|
9
|
+
internal_note: item.internal_note,
|
10
|
+
reference: data.reference,
|
11
|
+
reference_id: data.reference_id,
|
12
|
+
details: {
|
13
|
+
reference_id: item.id,
|
14
|
+
quantity: item.quantity,
|
15
|
+
metadata: item.metadata,
|
16
|
+
},
|
17
|
+
};
|
18
|
+
});
|
19
|
+
const change = await this.createOrderChange_({
|
20
|
+
order_id: data.order_id,
|
21
|
+
description: data.description,
|
22
|
+
internal_note: data.internal_note,
|
23
|
+
created_by: data.created_by,
|
24
|
+
metadata: data.metadata,
|
25
|
+
actions: items,
|
26
|
+
}, sharedContext);
|
27
|
+
await this.confirmOrderChange(change[0].id, sharedContext);
|
28
|
+
}
|
29
|
+
//# sourceMappingURL=register-fulfillment.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"register-fulfillment.js","sourceRoot":"","sources":["../../../src/services/actions/register-fulfillment.ts"],"names":[],"mappings":";;AAGA,kDAgCC;AAlCD,qDAA4D;AAErD,KAAK,UAAU,mBAAmB,CAEvC,IAA4C,EAC5C,aAAuB;IAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,OAAO;YACL,MAAM,EAAE,wBAAgB,CAAC,YAAY;YACrC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI,CAAC,EAAE;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB;SACF,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAC1C;QACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO,EAAE,KAAK;KACf,EACD,aAAa,CACd,CAAA;IAED,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;AAC5D,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"register-shipment.d.ts","sourceRoot":"","sources":["../../../src/services/actions/register-shipment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EACX,MAAM,2BAA2B,CAAA;AAGlC,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,UAAU,CAAC,wBAAwB,EACzC,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,IAAI,CAAC,CAsCf"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.registerShipment = registerShipment;
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
|
+
async function registerShipment(data, sharedContext) {
|
6
|
+
let shippingMethodId;
|
7
|
+
const actions = data.items.map((item) => {
|
8
|
+
return {
|
9
|
+
action: utils_1.ChangeActionType.SHIP_ITEM,
|
10
|
+
internal_note: item.internal_note,
|
11
|
+
reference: data.reference,
|
12
|
+
reference_id: data.reference_id,
|
13
|
+
details: {
|
14
|
+
reference_id: item.id,
|
15
|
+
quantity: item.quantity,
|
16
|
+
metadata: item.metadata,
|
17
|
+
},
|
18
|
+
};
|
19
|
+
});
|
20
|
+
if (shippingMethodId) {
|
21
|
+
actions.push({
|
22
|
+
action: utils_1.ChangeActionType.SHIPPING_ADD,
|
23
|
+
reference: data.reference,
|
24
|
+
reference_id: shippingMethodId,
|
25
|
+
});
|
26
|
+
}
|
27
|
+
const change = await this.createOrderChange_({
|
28
|
+
order_id: data.order_id,
|
29
|
+
description: data.description,
|
30
|
+
internal_note: data.internal_note,
|
31
|
+
created_by: data.created_by,
|
32
|
+
metadata: data.metadata,
|
33
|
+
actions,
|
34
|
+
}, sharedContext);
|
35
|
+
await this.confirmOrderChange(change[0].id, sharedContext);
|
36
|
+
}
|
37
|
+
//# sourceMappingURL=register-shipment.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"register-shipment.js","sourceRoot":"","sources":["../../../src/services/actions/register-shipment.ts"],"names":[],"mappings":";;AAOA,4CA0CC;AA5CD,qDAA4D;AAErD,KAAK,UAAU,gBAAgB,CAEpC,IAAyC,EACzC,aAAuB;IAEvB,IAAI,gBAAgB,CAAA;IAEpB,MAAM,OAAO,GAAiC,IAAI,CAAC,KAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACrE,OAAO;YACL,MAAM,EAAE,wBAAgB,CAAC,SAAS;YAClC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI,CAAC,EAAE;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB;SACF,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC;YACX,MAAM,EAAE,wBAAgB,CAAC,YAAY;YACrC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,gBAAgB;SAC/B,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAC1C;QACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO;KACR,EACD,aAAa,CACd,CAAA;IAED,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;AAC5D,CAAC"}
|
package/dist/services/index.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/services/index.js
CHANGED
@@ -3,9 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.OrderService = exports.OrderModuleService =
|
7
|
-
var order_change_service_1 = require("./order-change-service");
|
8
|
-
Object.defineProperty(exports, "OrderChangeService", { enumerable: true, get: function () { return __importDefault(order_change_service_1).default; } });
|
6
|
+
exports.OrderService = exports.OrderModuleService = void 0;
|
9
7
|
var order_module_service_1 = require("./order-module-service");
|
10
8
|
Object.defineProperty(exports, "OrderModuleService", { enumerable: true, get: function () { return __importDefault(order_module_service_1).default; } });
|
11
9
|
var order_service_1 = require("./order-service");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAsE;AAA7D,2IAAA,OAAO,OAAsB;AACtC
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAsE;AAA7D,2IAAA,OAAO,OAAsB;AACtC,iDAAyD;AAAhD,8HAAA,OAAO,OAAgB"}
|