mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: rename voucher to license.
This commit is contained in:
22
server/src/jobs/SendLicenseEmail.ts
Normal file
22
server/src/jobs/SendLicenseEmail.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user