fix: restock

This commit is contained in:
Sebastian Rindom
2021-04-09 19:31:56 +02:00
parent 7897610620
commit 237ed51307
2 changed files with 9 additions and 3 deletions
@@ -39,6 +39,7 @@ class RestockNotificationService extends BaseService {
options: this.options_,
eventBusService: this.eventBus_,
productVariantService: this.productVariantService_,
restockNotificationModel: this.restockNotificationModel_,
})
cloned.transactionManager_ = transactionManager
@@ -30,6 +30,7 @@ class SendGridService extends NotificationService {
fulfillmentService,
fulfillmentProviderService,
totalsService,
productVariantService,
},
options
) {
@@ -46,6 +47,7 @@ class SendGridService extends NotificationService {
this.swapService_ = swapService
this.fulfillmentService_ = fulfillmentService
this.totalsService_ = totalsService
this.productVariantService_ = productVariantService
SendGrid.setApiKey(options.api_key)
}
@@ -122,7 +124,10 @@ class SendGridService extends NotificationService {
case "customer.password_reset":
return this.customerPasswordResetData(eventData, attachmentGenerator)
case "restock-notification.restocked":
return await this.restockNotificationData(eventData, attachmentGenerator)
return await this.restockNotificationData(
eventData,
attachmentGenerator
)
default:
return {}
}
@@ -677,14 +682,14 @@ class SendGridService extends NotificationService {
async restockNotificationData({ variant_id, emails }) {
const variant = await this.productVariantService_.retrieve(variant_id, {
relations: ["product"]
relations: ["product"],
})
return {
product: variant.product,
variant,
variant_id,
emails
emails,
}
}