fix: enable gift-card creation without order_id

This commit is contained in:
Sebastian Rindom
2021-03-08 13:58:01 +01:00
parent 6a3409d239
commit 9ce935a779
2 changed files with 4 additions and 7 deletions

View File

@@ -381,6 +381,10 @@ class SendGridService extends NotificationService {
relations: ["region", "order"],
})
if (!giftCard.order) {
return
}
const taxRate = giftCard.region.tax_rate / 100
return {

View File

@@ -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
const region = await this.regionService_.retrieve(giftCard.region_id)