import {BaseTask} from '@birbal/task-utilities/dist/base-task'; import { EEmailTasks } from './common'; import { ICommRequest, ITxnCommInfo } from "@birbal/comm-common-utilities/dist/comm" import * as Admin from 'firebase-admin'; export class SendTxnEmail extends BaseTask { status?: boolean; constructor( private email: string, private subject: string, private html: string ) { super(EEmailTasks.SEND_TXN_EMAIL); } async execute() { try { this.onStart(); // Begin let otpRequest: ICommRequest = { commType: 'txn' ,emailId: this.email , additionalInfo: { html: this.html, subject: this.subject } } await Admin.database().ref(`/comms`).push(otpRequest); this.status = true; // End this.onSuccess(); } catch (e) { this.onFailure(e); this.status = false; throw e; } } }