fix(SPG-711) Internal server error sering sekali ketika confirm status draft ke status pending
parent
e8deba2882
commit
0648eeffee
|
@ -16,6 +16,7 @@ export async function sendEmail(receivers, subject) {
|
||||||
let templateName = 'payment-confirmation-bank';
|
let templateName = 'payment-confirmation-bank';
|
||||||
|
|
||||||
for (const receiver of receivers) {
|
for (const receiver of receivers) {
|
||||||
|
try {
|
||||||
if (receiver.payment_type == TransactionPaymentType.MIDTRANS)
|
if (receiver.payment_type == TransactionPaymentType.MIDTRANS)
|
||||||
templateName = 'payment-confirmation-midtrans';
|
templateName = 'payment-confirmation-midtrans';
|
||||||
|
|
||||||
|
@ -41,10 +42,13 @@ export async function sendEmail(receivers, subject) {
|
||||||
|
|
||||||
smtpTransport.sendMail(emailContext, function (err, data) {
|
smtpTransport.sendMail(emailContext, function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(`Error occurs on send to ${receiver.email}`);
|
console.log(err, `Error occurs on send to ${ receiver.email }`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`Email sent to ${ receiver.email }`);
|
console.log(`Email sent to ${ receiver.email }`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error, `Error occurs on send to ${ receiver.email }`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue