@waffo/pancake-ts 0.4.0 → 0.4.2

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
@@ -4,6 +4,23 @@ All notable changes to `@waffo/pancake-ts` will be documented in this file.
4
4
 
5
5
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.4.2] - 2026-04-16
8
+
9
+ ### Fixed
10
+
11
+ - **`merchantId` validated at construction** — `WaffoPancake` constructor now validates that `merchantId` matches `MER_{base62}` format (exactly 22 base62 characters after prefix). Previously, malformed values like `MER_1XdxrN8hqc5jBMAnWvVm1W1` (23 chars) or `merchant-123` were silently accepted, passed through to the gateway, and caused cryptic 500 errors from the database layer. Invalid formats now throw `WaffoPancakeError` (`status: 400`, `layer: "sdk"`) immediately.
12
+ - **Short ID regex tightened** — All `validateShortId()` checks (affecting `storeId`, `productId`, `orderId`, `paymentId`, `ticketId`, `merchantId`) now enforce exactly 22 base62 characters after the prefix, matching the server-side format. The previous regex (`/[A-Za-z0-9]+/`) accepted any length.
13
+
14
+ ## [0.4.1] - 2026-04-15
15
+
16
+ ### Changed
17
+
18
+ - **`RefundTicket.versionData` is now structured** — tightened from `Record<string, unknown> | null` to a new `RefundTicketVersionData | null` type matching the GraphQL `RefundTicketVersionData` shape: `{ reason: string; requestedAmount: RequestedAmount | null }`. Aligns with `waffo-pancake-graphql-service` v2026.04.15.1.
19
+
20
+ ### Added
21
+
22
+ - **`RefundTicketVersionData`** — exported type. Reuses the existing `RequestedAmount` for the nested amount field.
23
+
7
24
  ## [0.4.0] - 2026-04-15
8
25
 
9
26
  ### Breaking Changes
package/README.md CHANGED
@@ -508,6 +508,7 @@ src/
508
508
  ├── signing.ts # RSA-SHA256 request signing
509
509
  ├── errors.ts # WaffoPancakeError
510
510
  ├── webhooks.ts # Webhook verification (embedded keys)
511
+ ├── validation.ts # Client-side input validation
511
512
  ├── types.ts # Type definitions & enums
512
513
  ├── __tests__/ # Test suite
513
514
  └── resources/ # API resource classes
package/dist/index.cjs CHANGED
@@ -245,7 +245,7 @@ var HttpClient = class {
245
245
  };
246
246
 
247
247
  // src/validation.ts
248
- var SHORT_ID_REGEX = /^[A-Z]{2,4}_[A-Za-z0-9]+$/;
248
+ var SHORT_ID_REGEX = /^[A-Z]{2,5}_[0-9A-Za-z]{22}$/;
249
249
  var CURRENCY_CODE_REGEX = /^[A-Z]{3}$/;
250
250
  var COUNTRY_CODE_REGEX = /^[A-Z]{2}$/;
251
251
  var AMOUNT_STRING_REGEX = /^\d+(\.\d+)?$/;
@@ -1187,6 +1187,7 @@ var WaffoPancake = class {
1187
1187
  graphql;
1188
1188
  webhooks;
1189
1189
  constructor(config) {
1190
+ validateShortId("merchantId", config.merchantId, "MER");
1190
1191
  this.config = config;
1191
1192
  this.http = new HttpClient(config);
1192
1193
  this.auth = new AuthResource(this.http);