phonepe #33

Merged
allentj merged 16 commits from phonepe into dev 2025-05-20 09:04:46 +00:00
Showing only changes of commit 762e6b77e5 - Show all commits

View File

@ -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;
function initPdfLibraries() {
if (!pdfMake) {
pdfMake = require('pdfmake/build/pdfmake');
pdfFonts = require('pdfmake/build/vfs_fonts');
const pdfMake = require('pdfmake/build/pdfmake');
const 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;