feature/fitlien-add-cors #15

Merged
dhanshas merged 14 commits from feature/fitlien-add-cors into dev 2025-04-12 03:23:14 +00:00
3 changed files with 90 additions and 81 deletions
Showing only changes of commit fc01b038b3 - Show all commits

View File

@ -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",

View File

@ -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",

View File

@ -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 ')) {
@ -332,6 +338,7 @@ export const createCashfreeOrder = onRequest({
});
}
});
});
export const verifyCashfreePayment = onRequest({
region: '#{SERVICES_RGN}#'