fix merge conflicts
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
"dependencies": {
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
||||
"@babel/plugin-proposal-decorators": "^7.12.1",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.12.1",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.14.2",
|
||||
"@babel/plugin-transform-classes": "^7.12.1",
|
||||
"@babel/plugin-transform-instanceof": "^7.12.1",
|
||||
"@babel/plugin-transform-runtime": "^7.12.1",
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"presets": [["babel-preset-medusa-package"]]
|
||||
}
|
||||
3
packages/medusa-dev-cli/.babelrc.js
Normal file
3
packages/medusa-dev-cli/.babelrc.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: [["babel-preset-medusa-package"]],
|
||||
};
|
||||
@@ -15,17 +15,8 @@
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/node": "^7.7.4",
|
||||
"@babel/plugin-proposal-class-properties": "^7.7.4",
|
||||
"@babel/plugin-proposal-decorators": "^7.12.1",
|
||||
"@babel/plugin-transform-classes": "^7.9.5",
|
||||
"@babel/plugin-transform-instanceof": "^7.8.3",
|
||||
"@babel/plugin-transform-runtime": "^7.7.6",
|
||||
"@babel/preset-env": "^7.7.5",
|
||||
"@babel/preset-typescript": "^7.12.7",
|
||||
"@babel/register": "^7.7.4",
|
||||
"@babel/runtime": "^7.7.6",
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/preset-typescript": "^7.13.0",
|
||||
"babel-preset-medusa-package": "^1.1.3",
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
@@ -87,4 +78,4 @@
|
||||
"winston": "^3.2.1"
|
||||
},
|
||||
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,9 @@ import { defaultRelations, defaultFields } from "./"
|
||||
* price:
|
||||
* description: The price to charge for the Shipping Method
|
||||
* type: integer
|
||||
* shipping_address:
|
||||
* type: object
|
||||
* description: "An optional shipping address to send the claim to. Defaults to the parent order's shipping address"
|
||||
* refund_amount:
|
||||
* description: The amount to refund the Customer when the Claim type is `refund`.
|
||||
* type: integer
|
||||
@@ -151,6 +154,7 @@ export default async (req, res) => {
|
||||
refund_amount: Validator.number()
|
||||
.integer()
|
||||
.optional(),
|
||||
shipping_address: Validator.object().optional(),
|
||||
metadata: Validator.object().optional(),
|
||||
})
|
||||
|
||||
@@ -203,6 +207,7 @@ export default async (req, res) => {
|
||||
idempotency_key: idempotencyKey.idempotency_key,
|
||||
order,
|
||||
type: value.type,
|
||||
shipping_address: value.shipping_address,
|
||||
claim_items: value.claim_items,
|
||||
return_shipping: value.return_shipping,
|
||||
additional_items: value.additional_items,
|
||||
|
||||
@@ -16,6 +16,7 @@ class ClaimService extends BaseService {
|
||||
constructor({
|
||||
manager,
|
||||
claimRepository,
|
||||
addressRepository,
|
||||
fulfillmentProviderService,
|
||||
fulfillmentService,
|
||||
lineItemService,
|
||||
@@ -35,6 +36,9 @@ class ClaimService extends BaseService {
|
||||
/** @private @constant {ClaimRepository} */
|
||||
this.claimRepository_ = claimRepository
|
||||
|
||||
/** @private @constant {AddressRepository} */
|
||||
this.addressRepo_ = addressRepository
|
||||
|
||||
/** @private @constant {FulfillmentProviderService} */
|
||||
this.fulfillmentProviderService_ = fulfillmentProviderService
|
||||
|
||||
@@ -74,6 +78,7 @@ class ClaimService extends BaseService {
|
||||
const cloned = new ClaimService({
|
||||
manager,
|
||||
claimRepository: this.claimRepository_,
|
||||
addressRepository: this.addressRepo_,
|
||||
fulfillmentProviderService: this.fulfillmentProviderService_,
|
||||
fulfillmentService: this.fulfillmentService_,
|
||||
paymentProviderService: this.paymentProviderService_,
|
||||
@@ -150,6 +155,11 @@ class ClaimService extends BaseService {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Claim on an Order. Claims consists of items that are claimed and
|
||||
* optionally items to be sent as replacement for the claimed items. The
|
||||
* shipping address that the new items will be shipped to
|
||||
*/
|
||||
create(data) {
|
||||
return this.atomicPhase_(async manager => {
|
||||
const claimRepo = manager.getCustomRepository(this.claimRepository_)
|
||||
@@ -162,9 +172,19 @@ class ClaimService extends BaseService {
|
||||
additional_items,
|
||||
shipping_methods,
|
||||
refund_amount,
|
||||
shipping_address,
|
||||
shipping_address_id,
|
||||
...rest
|
||||
} = data
|
||||
|
||||
let addressId = shipping_address_id || order.shipping_address_id
|
||||
if (shipping_address) {
|
||||
const addressRepo = manager.getCustomRepository(this.addressRepo_)
|
||||
const created = addressRepo.create(shipping_address)
|
||||
const saved = await addressRepo.save(created)
|
||||
addressId = saved.id
|
||||
}
|
||||
|
||||
if (type !== "refund" && type !== "replace") {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
@@ -214,7 +234,7 @@ class ClaimService extends BaseService {
|
||||
)
|
||||
|
||||
const created = claimRepo.create({
|
||||
shipping_address_id: order.shipping_address_id,
|
||||
shipping_address_id: addressId,
|
||||
payment_status: type === "refund" ? "not_refunded" : "na",
|
||||
...rest,
|
||||
refund_amount: toRefund,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user