@riocrypto/common-server 1.0.2190 → 1.0.2191

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.
@@ -1,2 +1,2 @@
1
1
  import { OrderDoc } from "../models/order";
2
- export declare const generateIdempotencyKeyFromOrder: (order: OrderDoc, useUnderscore: boolean) => string;
2
+ export declare const generateIdempotencyKeyFromOrder: (order: OrderDoc, useUnderscore: boolean, withdrawalCount?: number) => string;
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateIdempotencyKeyFromOrder = void 0;
4
4
  const crypto_1 = require("crypto");
5
- const generateIdempotencyKeyFromOrder = (order, useUnderscore) => {
5
+ const generateIdempotencyKeyFromOrder = (order, useUnderscore, withdrawalCount) => {
6
6
  const orderMongoId = order.id;
7
7
  const orderVersion = order.version.toString();
8
+ const withdrawalSuffix = withdrawalCount !== undefined ? `-withdrawal-${withdrawalCount}` : "";
8
9
  // Create a consistent string to hash
9
- const inputString = `${orderMongoId}-${orderVersion}`;
10
+ const inputString = `${orderMongoId}-${orderVersion}${withdrawalSuffix}`;
10
11
  // Create a SHA-1 hash of the input string
11
12
  const hash = (0, crypto_1.createHash)("sha1").update(inputString).digest("hex");
12
13
  // Format as UUID v5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2190",
3
+ "version": "1.0.2191",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",