Added cors createCashfreeOrder (#7)
Reviewed-on: #7 Co-authored-by: DhanshCOSQ <dhanshas@cosq.net> Co-committed-by: DhanshCOSQ <dhanshas@cosq.net>
This commit is contained in:
parent
8d20162922
commit
f6facf40f8
1
functions/package-lock.json
generated
1
functions/package-lock.json
generated
@ -10,6 +10,7 @@
|
||||
"dependencies": {
|
||||
"@types/node-fetch": "^2.6.12",
|
||||
"axios": "^1.8.4",
|
||||
"cors": "^2.8.5",
|
||||
"firebase-admin": "^12.6.0",
|
||||
"firebase-functions": "^6.0.1",
|
||||
"form-data": "^4.0.1",
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
"dependencies": {
|
||||
"@types/node-fetch": "^2.6.12",
|
||||
"axios": "^1.8.4",
|
||||
"cors": "^2.8.5",
|
||||
"firebase-admin": "^12.6.0",
|
||||
"firebase-functions": "^6.0.1",
|
||||
"form-data": "^4.0.1",
|
||||
|
||||
@ -8,6 +8,7 @@ import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import * as https from 'https';
|
||||
import cors from 'cors';
|
||||
import axios from "axios";
|
||||
import { getStorage } from 'firebase-admin/storage';
|
||||
const formData = require('form-data');
|
||||
@ -19,6 +20,9 @@ const twilio = require('twilio');
|
||||
if (!admin.apps.length) {
|
||||
admin.initializeApp();
|
||||
}
|
||||
|
||||
const corsHandler = cors({ origin: true });
|
||||
|
||||
export const sendEmailWithAttachment = onRequest({
|
||||
region: '#{SERVICES_RGN}#'
|
||||
}, async (request: Request, response: express.Response) => {
|
||||
@ -245,6 +249,8 @@ export const notifyInvitation = onDocumentCreated({
|
||||
export const createCashfreeOrder = onRequest({
|
||||
region: '#{SERVICES_RGN}#'
|
||||
}, async (request: Request, response: express.Response) => {
|
||||
|
||||
return corsHandler(request, response, async () => {
|
||||
try {
|
||||
const authHeader = request.headers.authorization;
|
||||
if (!authHeader || !authHeader.startsWith('Bearer ')) {
|
||||
@ -331,6 +337,7 @@ export const createCashfreeOrder = onRequest({
|
||||
details: error.response?.data || error.message
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
export const verifyCashfreePayment = onRequest({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user