Added logs
This commit is contained in:
parent
f156c1936c
commit
07bb778244
@ -524,6 +524,7 @@ export const createCashfreeLink = onRequest({
|
|||||||
const clientId = process.env.CASHFREE_CLIENT_ID;
|
const clientId = process.env.CASHFREE_CLIENT_ID;
|
||||||
const clientSecret = process.env.CASHFREE_CLIENT_SECRET;
|
const clientSecret = process.env.CASHFREE_CLIENT_SECRET;
|
||||||
let apiUrl = process.env.CASHFREE_LINK_URL;
|
let apiUrl = process.env.CASHFREE_LINK_URL;
|
||||||
|
console.log(`API URL: ${apiUrl}`);
|
||||||
|
|
||||||
if (!clientId || !clientSecret) {
|
if (!clientId || !clientSecret) {
|
||||||
logger.error('Cashfree credentials not configured');
|
logger.error('Cashfree credentials not configured');
|
||||||
@ -536,42 +537,28 @@ export const createCashfreeLink = onRequest({
|
|||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
'x-client-id': `${clientId}`,
|
||||||
|
'x-client-secret': `${clientSecret}`,
|
||||||
'x-api-version': '2025-01-01',
|
'x-api-version': '2025-01-01',
|
||||||
'x-client-id': `${process.env.CASHFREE_CLIENT_ID}`,
|
|
||||||
'x-client-secret': `${process.env.CASHFREE_CLIENT_SECRET}`,
|
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: `{
|
body: `{
|
||||||
"customer_details": {
|
|
||||||
"customer_email": "${customerEmail}",
|
|
||||||
"customer_name": "${customerName}",
|
|
||||||
"customer_phone": "${customerPhone}"
|
|
||||||
},
|
|
||||||
"link_amount": ${amount},
|
|
||||||
"link_auto_reminders": true,
|
|
||||||
"link_currency": "INR",
|
|
||||||
"link_expiry_time": "${expirationString}",
|
|
||||||
"link_id": "${linkId}",
|
"link_id": "${linkId}",
|
||||||
"link_meta": {
|
"link_amount": ${amount},
|
||||||
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
|
"link_currency": "INR",
|
||||||
"return_url": "https://www.cashfree.com/devstudio/thankyou",
|
|
||||||
"upi_intent": false
|
|
||||||
},
|
|
||||||
"link_notes": {
|
|
||||||
"userId": "${userId}",
|
|
||||||
"gymId": "${gymId}",
|
|
||||||
"orderId": "${orderId}",
|
|
||||||
"requestUserId": "${uid}"
|
|
||||||
},
|
|
||||||
"link_notify": {
|
|
||||||
"send_email": true,
|
|
||||||
"send_sms": true
|
|
||||||
},
|
|
||||||
"link_partial_payments": false,
|
|
||||||
"link_purpose": "${productInfo}",
|
"link_purpose": "${productInfo}",
|
||||||
"order_splits": []
|
"customer_details": {
|
||||||
|
"customer_phone": "${customerPhone}",
|
||||||
|
"customer_email": "${customerEmail}",
|
||||||
|
"customer_name": "${customerName}"},
|
||||||
|
"link_partial_payments": false,
|
||||||
|
"link_notify": {
|
||||||
|
"send_sms": true,
|
||||||
|
"send_email": true
|
||||||
|
}
|
||||||
}`
|
}`
|
||||||
};
|
};
|
||||||
|
console.log(`Options ${JSON.stringify(options)}`);
|
||||||
const cashfreeResponse = await axios.post(apiUrl!, options);
|
const cashfreeResponse = await axios.post(apiUrl!, options);
|
||||||
try {
|
try {
|
||||||
await admin.firestore().collection('payment_links').doc(orderId).set({
|
await admin.firestore().collection('payment_links').doc(orderId).set({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user