Compare commits

...

2 Commits

Author SHA1 Message Date
90a196494a Merge branch 'dev' into qa 2025-04-14 04:27:35 +05:30
7887e87200 Fixed function (#19)
Reviewed-on: #19
Co-authored-by: aswincosq <aswinbs@cosq.net>
Co-committed-by: aswincosq <aswinbs@cosq.net>
2025-04-13 22:43:31 +00:00

View File

@ -402,15 +402,14 @@ export const createCashfreeOrder = onRequest({
return; return;
} }
const isTest = true;
const hashKey = `hash_${Date.now()}_${uid.substring(0, 1)}_${orderId}`; const hashKey = `hash_${Date.now()}_${uid.substring(0, 1)}_${orderId}`;
const apiUrl = isTest
? 'https://sandbox.cashfree.com/pg/orders' let apiUrl = process.env.CASHFREE_URL;
: 'https://api.cashfree.com/pg/orders';
try { try {
const cashfreeResponse = await axios.post( const cashfreeResponse = await axios.post(
apiUrl, apiUrl!,
{ {
order_id: orderId, order_id: orderId,
hash_key: hashKey, hash_key: hashKey,
@ -506,14 +505,11 @@ export const verifyCashfreePayment = 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;
const isTest = process.env.CASHFREE_ENVIRONMENT !== 'production';
const apiUrl = isTest const apiUrl = process.env.CASHFREE_URL;
? `https://sandbox.cashfree.com/pg/orders/${orderId}`
: `https://api.cashfree.com/pg/orders/${orderId}`;
const cashfreeResponse = await axios.get( const cashfreeResponse = await axios.get(
apiUrl, apiUrl!,
{ {
headers: { headers: {
'x-api-version': '2022-09-01', 'x-api-version': '2022-09-01',