mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat: Payment system with voucher cards.
feat: Design with inversion dependency injection architecture. feat: Prettier http middleware. feat: Re-write items categories with preferred accounts.
This commit is contained in:
@@ -1,17 +1,25 @@
|
||||
import { Container } from 'typedi';
|
||||
import LoggerInstance from '@/services/Logger';
|
||||
import agendaFactory from '@/loaders/agenda';
|
||||
import SmsClientLoader from '@/loaders/smsClient';
|
||||
|
||||
export default ({ mongoConnection, knex }) => {
|
||||
try {;
|
||||
try {
|
||||
const agendaInstance = agendaFactory({ mongoConnection });
|
||||
const smsClientInstance = SmsClientLoader();
|
||||
|
||||
Container.set('agenda', agendaInstance);
|
||||
Container.set('logger', LoggerInstance)
|
||||
Container.set('knex', knex);
|
||||
|
||||
LoggerInstance.info('Agenda has been injected into container');
|
||||
|
||||
Container.set('logger', LoggerInstance)
|
||||
LoggerInstance.info('Logger instance has been injected into container');
|
||||
|
||||
Container.set('knex', knex);
|
||||
LoggerInstance.info('Knex instance has been injected into container');
|
||||
|
||||
Container.set('SMSClient', smsClientInstance);
|
||||
LoggerInstance.info('SMS client has been injected into container');
|
||||
|
||||
return { agenda: agendaInstance };
|
||||
} catch (e) {
|
||||
LoggerInstance.error('Error on dependency injector loader: %o', e);
|
||||
|
||||
@@ -2,6 +2,8 @@ import Agenda from 'agenda';
|
||||
import WelcomeEmailJob from '@/Jobs/welcomeEmail';
|
||||
import ComputeItemCost from '@/Jobs/ComputeItemCost';
|
||||
import RewriteInvoicesJournalEntries from '@/jobs/writeInvoicesJEntries';
|
||||
import SendVoucherViaPhoneJob from '@/jobs/SendVoucherPhone';
|
||||
import SendVoucherViaEmailJob from '@/jobs/SendVoucherEmail';
|
||||
|
||||
export default ({ agenda }: { agenda: Agenda }) => {
|
||||
agenda.define(
|
||||
@@ -19,5 +21,15 @@ export default ({ agenda }: { agenda: Agenda }) => {
|
||||
{ priority: 'normal', concurrency: 1, },
|
||||
new RewriteInvoicesJournalEntries().handler,
|
||||
);
|
||||
agenda.define(
|
||||
'send-voucher-via-phone',
|
||||
{ priority: 'high', concurrency: 1, },
|
||||
new SendVoucherViaPhoneJob().handler,
|
||||
);
|
||||
agenda.define(
|
||||
'send-voucher-via-email',
|
||||
{ priority: 'high', concurrency: 1, },
|
||||
new SendVoucherViaEmailJob().handler,
|
||||
)
|
||||
agenda.start();
|
||||
};
|
||||
|
||||
9
server/src/loaders/smsClient.ts
Normal file
9
server/src/loaders/smsClient.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import SMSClient from '@/services/SMSClient';
|
||||
import EasySMSGateway from '@/services/SMSClient/EasySMSClient';
|
||||
|
||||
export default () => {
|
||||
const easySmsGateway = new EasySMSGateway();
|
||||
const smsClient = new SMSClient(easySmsGateway);
|
||||
|
||||
return smsClient;
|
||||
};
|
||||
Reference in New Issue
Block a user