mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
23 lines
754 B
TypeScript
23 lines
754 B
TypeScript
import { Container } from 'typedi';
|
|
import LicenseService from '@/services/Payment/License';
|
|
|
|
export default class SendLicenseViaEmailJob {
|
|
public async handler(job, done: Function): Promise<void> {
|
|
const Logger = Container.get('logger');
|
|
const licenseService = Container.get(LicenseService);
|
|
const { email, licenseCode } = job.attrs.data;
|
|
|
|
Logger.debug(`Send license via email - started: ${job.attrs.data}`);
|
|
|
|
try {
|
|
await licenseService.mailMessages.sendMailLicense(licenseCode, email);
|
|
Logger.debug(`Send license via email - completed: ${job.attrs.data}`);
|
|
done();
|
|
} catch(e) {
|
|
console.log(e);
|
|
Logger.error(`Send license via email: ${job.attrs.data}, error: ${e}`);
|
|
done(e);
|
|
}
|
|
}
|
|
}
|