Merge pull request #1508 from automatisch/controllers-js
feat: Convert ts files to js files for controllers
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import { Response } from 'express';
|
||||
import { IJSONObject, IRequest } from '@automatisch/types';
|
||||
import crypto from 'crypto';
|
||||
import { serialize } from 'php-serialize';
|
||||
import Billing from '../../helpers/billing/index.ee';
|
||||
import appConfig from '../../config/app';
|
||||
|
||||
export default async (request: IRequest, response: Response) => {
|
||||
export default async (request, response) => {
|
||||
if (!verifyWebhook(request)) {
|
||||
return response.sendStatus(401);
|
||||
}
|
||||
@@ -23,14 +21,14 @@ export default async (request: IRequest, response: Response) => {
|
||||
return response.sendStatus(200);
|
||||
};
|
||||
|
||||
const verifyWebhook = (request: IRequest) => {
|
||||
const verifyWebhook = (request) => {
|
||||
const signature = request.body.p_signature;
|
||||
|
||||
const keys = Object.keys(request.body)
|
||||
.filter((key) => key !== 'p_signature')
|
||||
.sort();
|
||||
|
||||
const sorted: IJSONObject = {};
|
||||
const sorted = {};
|
||||
keys.forEach((key) => {
|
||||
sorted[key] = request.body[key];
|
||||
});
|
@@ -1,12 +1,10 @@
|
||||
import path from 'node:path';
|
||||
import { Response } from 'express';
|
||||
import { IRequest } from '@automatisch/types';
|
||||
|
||||
import Connection from '../../models/connection';
|
||||
import logger from '../../helpers/logger';
|
||||
import handler from '../../helpers/webhook-handler';
|
||||
|
||||
export default async (request: IRequest, response: Response) => {
|
||||
export default async (request, response) => {
|
||||
const computedRequestPayload = {
|
||||
headers: request.headers,
|
||||
body: request.body,
|
||||
@@ -22,7 +20,7 @@ export default async (request: IRequest, response: Response) => {
|
||||
.findById(connectionId)
|
||||
.throwIfNotFound();
|
||||
|
||||
if (!await connection.verifyWebhook(request)) {
|
||||
if (!(await connection.verifyWebhook(request))) {
|
||||
return response.sendStatus(401);
|
||||
}
|
||||
|
@@ -1,11 +1,8 @@
|
||||
import { Response } from 'express';
|
||||
import { IRequest } from '@automatisch/types';
|
||||
|
||||
import Flow from '../../models/flow';
|
||||
import logger from '../../helpers/logger';
|
||||
import handler from '../../helpers/webhook-handler';
|
||||
|
||||
export default async (request: IRequest, response: Response) => {
|
||||
export default async (request, response) => {
|
||||
const computedRequestPayload = {
|
||||
headers: request.headers,
|
||||
body: request.body,
|
Reference in New Issue
Block a user