mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
27 lines
865 B
TypeScript
27 lines
865 B
TypeScript
import Container from 'typedi';
|
|
import SubscriptionService from '@/services/Subscription/Subscription';
|
|
|
|
export default class MailNotificationTrialEnd {
|
|
/**
|
|
*
|
|
* @param {Job} job -
|
|
*/
|
|
handler(job) {
|
|
const { tenantId, phoneNumber, remainingDays } = job.attrs.data;
|
|
|
|
const subscriptionService = Container.get(SubscriptionService);
|
|
const Logger = Container.get('logger');
|
|
|
|
Logger.debug(`Send mail notification subscription end soon - started: ${job.attrs.data}`);
|
|
|
|
try {
|
|
subscriptionService.mailMessages.sendRemainingTrialPeriod(
|
|
phoneNumber, remainingDays,
|
|
);
|
|
Logger.debug(`Send mail notification subscription end soon - finished: ${job.attrs.data}`);
|
|
} catch(error) {
|
|
Logger.error(`Send mail notification subscription end soon - failed: ${job.attrs.data}, error: ${e}`);
|
|
done(e);
|
|
}
|
|
}
|
|
} |