node-paytmpg 8.0.15 → 8.0.17

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.
@@ -72,13 +72,14 @@ class RazorpayAdapter {
72
72
  catch (e) {
73
73
  if (clientConfig && jsonBody && jsonBody.payload && jsonBody.payload.payment && jsonBody.payload.payment.entity) {
74
74
  let orderId = (_c = (_b = (_a = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.payload) === null || _a === void 0 ? void 0 : _a.payment) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.order_id;
75
- let captureStatusClaimed = (_f = (_e = (_d = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.payload) === null || _d === void 0 ? void 0 : _d.payment) === null || _e === void 0 ? void 0 : _e.entity) === null || _f === void 0 ? void 0 : _f.status;
75
+ let captureStatusClaimed = ['captured', 'authorized', 'paid'].includes((_f = (_e = (_d = jsonBody === null || jsonBody === void 0 ? void 0 : jsonBody.payload) === null || _d === void 0 ? void 0 : _d.payment) === null || _e === void 0 ? void 0 : _e.entity) === null || _f === void 0 ? void 0 : _f.status);
76
76
  console.log("Error validating Razorpay signature:", e);
77
77
  if (orderId) {
78
78
  console.log("Attempting fallback validation method using GET Order", orderId);
79
79
  try {
80
- const orderDetails = await this.getOrder(orderId, { KEY: '', SECRET: secret });
81
- if (orderDetails && orderDetails.id === orderId && orderDetails.status === captureStatusClaimed) {
80
+ const orderDetails = await this.getOrder(orderId, clientConfig);
81
+ const captureStatusActual = ['captured', 'authorized', 'paid'].includes(orderDetails === null || orderDetails === void 0 ? void 0 : orderDetails.status);
82
+ if (orderDetails && orderDetails.id === orderId && captureStatusActual === captureStatusClaimed) {
82
83
  console.log("Fallback validation successful for order:", orderId);
83
84
  return true;
84
85
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-paytmpg",
3
- "version": "8.0.15",
3
+ "version": "8.0.17",
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": "8.0.15",
3
+ "version": "8.0.17",
4
4
  "description": "Payment Gateway Integration using NodeJS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",