satim-module - v1.0.0
    Preparing search index...

    Function deriveIdempotencyKey

    • Derive a deterministic, collision-resistant idempotency key.

      The key is sent to SATIM as externalRequestId. The gateway deduplicates registrations sharing the same externalRequestId, making retries safe — the second request returns the original order rather than creating a duplicate.

      Returns a 67-character string of the form dk_<64 hex chars>. Same inputs always produce the same output.

      Security: the merchant reference is not escaped before being concatenated. Collisions are possible in principle for adversarially constructed references containing pipe characters that happen to realign field boundaries. The practical impact is bounded — a collision causes the second request to be deduplicated to the first, meaning the merchant believes they registered two orders but the gateway only sees one. Callers controlling untrusted merchantRef content should constrain it to a safe character set (e.g. UUIDs or [A-Za-z0-9_-]+).

      Parameters

      • params: { merchantRef: string; amount: number; currency?: string; mode?: Mode }

      Returns string

      Error when merchantRef is missing or empty.

      Error from toMinorUnits on invalid amount.