node-paytmpg 7.3.8 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -676,6 +676,7 @@ class PaymentController {
676
676
  const payuInstance = this.payuInstance;
677
677
  const openMoneyInstance = this.openMoneyInstance;
678
678
  console.log("request_data ", req.originalUrl, JSON.stringify(req.body));
679
+ console.log("request_data rawBody", req.originalUrl, req.rawBody);
679
680
  console.log("request_headers ", req.originalUrl, JSON.stringify(req.headers));
680
681
  if (config.paytm_url) {
681
682
  await this.callback(req, res);
@@ -696,8 +697,6 @@ class PaymentController {
696
697
  const reqBody = req.rawBody;
697
698
  const signature = req.headers["x-razorpay-signature"];
698
699
  console.log("Razorpay webhook signature:", signature);
699
- console.log("Razorpay rawBody:", reqBody);
700
- console.log("Razorpay SECRET:", config.SECRET);
701
700
  if (signature === undefined) {
702
701
  res.status(400).send({ message: "Missing Razorpay signature" });
703
702
  return;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Application, RequestHandler, Router } from 'express';
2
2
  import { NPCallbacks, NPConfig, NPTableNames } from './app/models';
3
3
  import { MultiDbORM } from 'multi-db-orm';
4
4
  export * from './app/models';
5
- export declare function attachViewEngine(app: Application, userConfig?: Partial<NPConfig>): void;
5
+ export declare function attachRawBodyAndEngine(app: Application, userConfig?: Partial<NPConfig>): void;
6
6
  export declare function createPaymentMiddleware(app: Application, userConfig: NPConfig, db: MultiDbORM, callbacks?: NPCallbacks, authenticationMiddleware?: RequestHandler, tableNames?: NPTableNames): Router;
7
7
  declare const _default: {
8
8
  createPaymentMiddleware: typeof createPaymentMiddleware;
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.attachViewEngine = attachViewEngine;
20
+ exports.attachRawBodyAndEngine = attachRawBodyAndEngine;
21
21
  exports.createPaymentMiddleware = createPaymentMiddleware;
22
22
  const express_1 = __importDefault(require("express"));
23
23
  const path_1 = __importDefault(require("path"));
@@ -26,7 +26,7 @@ const express_handlebars_1 = __importDefault(require("express-handlebars"));
26
26
  const payment_controller_1 = require("./app/controllers/payment.controller");
27
27
  const buildConfig_1 = require("./app/utils/buildConfig");
28
28
  __exportStar(require("./app/models"), exports);
29
- function attachViewEngine(app, userConfig = {}) {
29
+ function attachRawBodyAndEngine(app, userConfig = {}) {
30
30
  const config = (0, buildConfig_1.buildConfig)(userConfig);
31
31
  const saveRawBody = (req, res, buf) => {
32
32
  req.rawBody = buf && buf.toString();
@@ -47,13 +47,13 @@ function attachViewEngine(app, userConfig = {}) {
47
47
  },
48
48
  }));
49
49
  app.set('view engine', 'handlebars');
50
- app.set('attachBodyParser', true);
50
+ app.set('attachRawBodyAndEngine', true);
51
51
  }
52
52
  function createPaymentMiddleware(app, userConfig, db, callbacks, authenticationMiddleware, tableNames) {
53
- //check attachBodyParser
54
- if (!app.get('view engine')) {
55
- console.warn('[node-paytmpg]: View engine not attached. Attaching default view engine. Either call attachViewEngine() before createPaymentMiddleware() or ensure that your Express app has a view engine attached.');
56
- attachViewEngine(app, userConfig);
53
+ //check attachRawBodyAndEngine
54
+ if (!app.get('attachRawBodyAndEngine')) {
55
+ console.warn('[node-paytmpg]: attachRawBodyAndEngine not attached. Make sure to call attachRawBodyAndEngine() or make sure hbs view engine is set and req.rawBody is available.');
56
+ attachRawBodyAndEngine(app, userConfig);
57
57
  }
58
58
  const config = (0, buildConfig_1.buildConfig)(userConfig);
59
59
  const subApp = express_1.default.Router();
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-paytmpg",
3
- "version": "7.3.8",
3
+ "version": "7.4.0",
4
4
  "description": "Payment Gateway Integration using NodeJS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-paytmpg",
3
- "version": "7.3.8",
3
+ "version": "7.4.0",
4
4
  "description": "Payment Gateway Integration using NodeJS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",