Robustness

This commit is contained in:
Sebastian Rindom
2020-07-14 17:23:43 +02:00
parent 44c7177e43
commit 312e405588
21 changed files with 152 additions and 74 deletions
@@ -30,7 +30,7 @@ class SendGridService extends BaseService {
* correlate with the structure specificed in the dynamic template
* @returns {Promise} result of the send operation
*/
async transactionalEmail(event, order) {
async transactionalEmail(event, data) {
let templateId
switch (event) {
case "order.placed":
@@ -54,13 +54,12 @@ class SendGridService extends BaseService {
default:
return
}
try {
return SendGrid.send({
template_id: templateId,
from: this.options_.from,
to: order.email,
dynamic_template_data: order,
to: data.email,
dynamic_template_data: data,
})
} catch (error) {
throw error