From 7727e2b71099360203b5afb7e6c42464caf02b31 Mon Sep 17 00:00:00 2001 From: praveenkumarct Date: Wed, 31 Jan 2024 12:32:19 +0100 Subject: [PATCH] Update TODOs and adjust code --- processor/package.json | 4 +--- processor/src/clients/mockPaymentAPI.ts | 1 + processor/src/dtos/payment.dto.ts | 2 ++ processor/src/main.ts | 1 - processor/src/routes/payment.route.ts | 3 ++- processor/src/security/auth/token.auth.ts | 1 - 6 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 processor/src/security/auth/token.auth.ts diff --git a/processor/package.json b/processor/package.json index 2d1b5f6..8d93970 100644 --- a/processor/package.json +++ b/processor/package.json @@ -8,9 +8,7 @@ "start:dev": "node_modules/.bin/nodemon -q dist/server/main.js", "lint": "prettier --check \"src/**/*.{ts,js,json}\" && eslint --ext .ts src", "lint:fix": "prettier --write \"src/**/*.{ts,js,json}\" && eslint --fix --ext .ts src", - "build:server": "tsc -p tsconfig.server.json", - "build": "npm run build:server && npm run build:client", - "build:dev": "npm run build:server && npm run build:client:dev", + "build": "tsc -p tsconfig.server.json", "dev": "ts-node --project tsconfig.server.json src/server/main.ts | pino-pretty", "test": "jest --detectOpenHandles", "connector:post-deploy": "node src/connectors/post-deploy.ts", diff --git a/processor/src/clients/mockPaymentAPI.ts b/processor/src/clients/mockPaymentAPI.ts index 3211478..d5300f1 100644 --- a/processor/src/clients/mockPaymentAPI.ts +++ b/processor/src/clients/mockPaymentAPI.ts @@ -2,6 +2,7 @@ import { v4 as uuid } from 'uuid'; import {CreatePaymentRequest, MockPaymentProviderResponse} from '../services/types/payment.type'; import {PaymentOutcome} from "../dtos/payment.dto"; +// TODO: Make it class , add interface and provide implementation export const paymentProviderApi = (): any => { const allowedCreditCards = ['4111111111111111', '5555555555554444', '341925950237632']; diff --git a/processor/src/dtos/payment.dto.ts b/processor/src/dtos/payment.dto.ts index 625f4e4..12cef94 100644 --- a/processor/src/dtos/payment.dto.ts +++ b/processor/src/dtos/payment.dto.ts @@ -1,6 +1,8 @@ import {Static, Type} from '@sinclair/typebox'; export const CardPaymentMethod = Type.Object({ + // TODO: Remove the fields according to the payment provider solution, + // Strongly recommend not to process PAN data to Connectors. type: Type.Literal('card'), cardNumber: Type.String(), expiryMonth: Type.Number(), diff --git a/processor/src/main.ts b/processor/src/main.ts index 7d14032..099a121 100644 --- a/processor/src/main.ts +++ b/processor/src/main.ts @@ -1,7 +1,6 @@ import * as dotenv from 'dotenv'; dotenv.config(); -import { config } from "./config/config"; import { setupFastify } from "./server"; (async () => { diff --git a/processor/src/routes/payment.route.ts b/processor/src/routes/payment.route.ts index f094dda..3521cbf 100644 --- a/processor/src/routes/payment.route.ts +++ b/processor/src/routes/payment.route.ts @@ -17,7 +17,8 @@ export const paymentRoutes = async (fastify: FastifyInstance, opts: FastifyPlugi fastify.post<{ Body: PaymentRequestSchemaDTO; Reply: PaymentResponseSchemaDTO }>( '/payments', { - onRequest: opts.sessionAuthHook, + // TODO: implement session + // onRequest: opts.sessionAuthHook, schema: { body: PaymentRequestSchema, response: { diff --git a/processor/src/security/auth/token.auth.ts b/processor/src/security/auth/token.auth.ts deleted file mode 100644 index 1b38864..0000000 --- a/processor/src/security/auth/token.auth.ts +++ /dev/null @@ -1 +0,0 @@ -// TODO: token authentication for Merchant center API \ No newline at end of file