digiwin_dsp 0.2.1 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf609190d9515001cb6540d2bbf8a88c8e1f6a5294ea21edbe1408bad4305fc4
4
- data.tar.gz: 61f86d3485d0322c3bd0af81bddcdf0ae3105327d9de63a038dbab6854a3901b
3
+ metadata.gz: 9ea65e0563bda4079eccde2814f33d7f1ef2e7510658c2d1d41998379d2445f2
4
+ data.tar.gz: 14e2d2f5122d335fdfcf4c765a5524f7e5ed95f059d9a319d96bbf12100b6847
5
5
  SHA512:
6
- metadata.gz: 977f1b3a3e31e5de38b1bc48327ef5427cbedeb12b60949f1812c964a768fc96ab1810ca4b1aae7f4427c38b85c6fe108f296082ec0b202052bab76578901a31
7
- data.tar.gz: 9301f03f1af6630147a6d1ad88fd7db41fdd70c329886b5b526a75bbf4f2492643852f353115f5c65e22c759656d1cb86708620d28199f3d9b4514360f69da90
6
+ metadata.gz: 3eb4491ae83a4de2b864182d50c56c1d00e06a909aee6fd7ce67b3336f89232c87bcf1cd391130bf87fe19a99087bd4da7d0d6c5b939beeda02ed6a37dd9e81f
7
+ data.tar.gz: e89bd33fa54644c26fb1b32019ff2e36e42779e50bc4e05d568abfc0fa5504a1e1a11098c2bc026fee2f398763f6723713ff25e804eaa283f71c8dfa8c9c1fd4
data/CHANGELOG.md CHANGED
@@ -6,6 +6,32 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.3] - 2026-05-22
10
+
11
+ ### Docs
12
+
13
+ - Document the `order_status` enum (`"2"` cancel / `"3"` new / `"5"` invoice / `"7"` return) in README and `docs/dsp-api-spec.md`. DSP rejects others with `WrongStatus:order_status錯誤,請固定給N(...)`. All four live-verified against UAT. The OpenAPI examples don't surface this constraint, so live smoke had to discover each value.
14
+
15
+ ### Changed
16
+
17
+ - `scripts/smoke.rb` accepts `ORDER_STATUS=…` env override so operators can probe DSP's WrongStatus path without editing the script.
18
+
19
+ ## [0.2.2] - 2026-05-21
20
+
21
+ ### Fixed
22
+
23
+ - **`Message:"DSP 序號驗證失敗"` now classifies as
24
+ `DigiwinDsp::AuthenticationError`.** Discovered via live UAT smoke
25
+ test: when the `DSP-api-key` header is missing or invalid, DSP
26
+ returns HTTP 200 (not 401/403) with `Status:Failure` and that
27
+ message. Previously fell through to generic `Error`, defeating
28
+ typed-rescue logic.
29
+
30
+ ### Docs
31
+
32
+ - `docs/dsp-api-spec.md` documents the auth-failure envelope shape +
33
+ the form_no-prefix behavior on `Message`.
34
+
9
35
  ## [0.2.1] - 2026-05-21
10
36
 
11
37
  ### Fixed
@@ -140,7 +166,9 @@ Initial release. Covers the four Self-hosted Website Module (自有官網模組)
140
166
  - The gem is **synchronous on purpose**. Callers wrap requests in their own background job runner (e.g. ActiveJob) when needed.
141
167
  - Idempotency: clients can send `X-Idempotency-Key` via the `idempotency_key:` kwarg. DSP also dedupes server-side by `form_no + platform_id`.
142
168
 
143
- [Unreleased]: https://github.com/7a6163/digiwin_dsp/compare/v0.2.1...HEAD
169
+ [Unreleased]: https://github.com/7a6163/digiwin_dsp/compare/v0.2.3...HEAD
170
+ [0.2.3]: https://github.com/7a6163/digiwin_dsp/compare/v0.2.2...v0.2.3
171
+ [0.2.2]: https://github.com/7a6163/digiwin_dsp/compare/v0.2.1...v0.2.2
144
172
  [0.2.1]: https://github.com/7a6163/digiwin_dsp/compare/v0.2.0...v0.2.1
145
173
  [0.2.0]: https://github.com/7a6163/digiwin_dsp/compare/v0.1.1...v0.2.0
146
174
  [0.1.1]: https://github.com/7a6163/digiwin_dsp/compare/v0.1.0...v0.1.1
data/README.md CHANGED
@@ -141,6 +141,17 @@ Each has its own required-field set (8 / 11 / 19 fields respectively). Inspect `
141
141
  DigiwinDsp::Serializers::CancellationSerializer::REQUIRED_FIELDS
142
142
  ```
143
143
 
144
+ ### `order_status` enum
145
+
146
+ Each endpoint requires a specific `order_status` value inside `request_detail`. DSP rejects others with `WrongStatus:order_status錯誤,請固定給N(...)`. The OpenAPI examples don't document this — verified live against UAT 2026-05-21:
147
+
148
+ | Resource | `order_status` | Meaning |
149
+ |---|---|---|
150
+ | `Resources::Order` | `"3"` | 新增訂單 (new order) |
151
+ | `Resources::Cancellation` | `"2"` | 取消訂單 (cancel order) |
152
+ | `Resources::Invoice` | `"5"` | 發票更新 (invoice update) |
153
+ | `Resources::Return` | `"7"` | 退貨訂單 (return order) |
154
+
144
155
  ### Idempotency
145
156
 
146
157
  Pass `idempotency_key:` to attach an `X-Idempotency-Key` request header. DSP also dedupes server-side by `form_no + platform_id` and returns `Duplicated:訂單不可重複` on a re-send (mapped to `DuplicateRequestError`).
@@ -29,6 +29,7 @@ module DigiwinDsp
29
29
  # "ORDER-123:Duplicated:訂單不可重複"), so we substring-match rather than
30
30
  # anchor with \A. Order matters: more-specific patterns first.
31
31
  ENVELOPE_FAILURE_MAP = [
32
+ [/DSP 序號驗證失敗/, AuthenticationError], # bad / missing DSP-api-key
32
33
  [/Duplicated:/, DuplicateRequestError], # order already exists
33
34
  [/Processing:資料處理中/, RateLimitError], # transient; retry later
34
35
  [/Processing:取消訂單處理中/, ValidationError], # cancel in flight
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DigiwinDsp
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digiwin_dsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zac
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-21 00:00:00.000000000 Z
11
+ date: 2026-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday