Untitled

 avatar
unknown
plain_text
5 months ago
989 B
3
Indexable
@Service()
export class EngagementInsuranceHandler {
    private log: LoggerInterface;
    constructor(
        private fulFillmentService: FulFillmentService,
        private quotesHandler: QuotesHandler
    ) {
        this.log = new Logger(__filename);
    }

    public handle(message: any): any {
        try {
            if (message) {
                this.log.info('Message type: ' + message.type);
                if (Object.values(FulfilmentStatus).includes(message.type)) {
                    this.log.info('Received fulfilment event: ' + message.type);
                    this.fulFillmentService.processEngagementFulfilmentEvent(message);
                } else {
                    this.log.info('PROCESS_QUOTES');
                    this.quotesHandler.processQuotes(message);
                }
            }
        } catch (error) {
            this.log.error(`ENGAGEMENT_INSURANCE_HANDLER_ERROR: ${JSON.stringify(error)}`);
        }
    }
}
Editor is loading...
Leave a Comment