diff --git a/firebase.json b/firebase.json index 608886c..21d0f5f 100644 --- a/firebase.json +++ b/firebase.json @@ -8,6 +8,7 @@ "source": "functions", "codebase": "default", "timeoutSeconds": 540, + "memory": "1GiB", "ignore": [ "node_modules", ".git", diff --git a/functions/package-lock.json b/functions/package-lock.json index e5b23b4..149bfc8 100644 --- a/functions/package-lock.json +++ b/functions/package-lock.json @@ -13,6 +13,7 @@ "aws-sdk": "^2.1692.0", "axios": "^1.9.0", "cors": "^2.8.5", + "date-fns": "^4.1.0", "firebase-admin": "^12.6.0", "firebase-functions": "^6.0.1", "form-data": "^4.0.1", @@ -3805,6 +3806,15 @@ "utrie": "^1.0.2" } }, + "node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/dayjs": { "version": "1.11.13", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", diff --git a/functions/package.json b/functions/package.json index b9f1c89..0e77a8f 100644 --- a/functions/package.json +++ b/functions/package.json @@ -20,6 +20,7 @@ "aws-sdk": "^2.1692.0", "axios": "^1.9.0", "cors": "^2.8.5", + "date-fns": "^4.1.0", "firebase-admin": "^12.6.0", "firebase-functions": "^6.0.1", "form-data": "^4.0.1", diff --git a/functions/src/index.ts b/functions/src/index.ts index 19fa4e0..660ddc7 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -1,3 +1,14 @@ +import { setGlobalOptions } from "firebase-functions/v2"; + +setGlobalOptions({ + region: "#{SERVICES_RGN}#", + memory: "1GiB", + timeoutSeconds: 540, + minInstances: 0, + maxInstances: 10, + concurrency: 80 +}); + export * from './shared/config'; export { sendEmailMessage, sendEmailWithAttachment, sendEmailSES } from './email'; export { sendSMSMessage } from './sms'; diff --git a/functions/src/payments/phonepe/invoice/invoiceService.ts b/functions/src/payments/phonepe/invoice/invoiceService.ts index 95ffa7d..8c3d491 100644 --- a/functions/src/payments/phonepe/invoice/invoiceService.ts +++ b/functions/src/payments/phonepe/invoice/invoiceService.ts @@ -5,7 +5,7 @@ import * as path from 'path'; import { format } from 'date-fns'; import { sendEmailWithAttachmentUtil } from "../../../utils/emailService"; import { jsPDF } from "jspdf"; -import 'jspdf-autotable'; +import autoTable from 'jspdf-autotable'; const admin = getAdmin(); const logger = getLogger(); @@ -83,7 +83,7 @@ export class InvoiceService { doc.text(`Phone: ${data.phoneNumber}`, 20, 80); doc.text(`Email: ${data.email}`, 20, 90); - (doc as any).autoTable({ + autoTable(doc,{ startY: 110, head: [['No.', 'Description', 'HSN/SAC', 'Amount (INR)']], body: [ diff --git a/functions/src/payments/phonepe/webhook.ts b/functions/src/payments/phonepe/webhook.ts index 90a0a43..42aa29f 100644 --- a/functions/src/payments/phonepe/webhook.ts +++ b/functions/src/payments/phonepe/webhook.ts @@ -154,7 +154,7 @@ export const phonePeWebhook = onRequest({ logger.info(`Fetching user data for userId: ${userId}`); const userDoc = await admin.firestore() - .collection('users') + .collection('client_profiles') .doc(userId) .get(); if (userDoc.exists) { diff --git a/package.json b/package.json index 073e12e..da0eb6c 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,7 @@ { "dependencies": { "@types/busboy": "^1.5.4", - "@types/nodemailer": "^6.4.17", - "@types/pdfkit": "^0.13.9", "busboy": "^1.6.0", - "date-fns": "^4.1.0", - "nodemailer": "^7.0.3", - "pdfkit": "^0.17.1" + "date-fns": "^4.1.0" } }