phonepe (#32)
Some checks failed
Deploy FitLien services to Dev / Deploy to Dev (push) Failing after 3m6s
Some checks failed
Deploy FitLien services to Dev / Deploy to Dev (push) Failing after 3m6s
Co-authored-by: AllenTJ7 <163137620+AllenTJ7@users.noreply.github.com> Reviewed-on: #32
This commit is contained in:
parent
8bb10cba8c
commit
815e15b5ae
@ -5,17 +5,10 @@ import * as path from 'path';
|
||||
import { format } from 'date-fns';
|
||||
import { sendEmailWithAttachmentUtil } from "../../../utils/emailService";
|
||||
|
||||
let pdfMake: any;
|
||||
let pdfFonts: any;
|
||||
const pdfMake = require('pdfmake/build/pdfmake');
|
||||
const pdfFonts = require('pdfmake/build/vfs_fonts');
|
||||
pdfMake.vfs = pdfFonts.pdfMake ? pdfFonts.pdfMake.vfs : pdfFonts.vfs;
|
||||
|
||||
function initPdfLibraries() {
|
||||
if (!pdfMake) {
|
||||
pdfMake = require('pdfmake/build/pdfmake');
|
||||
pdfFonts = require('pdfmake/build/vfs_fonts');
|
||||
pdfMake.vfs = pdfFonts.pdfMake ? pdfFonts.pdfMake.vfs : pdfFonts.vfs;
|
||||
}
|
||||
return pdfMake;
|
||||
}
|
||||
|
||||
const admin = getAdmin();
|
||||
const logger = getLogger();
|
||||
@ -53,7 +46,6 @@ export interface EmailOptions {
|
||||
export class InvoiceService {
|
||||
async generateInvoice(data: InvoiceData): Promise<string> {
|
||||
try {
|
||||
const pdfMake = initPdfLibraries();
|
||||
const tempFilePath = path.join(os.tmpdir(), `invoice_${data.invoiceNumber}.pdf`);
|
||||
|
||||
const hasGst = data.gstNumber && data.gstNumber.length > 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user