fix: enable gift-card creation without order_id (#195)
This commit is contained in:
@@ -381,6 +381,10 @@ class SendGridService extends NotificationService {
|
|||||||
relations: ["region", "order"],
|
relations: ["region", "order"],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!giftCard.order) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const taxRate = giftCard.region.tax_rate / 100
|
const taxRate = giftCard.region.tax_rate / 100
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -108,13 +108,6 @@ class GiftCardService extends BaseService {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!giftCard.order_id) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.NOT_FOUND,
|
|
||||||
`Gift card is missing order_id`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Will throw if region does not exist
|
// Will throw if region does not exist
|
||||||
const region = await this.regionService_.retrieve(giftCard.region_id)
|
const region = await this.regionService_.retrieve(giftCard.region_id)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user