phonepe #63
@ -54,7 +54,7 @@ export class InvoiceService {
|
|||||||
|
|
||||||
doc.setFontSize(20);
|
doc.setFontSize(20);
|
||||||
doc.setFont('helvetica', 'bold');
|
doc.setFont('helvetica', 'bold');
|
||||||
doc.text(data.businessName, 20, 20);
|
doc.text(data.businessName, 13, 20);
|
||||||
|
|
||||||
doc.setFontSize(12);
|
doc.setFontSize(12);
|
||||||
doc.setFont('helvetica', 'normal');
|
doc.setFont('helvetica', 'normal');
|
||||||
@ -66,10 +66,10 @@ export class InvoiceService {
|
|||||||
|
|
||||||
if (addressLines.length <= 2) {
|
if (addressLines.length <= 2) {
|
||||||
for (let i = 0; i < addressLines.length; i++) {
|
for (let i = 0; i < addressLines.length; i++) {
|
||||||
doc.text(addressLines[i], 20, 30 + (i * lineHeight));
|
doc.text(addressLines[i], 13, 30 + (i * lineHeight));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
doc.text(addressLines[0], 20, 30);
|
doc.text(addressLines[0], 13, 30);
|
||||||
|
|
||||||
let secondLine = addressLines[1];
|
let secondLine = addressLines[1];
|
||||||
if (secondLine.length > 3) {
|
if (secondLine.length > 3) {
|
||||||
@ -77,7 +77,7 @@ export class InvoiceService {
|
|||||||
} else {
|
} else {
|
||||||
secondLine += '...';
|
secondLine += '...';
|
||||||
}
|
}
|
||||||
doc.text(secondLine, 20, 35);
|
doc.text(secondLine, 13, 35);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gstYPosition = 40;
|
const gstYPosition = 40;
|
||||||
@ -97,10 +97,10 @@ export class InvoiceService {
|
|||||||
doc.line(20, 45, 190, 45);
|
doc.line(20, 45, 190, 45);
|
||||||
|
|
||||||
doc.setFontSize(12);
|
doc.setFontSize(12);
|
||||||
const receiptToBoxX = 15;
|
const receiptToBoxX = 13;
|
||||||
const receiptToBoxY = 55;
|
const receiptToBoxY = 55;
|
||||||
const receiptToBoxWidth = 175;
|
const receiptToBoxWidth = 140;
|
||||||
const receiptToBoxHeight = 45;
|
const receiptToBoxHeight = 40;
|
||||||
|
|
||||||
doc.setDrawColor(0, 0, 0);
|
doc.setDrawColor(0, 0, 0);
|
||||||
doc.setLineWidth(0.5);
|
doc.setLineWidth(0.5);
|
||||||
@ -166,12 +166,12 @@ export class InvoiceService {
|
|||||||
|
|
||||||
const paymentY = hasGst ? finalY + 50 : finalY + 20;
|
const paymentY = hasGst ? finalY + 50 : finalY + 20;
|
||||||
|
|
||||||
doc.line(20, 45, 190, 45);
|
doc.line(13, 45, 190, 45);
|
||||||
|
|
||||||
const boxX = 15;
|
const boxX = 13;
|
||||||
const boxY = paymentY - 5;
|
const boxY = paymentY - 5;
|
||||||
const boxWidth = 175;
|
const boxWidth = 140;
|
||||||
const boxHeight = 45;
|
const boxHeight = 40;
|
||||||
|
|
||||||
doc.setDrawColor(0, 0, 0);
|
doc.setDrawColor(0, 0, 0);
|
||||||
doc.setLineWidth(0.5);
|
doc.setLineWidth(0.5);
|
||||||
@ -181,8 +181,8 @@ export class InvoiceService {
|
|||||||
doc.text('Payment Information:', 20, paymentY);
|
doc.text('Payment Information:', 20, paymentY);
|
||||||
|
|
||||||
doc.setFont('helvetica', 'normal');
|
doc.setFont('helvetica', 'normal');
|
||||||
doc.text(`Transaction ID: ${data.transactionId}`, 20, paymentY + 10);
|
doc.text(`Transaction ID: ${data.transactionId}`, 18, paymentY + 10);
|
||||||
doc.text(`Payment Method: ${data.paymentMethod}`, 20, paymentY + 20);
|
doc.text(`Payment Method: ${data.paymentMethod}`, 18, paymentY + 20);
|
||||||
doc.text(`Payment Date: ${formattedDate}`, 20, paymentY + 30);
|
doc.text(`Payment Date: ${formattedDate}`, 20, paymentY + 30);
|
||||||
|
|
||||||
doc.setFontSize(12);
|
doc.setFontSize(12);
|
||||||
|
|||||||
@ -154,7 +154,7 @@ export const phonePeWebhook = onRequest({
|
|||||||
|
|
||||||
logger.info(`Fetching user data for userId: ${userId}`);
|
logger.info(`Fetching user data for userId: ${userId}`);
|
||||||
const userDoc = await admin.firestore()
|
const userDoc = await admin.firestore()
|
||||||
.collection('client_profiles')
|
.collection('users')
|
||||||
.doc(userId)
|
.doc(userId)
|
||||||
.get();
|
.get();
|
||||||
if (userDoc.exists) {
|
if (userDoc.exists) {
|
||||||
@ -245,7 +245,7 @@ export const phonePeWebhook = onRequest({
|
|||||||
customerName: userData?.displayName || `${membershipData?.fields?.['first-name'] || ''} ${membershipData?.fields?.['last-name'] || ''}`.trim(),
|
customerName: userData?.displayName || `${membershipData?.fields?.['first-name'] || ''} ${membershipData?.fields?.['last-name'] || ''}`.trim(),
|
||||||
phoneNumber: membershipData?.fields?.['phone-number'] || orderData.metaInfo?.phoneNumber || '',
|
phoneNumber: membershipData?.fields?.['phone-number'] || orderData.metaInfo?.phoneNumber || '',
|
||||||
email: membershipData?.fields?.['email'] || '',
|
email: membershipData?.fields?.['email'] || '',
|
||||||
planName: orderData.metaInfo?.planName || subscriptionName || paymentType,
|
planName: orderData.metaInfo?.planName || subscriptionName,
|
||||||
amount: orderData.amount,
|
amount: orderData.amount,
|
||||||
transactionId: payload.orderId,
|
transactionId: payload.orderId,
|
||||||
paymentDate: new Date(),
|
paymentDate: new Date(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user