@classytic/primitives 0.26.2 → 0.26.3

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
4
4
  adhering to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## 0.26.3
7
+
8
+ ### Added — `PaymentProviderPort.wantsRawBody`
9
+
10
+ Optional `readonly wantsRawBody?: boolean` on the payment gateway port.
11
+ Providers that verify an HMAC signature (Stripe signs the bytes it transmitted)
12
+ must declare `true` — the transport then hands the raw body rather than the
13
+ parsed object. Absent / `false` preserves the historical behaviour (parsed
14
+ body), which is correct for manual, cash and terminal providers that sign
15
+ nothing.
16
+
6
17
  ## 0.26.2
7
18
 
8
19
  ### Added — `stockKeyFor` (`/item-identity`): one stock-key precedence for every package
@@ -277,6 +277,25 @@ interface PaymentProviderPort {
277
277
  * without this cannot be auto-reconciled — the engine then RETAINS the reservation.
278
278
  */
279
279
  getRefundStatus?(query: RefundStatusQuery, command?: PaymentCommandContext): Promise<PaymentResult>;
280
+ /**
281
+ * Does this provider need the EXACT transmitted bytes, rather than the
282
+ * parsed body?
283
+ *
284
+ * `true` for anything that verifies an HMAC signature — Stripe signs the
285
+ * bytes it sent, and a re-serialized object differs in key order, spacing and
286
+ * unicode escaping, so a check against the parsed form can never pass.
287
+ *
288
+ * Declared by the provider rather than decided by the transport, because the
289
+ * transport cannot know. Handing raw bytes to every provider breaks the ones
290
+ * that read `payload.sessionId` — they get a string and silently see
291
+ * `undefined`, so the webhook resolves to no transaction and the payment
292
+ * never applies. Handing the parsed body to every provider breaks signature
293
+ * verification. Only the provider knows which it is.
294
+ *
295
+ * Absent means `false`: the historical behaviour, and correct for manual,
296
+ * cash and terminal providers that sign nothing.
297
+ */
298
+ readonly wantsRawBody?: boolean;
280
299
  handleWebhook(payload: unknown, headers?: Record<string, string>): Promise<WebhookEvent>;
281
300
  /**
282
301
  * Reject a forged webhook. Returning `true` unconditionally is only acceptable for a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classytic/primitives",
3
- "version": "0.26.2",
3
+ "version": "0.26.3",
4
4
  "description": "Framework-agnostic TypeScript primitives shared across Classytic packages — Money, events, pagination, tenant config, and other building blocks.",
5
5
  "author": "Classytic",
6
6
  "license": "MIT",