ap2_mandate_verifier 1.5.0 → 1.6.1
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 +4 -4
- data/README.ja.md +95 -172
- data/README.md +119 -199
- data/SECURITY.md +7 -3
- data/docs/LONG_PAYMENT.md +84 -0
- data/docs/PAYMENT_ACCEPTANCE.md +8 -1
- data/docs/PUBLIC_API.md +10 -2
- data/docs/RECURRING_PAYMENT.md +56 -0
- data/docs/RELEASE_150_CANDIDATE.md +2 -0
- data/docs/RELEASE_160_CANDIDATE.md +30 -0
- data/docs/RELEASE_161_CANDIDATE.md +30 -0
- data/docs/RUBY_INTEGRATION.ja.md +204 -0
- data/docs/RUBY_INTEGRATION.md +222 -0
- data/docs/SUPPORT_CONTRACT.md +19 -2
- data/examples/conditional_checkout.rb +3 -3
- data/examples/integration/inputs.rb +169 -0
- data/examples/integration/processor.rb +39 -0
- data/examples/long_payment.rb +116 -0
- data/examples/long_payment_acceptance.rb +89 -0
- data/examples/recurring_payment.rb +99 -0
- data/examples/ruby_integration.rb +161 -0
- data/lib/ap2_mandate_verifier/checkout_jwt.rb +1 -1
- data/lib/ap2_mandate_verifier/checkout_receipt.rb +10 -1
- data/lib/ap2_mandate_verifier/conditional_checkout.rb +43 -19
- data/lib/ap2_mandate_verifier/input_builder.rb +1 -1
- data/lib/ap2_mandate_verifier/long_payment.rb +201 -0
- data/lib/ap2_mandate_verifier/payment.rb +52 -12
- data/lib/ap2_mandate_verifier/payment_acceptance/long_sqlite_store.rb +272 -0
- data/lib/ap2_mandate_verifier/payment_acceptance/recurring_sqlite_store.rb +124 -0
- data/lib/ap2_mandate_verifier/payment_acceptance/sqlite_store.rb +38 -10
- data/lib/ap2_mandate_verifier/payment_acceptance.rb +28 -6
- data/lib/ap2_mandate_verifier/payment_policy.rb +7 -2
- data/lib/ap2_mandate_verifier/purchase_binding.rb +11 -5
- data/lib/ap2_mandate_verifier/recurring_payment.rb +111 -0
- data/lib/ap2_mandate_verifier/root_disclosures.rb +9 -6
- data/lib/ap2_mandate_verifier/scoped_constraints.rb +1 -1
- data/lib/ap2_mandate_verifier/selective_payment.rb +1 -1
- data/lib/ap2_mandate_verifier/trust_context.rb +6 -0
- data/lib/ap2_mandate_verifier.rb +4 -0
- metadata +23 -6
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# 1.6.0 candidate: long Open and UTC-monthly JPY acceptance
|
|
2
|
+
|
|
3
|
+
Historical preparation record. Owner subsequently approved publication; [the publication record](POST_RELEASE_160.md) supersedes the availability status below. No production/payment authority follows from tests, review or merge. The earlier bounded ON_DEMAND candidate is retained separately as historical evidence; it is not replaced in the registry.
|
|
4
|
+
|
|
5
|
+
## Proposed notes and primary use
|
|
6
|
+
|
|
7
|
+
New explicit `LongPayment` complete Checkout/Payment profiles reuse one signed Open pair across approved UTC calendar months. Their shared content `iat`/`exp` stays fixed (maximum400days); outer KB proofs, challenge/order/current keys and starts are fresh. Existing defaults, seven-input contract and old600/7200second profiles remain unchanged. The bounded `RecurringPayment` complete/selective profiles remain available.
|
|
8
|
+
|
|
9
|
+
Optional schema3 `PaymentAcceptance::LongSQLiteStore` atomically checks current protected authority, active Root, period/count/JPY budget and occurrence state. Protected CAS Root/Issuer/Agent replacement preserves complete economic terms, principal identities, original agreement end and accumulated usage. Authority invalidation/revocation blocks starts; old pending Tickets never revive through a generation update. Unknown/Error/crash never refunds capacity, reissues a Ticket or loses the first signed wires/Receipt reference.
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
accepted = service.accept(**trusted_scope, mode: :conditional, verification_inputs: raw_inputs)
|
|
13
|
+
execution = service.start(ticket: accepted.ticket, verification_inputs: fresh_raw_inputs) if accepted.ticket
|
|
14
|
+
# execution.valid_until is short; the application owns prompt processor dispatch.
|
|
15
|
+
usage = store.usage(**trusted_series_scope) # reserved totals/current epoch, not settlement
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
[12-period installed Ruby lifecycle](../examples/long_payment_acceptance.rb), [wire-only lifecycle](../examples/long_payment.rb), [API/security/migration/Python contract](LONG_PAYMENT.md).
|
|
19
|
+
|
|
20
|
+
## Exact boundary
|
|
21
|
+
|
|
22
|
+
The additional MONTHLY meaning is an explicit Host/profile policy: one immutable window within each UTC calendar month, no more than one window per month. It is not generic AP2 calendar conformance, rolling intervals, local timezone/DST billing or catch-up. JPY budget uses exact signed integers; the current Python evaluator's100xJPY conversion and missing cadence evaluation are documented disagreements. Actual SDK constructors/facade/chain/Schema comparisons use explicit Enum/profile/integer/inline adapters, not a claim of unmodified high-level compatibility.
|
|
23
|
+
|
|
24
|
+
External trust/consent/order provenance and freshness, registry synchronization into the ledger, nonce/order CAS, one protected authoritative store, history migration, processor idempotency/query and settlement remain application responsibilities. No built-in external revocation feed, scheduler, payment call, remote exactly-once, auto-refund or automatic schema1/2 migration is supplied. Long selective/PISP/date combinations, other currencies/timezones and arbitrary AP2 formats remain unsupported.
|
|
25
|
+
|
|
26
|
+
## Release gates
|
|
27
|
+
|
|
28
|
+
Both supportedMRI3.4.12/4.0.9 full regressions and the same physically installed archive; every payload source/archive/installed byte hash; 12-month leap-year positives, causal signed negatives/current key tests; independent8process same-period/count/budget races, realSIGKILL/restart, fsynced mock effects, rollback, Root/key replacement, revocation and original historical Receipt; installed pinnedPython interop with exactwire disagreements; optional-driver absence; normal demo regression and strict candidate context; independent latest-HEAD review with no unresolved substantiveP1/P2; Draft-first PRs, successful CI, reviewed/merged tree equality; fixed-builder repeat and merged-source byte-identical build.
|
|
29
|
+
|
|
30
|
+
Source/hash/count evidence is recorded outside its own package. Only an explicit OwnerGO for the final exact archive permits one publication attempt. Verify actual registry bytes before formal tag/Release; inspect uncertain outcomes before retries. No merge/push workflow may publish or deploy.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# 1.6.1 patch release preparation
|
|
2
|
+
|
|
3
|
+
## Scope and status
|
|
4
|
+
|
|
5
|
+
This record prepares the patch following [PR #256](https://github.com/cuichangquan/ap2-mandate-verifier/pull/256).
|
|
6
|
+
The Owner requested distribution of the newly bundled Ruby integration and crash-recovery example.
|
|
7
|
+
The Owner will execute the final RubyGems push and complete MFA; the agent prepares and verifies the archive and commands only.
|
|
8
|
+
The SDK `lib/` implementation, public APIs, runtime dependency pins and Ruby requirements are unchanged.
|
|
9
|
+
The package includes the CLI, two helpers and English/Japanese guides already reviewed in #256.
|
|
10
|
+
The sample remains synthetic and Linux/Docker-validated; it grants no production or real-payment authority.
|
|
11
|
+
The legacy published examples and the public **1.6.0** archive audits remain unchanged.
|
|
12
|
+
|
|
13
|
+
**Candidate, not published:** registry publication, tag and GitHub Release are pending.
|
|
14
|
+
Do not infer publication from this document, a green CI run, version metadata, or a merge.
|
|
15
|
+
The current public baseline remains [1.6.0](https://github.com/cuichangquan/ap2-mandate-verifier/blob/main/docs/POST_RELEASE_160.md).
|
|
16
|
+
|
|
17
|
+
## Required evidence and gates
|
|
18
|
+
|
|
19
|
+
- Build one exact 1.6.1 archive in the fixed MRI 4.0.9 Docker builder with `SOURCE_DATE_EPOCH=1794319977`, repeat the build byte-for-byte, and record SHA256/size.
|
|
20
|
+
- Run source and ordinary installed-package regressions on MRI 3.4.12 and 4.0.9 using that **same archive**, including the separate-process integration/recovery suite.
|
|
21
|
+
- Compare every payload file among source, extracted archive and actual installed files; verify metadata, dependency pins and no native extension or secret fixture.
|
|
22
|
+
- Keep public-1.6.0 tests pinned to 1.6.0. Candidate tests explicitly pass `AP2_GEM_VERSION=1.6.1`; do not weaken version identity checks to a range.
|
|
23
|
+
- Obtain independent Codex review on the latest PR HEAD, resolve substantive findings, and pass the required CI and repository merge conditions. No auto-merge; at most three workflow runs, attempt 1, for this PR.
|
|
24
|
+
- After merge, verify the reviewed and merged trees match and the fixed-builder merged-source archive is byte-identical.
|
|
25
|
+
- Present the final archive identity and verification to the Owner. Only explicit OwnerGO for those final bytes permits **one** publication attempt.
|
|
26
|
+
- Inspect the registry before publishing and after any uncertain outcome. Never blindly retry a push, overwrite a version, or create a replacement artifact under the same approval.
|
|
27
|
+
- Verify actual registry bytes/metadata and ordinary installation before creating the annotated tag and non-prerelease GitHub Release at the released source commit. Preserve the archive and public evidence.
|
|
28
|
+
|
|
29
|
+
No merge/push workflow publishes or deploys. No direct Mac installation, credentials disclosure,
|
|
30
|
+
new persistent access, real payment, production database or demo deployment is included.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Rubyアプリ組込みとプロセス終了後の復旧
|
|
2
|
+
|
|
3
|
+
[English](RUBY_INTEGRATION.md) · [Quick Start](https://github.com/cuichangquan/ap2-mandate-verifier/blob/main/docs/QUICK_START.ja.md) · [受理契約](PAYMENT_ACCEPTANCE.md)
|
|
4
|
+
|
|
5
|
+
アプリの正本データ、条件付きCheckout、Payment、永続的な受理、元取引に結合したReceiptを
|
|
6
|
+
つなぐ入口です。実行ファイルは[`examples/ruby_integration.rb`](../examples/ruby_integration.rb)、
|
|
7
|
+
アプリ入力の構築は[`integration/inputs.rb`](../examples/integration/inputs.rb)です。
|
|
8
|
+
合成の登場者とSQLiteの模擬processorだけを使い、Rails・A2A・外部アカウント・実決済は不要です。
|
|
9
|
+
**組込みを理解するための実装例であり、本番の認証・認可backendではありません。**
|
|
10
|
+
|
|
11
|
+
## 1. Dockerと公開Gemで動かす
|
|
12
|
+
|
|
13
|
+
Docker導入済みが前提です。ホストへのRuby・SQLiteインストールは不要です。
|
|
14
|
+
新しいcheckoutから実行します:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
git clone https://github.com/cuichangquan/ap2-mandate-verifier.git
|
|
18
|
+
cd ap2-mandate-verifier
|
|
19
|
+
docker build -f examples/integration/Dockerfile -t ap2-ruby-integration .
|
|
20
|
+
docker volume create ap2-ruby-integration-state
|
|
21
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration init /state/happy
|
|
22
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration run /state/happy success
|
|
23
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration inspect /state/happy
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
build時はRuby・依存を取得し、例の実行時はネットワークを無効にします。
|
|
27
|
+
imageはRuby 4.0.9、公開`ap2_mandate_verifier = 1.6.0`、任意driverの
|
|
28
|
+
`sqlite3 = 2.10.2`を使います。新しい実装例のsourceはこのcheckoutから取得し、
|
|
29
|
+
**公開済み1.6.0 Gem archiveには含まれていません**。実際のSDKの版と読込先も確認します:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
docker run --rm --network none --entrypoint ruby ap2-ruby-integration -rap2_mandate_verifier -e 's = Gem.loaded_specs.fetch("ap2_mandate_verifier"); puts "gem=#{s.version}; path=#{s.full_gem_path}"'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
SDKはインストール先のGemディレクトリを指す必要があり、リポジトリの`lib`ではありません。
|
|
36
|
+
公開Gemでの実行を確認する際は`-Ilib`や`RUBYLIB`を追加しないでください。
|
|
37
|
+
既存の`conditional_checkout.rb`、`payment.rb`、`payment_acceptance.rb`はGemだけで
|
|
38
|
+
取得できる例です。[Quick Start](https://github.com/cuichangquan/ap2-mandate-verifier/blob/main/docs/QUICK_START.ja.md)に同梱場所の確認手順があります。
|
|
39
|
+
新CLIと補助ファイルは`1.6.1`に同梱します。公開前はsource-built **1.6.1候補**を
|
|
40
|
+
意味し、registryの公開版ではありません。公開1.6.0とは出所が異なり、
|
|
41
|
+
公開1.6.0のインストールだけでは新CLIを取得できません。
|
|
42
|
+
公開済みと扱う前に[リリース準備記録](RELEASE_161_CANDIDATE.md)とRubyGemsの版情報を確認してください。
|
|
43
|
+
|
|
44
|
+
1.6.1と任意のSQLite driverを分離したRuby環境へ導入した後は、同梱CLIの実行に
|
|
45
|
+
リポジトリは不要です:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
AP2_GEM_DIR="$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier").full_gem_path')"
|
|
49
|
+
test -f "$AP2_GEM_DIR/examples/ruby_integration.rb"
|
|
50
|
+
ruby "$AP2_GEM_DIR/examples/ruby_integration.rb" init /tmp/ap2-integration-new
|
|
51
|
+
ruby "$AP2_GEM_DIR/examples/ruby_integration.rb" run /tmp/ap2-integration-new success
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`test`は同梱確認であり、別sourceへfallbackするものではありません。新しい保存先を使い、
|
|
55
|
+
`init`を通すために既存状態を削除しないでください。次版公開までは、上記Docker/リポジトリ
|
|
56
|
+
経路が公開Gemを使う再現手順です。1.6.1の最終archive公開には別途Gateがあります。
|
|
57
|
+
|
|
58
|
+
時計はすべて仮想です。初期epochは**1,800,000,000**で、実時計を使いません。
|
|
59
|
+
Mandate/challengeの期限は+60秒、遅延Receiptは独立した検証窓内の+120秒を使います。
|
|
60
|
+
翌年に実行しても通常例が突然期限切れになりません。本番では独立した現在の信頼時計へ差し替えます。
|
|
61
|
+
|
|
62
|
+
正常系では、最初の受理だけがTicketを返し、freshな`start`が模擬実行を1回許可します。
|
|
63
|
+
真正なSuccess Receiptを照合すると`receipt_success`になり、永続化した模擬実行数は**1**です。
|
|
64
|
+
これは実際の精算の証明ではありません。`inspect`は署名素材ではなく安全な要約を表示します。
|
|
65
|
+
|
|
66
|
+
各コマンドの仮想時刻は独立しています。`run`/`retry`は初期時刻、`recover`は+120秒を使い、
|
|
67
|
+
永続的な時計を進める構成ではありません。復旧後に示すretryも、有効期間内の再送をモデル化しています。
|
|
68
|
+
期限切れMandateの再受理を示すものではありません。実際に期限切れならlookup/reconcileを使い、
|
|
69
|
+
本番検証には現在の信頼できる時刻を渡してください。新CLIの検証対象はLinux Dockerです。
|
|
70
|
+
SDK自体の広いplatform検証は、このサンプルのnative Windows動作を保証しません。
|
|
71
|
+
|
|
72
|
+
## 2. 実際に終了し、別プロセスから復旧する
|
|
73
|
+
|
|
74
|
+
独立した合成シナリオごとに別ディレクトリを使います。`init`は既存ディレクトリを拒否します。
|
|
75
|
+
通常コマンドは既存の`app.json`、`acceptance.sqlite3`、`processor.sqlite3`が必要です。
|
|
76
|
+
ファイル消失を初期化で補いません。
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration init /state/crash
|
|
80
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration run /state/crash crash-after-charge
|
|
81
|
+
# 終了コード75が期待値。元のRubyプロセスはここで終了する。
|
|
82
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration recover /state/crash
|
|
83
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration inspect /state/crash
|
|
84
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration retry /state/crash
|
|
85
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration retry /state/crash resigned
|
|
86
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration inspect /state/crash
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
意図的な非zero終了の後にも復旧コマンドを実行します。`&&`で連結しないでください。
|
|
90
|
+
`docker run`ごとに別のRubyプロセスが起動し、named volumeは`--rm`でも残ります。
|
|
91
|
+
復旧前はSDKが`pending`で、模擬processorに実行1件と署名済み結果が残っています。
|
|
92
|
+
復旧は元のprocessor keyで照会し、元取引に結合したReceiptを検証して
|
|
93
|
+
`receipt_success`へ進みます。追加実行はありません。通常再送・再署名とも元のレコードを返し、
|
|
94
|
+
**新しいTicketは出ず**、模擬実行数は**1**のままです。
|
|
95
|
+
再署名は新しい業務occurrenceではなく、最初の署名原文を置き換えません。
|
|
96
|
+
|
|
97
|
+
既存の[`payment_acceptance.rb`](../examples/payment_acceptance.rb)は、
|
|
98
|
+
**同じRubyプロセス内**でStoreを開き直し、模擬結果をメモリに保持します。
|
|
99
|
+
小さなAPI例として有用ですが、プロセス終了・processor結果の永続化を示すものではありません。
|
|
100
|
+
復旧を組み込む際はこのCLIを先に読み、その後に既存例でAPIを比較してください。
|
|
101
|
+
|
|
102
|
+
## 3. アプリから渡す入力と保存対象
|
|
103
|
+
|
|
104
|
+
受信Mandateの自己申告から承認条件・正規注文・信頼鍵を作らないでください。
|
|
105
|
+
合成bootstrapが両者を用意するのは、例を単独実行可能にするためです。
|
|
106
|
+
|
|
107
|
+
| 入力 | 保持する主体/独立した取得元 | 保存・再確認するもの |
|
|
108
|
+
| --- | --- | --- |
|
|
109
|
+
| 承認・購入条件 | 認証済み購入者の同意/保護された承認backend | 候補、数量、金額、通貨、支払手段、正確なgrant。現在のactive/失効状態 |
|
|
110
|
+
| 正規注文 | 販売者の注文DB | tenant、buyer/account、注文ID・版、merchant、audience、正確なCheckout・期待総額。開始前の現在注文 |
|
|
111
|
+
| 現在の信頼鍵 | 保護されたissuer/Agent/merchant registry | identity、用途、鍵selector、公開鍵、active、期限、policy版。JWT headerから信頼を作らず現在registryを取得 |
|
|
112
|
+
| challenge | Hostのchallenge/nonceサービス | `InputBuilder.prepare`の保存記録、binding、nonce、audience、期限。fresh入力で`restore`し、本番では現在状態の原子的消費 |
|
|
113
|
+
| 期待するPayment | 承認済み注文と支払選択 | 金額、通貨、payee、instrument、Checkoutとの結合。受信Paymentとは独立して構築 |
|
|
114
|
+
| 安定した業務scope | 認証済みアプリworkflow | tenant・merchant・operation・approval・occurrence・orderの各ID。再送・再起動でも維持 |
|
|
115
|
+
| 最初の署名原文 | 最初に予約された試行 | 正確なCheckout/Open/Closed bytesとReceipt参照。復旧用に再生成しない |
|
|
116
|
+
| processorの識別・結果 | 受理レコードとprocessor | 最初のprocessor key、永続化した照会・結果。timeoutで別keyにしない |
|
|
117
|
+
| Receipt照合条件 | 保護された登録処理/processorとの契約 | 固定したissuer・公開鍵・payment ID、元Closed参照、独立した検証時間窓 |
|
|
118
|
+
|
|
119
|
+
`InputBuilder.prepare`でchallengeを保存します。検証・開始時には保護されたfixtureの正本を
|
|
120
|
+
読み直し、trustを選び、`restore`と`inputs`を呼び、完全なraw検証入力をSDKに渡します。
|
|
121
|
+
記録の復元や保存済みResult/Evidenceの読戻しは**現在の検証ではありません**。
|
|
122
|
+
coordinatorは再検証し、実アプリは現在の権限を正本で再確認し、nonce・注文状態を原子的に消費します。
|
|
123
|
+
|
|
124
|
+
専用ディレクトリ(0700)と`app.json`(0600)には合成秘密鍵、信頼入力、保存challenge、
|
|
125
|
+
最初の署名原文を保持します。2つのSQLiteファイルは受理台帳と模擬processor結果です。
|
|
126
|
+
一式を保護・保持し、commit・表示・ログ共有しないでください。
|
|
127
|
+
例は秘密鍵、再利用可能な署名原文、nonce、Ticketの値を表示しません。
|
|
128
|
+
本番ではsecret保管、アクセス制御、保持期限、暗号化、backup方針が別途必要です。
|
|
129
|
+
|
|
130
|
+
CLIは完了したコマンドごとにJSON要約を出力します。正常系の例(runtime情報は省略):
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{"event":"finished","sdk_state":"receipt_success","ticket":false,"mock_dispatches":1,"receipt_authentic":true,"reported_outcome":"Success"}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`ticket`は有無のbooleanだけで、実行能力の値ではありません。
|
|
137
|
+
`sdk_version`、`sdk_load`、`ruby`、`fixture_clock`は実行環境を示します。Docker/公開版経路では
|
|
138
|
+
`1.6.0`、`installed_gem`、`4.0.9`、`1800000000`が期待値です。1.6.1候補の同梱例では
|
|
139
|
+
`sdk_version: 1.6.1`と実際に使用したRubyの版が出力されます。
|
|
140
|
+
クラッシュ出力には`simulated_process_exit: 75`が付きます。照会結果がなければ
|
|
141
|
+
`event: operator_reconciliation_required`、`result: unknown`となり、SDK状態は
|
|
142
|
+
`pending`のままの場合があります。この区別を再実行の許可にしないでください。
|
|
143
|
+
|
|
144
|
+
`Payment.present`は保存したPayment原文を提示用に復元するだけで、真正性の検証ではありません。
|
|
145
|
+
後続の完全な検証と、アプリ側の現在の実行判断が必要です。
|
|
146
|
+
|
|
147
|
+
## 4. 状態遷移と復旧判断
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
保護された承認 + raw入力検証
|
|
151
|
+
-> reserved(最初の呼出元にopaque Ticket)
|
|
152
|
+
-> fresh start + fenced CAS -> processing(lookupはpending)
|
|
153
|
+
| -> receipt_success
|
|
154
|
+
| -> receipt_error
|
|
155
|
+
| -> unknown -> 検証済み照合 -> receipt_success/error
|
|
156
|
+
-> 現在入力が無効: 実行しない
|
|
157
|
+
|
|
158
|
+
再送・再署名・プロセス再起動 -> 元レコードをlookup。新Ticketなし
|
|
159
|
+
保存先の消失・破損 -> 停止。代替台帳を初期化しない
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`reserved`・`processing`は内部phaseです。未完了レコードの後続lookup/再送は
|
|
163
|
+
`pending`を返します。freshな`start`を試せるのは元のopaque Ticketだけです。
|
|
164
|
+
クラッシュでその能力を失っても再発行されません。
|
|
165
|
+
|
|
166
|
+
各行について、上記Dockerコマンドのprefixを使い`init /state/NAME`、
|
|
167
|
+
`run /state/NAME SCENARIO`、その後`recover /state/NAME`と`inspect`を実行します。
|
|
168
|
+
1ディレクトリは保護された合成occurrenceの1件です。再送のための新しい権限を作る手段ではありません。
|
|
169
|
+
|
|
170
|
+
| SCENARIO | 期待する永続状態/模擬実行数 | 安全な次の判断 |
|
|
171
|
+
| --- | --- | --- |
|
|
172
|
+
| `success` | `receipt_success`/1 | 元の確定結果を読み、再送で再実行しない |
|
|
173
|
+
| `error` | `receipt_error`/1 | 真正なError通知。未課金の証明ではなく自動再決済しない |
|
|
174
|
+
| `pause-before-start` | 同一プロセスのreopenでTicketを保持し完了/1 | freshな現在入力で開始。クラッシュ復旧とは別 |
|
|
175
|
+
| `expired-before-start` | 開始なし/0。予約は未完了 | challenge/Mandate期限切れで停止。Ticket再発行・自動解放なし |
|
|
176
|
+
| `crash-before-start` | 終了75。`pending`/0 | 別プロセスは照会可能だがTicketを復元できない。運用照合へ |
|
|
177
|
+
| `crash-after-start` | 終了75。`pending`/0 | Receiptなし。模擬実行数0でもpendingを維持 |
|
|
178
|
+
| `crash-after-charge` | 終了75。`pending`/1、署名済みReceiptあり | `recover`で`receipt_success`/1へ。追加実行なし |
|
|
179
|
+
| `unknown` | `unknown`/1、Receiptなし | 復旧後もunknown。元keyで照会し、未解決なら運用判断 |
|
|
180
|
+
| `delayed` | `unknown`/1、後刻のReceiptあり | +120で`recover`。元のReceipt窓で検証して`receipt_success`/1へ |
|
|
181
|
+
|
|
182
|
+
観測した呼出数0、Receipt不在、時間経過、`pending`、`unknown`、真正なError Receiptを、
|
|
183
|
+
再決済や予約枠解放の許可にしません。模擬processorは効果と結果を1つのlocal transactionに
|
|
184
|
+
記録しますが、**実processorの分散exactly-onceを証明しません**。
|
|
185
|
+
|
|
186
|
+
## 5. 実アプリへ差し替える責務
|
|
187
|
+
|
|
188
|
+
1. 合成承認・鍵を、認証済み同意、保護された発行処理、現在のtrust registryに置き換えます。
|
|
189
|
+
JSON注文を正本の注文サービスへ置き換え、受信フラグからgrantを登録しないでください。
|
|
190
|
+
2. 現在のgrant・注文・nonce・occurrence確認を、同じ正本transaction内の予約/開始CASへ
|
|
191
|
+
統合します。fixtureのsnapshotや「別DBで確認後にCAS」では本番認可の原子性を証明できません。
|
|
192
|
+
3. 模擬processorを、冪等性・照会契約を確認したPSP adapterに置き換えます。
|
|
193
|
+
元key・最初の署名原文を維持し、再利用可能な素材をログに出さず結果を保存します。
|
|
194
|
+
固定時計を本番の信頼できる現在時計へ置き換えます。
|
|
195
|
+
4. 自動化するのは結果取得可能な場合の読取・照会と、認証した元取引への照合です。
|
|
196
|
+
Receiptの署名、issuer、payment ID、元参照、検証時間窓を確認します。
|
|
197
|
+
正しい署名でも別参照は拒否し、再署名した別原文へ古いReceiptを付け替えません。
|
|
198
|
+
5. Ticket消失、結果未取得、DB消失・破損、rollback、trust rotation、証拠の矛盾は運用担当へ
|
|
199
|
+
引き継ぎます。dispatchを止め、PSPで元取引を照合し、明示的な業務復旧方針に従います。
|
|
200
|
+
台帳削除や新IDの作成で復旧したことにしないでください。
|
|
201
|
+
|
|
202
|
+
**Mandateの検証成功、アプリの現在の実行許可、processorの実行有無、Receiptの真正性、
|
|
203
|
+
Receiptが報告する結果**を分けて判断します。Success通知だけでは精算を証明しません。
|
|
204
|
+
API・保存契約と永続化の限界は[Payment受理・復旧仕様](PAYMENT_ACCEPTANCE.md)を参照してください。
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Ruby application integration and restart recovery
|
|
2
|
+
|
|
3
|
+
[日本語](RUBY_INTEGRATION.ja.md) · [Quick Start](https://github.com/cuichangquan/ap2-mandate-verifier/blob/main/docs/QUICK_START.md) · [Acceptance contract](PAYMENT_ACCEPTANCE.md)
|
|
4
|
+
|
|
5
|
+
Start here to connect application records, conditional Checkout, Payment, durable
|
|
6
|
+
acceptance and an original-bound Receipt. The runnable entry is
|
|
7
|
+
[`examples/ruby_integration.rb`](../examples/ruby_integration.rb), with application
|
|
8
|
+
input preparation in [`integration/inputs.rb`](../examples/integration/inputs.rb).
|
|
9
|
+
It uses synthetic actors and a SQLite mock processor, without Rails, A2A, external
|
|
10
|
+
accounts or real payments. It is an integration demonstrator, **not a production
|
|
11
|
+
authorization backend**.
|
|
12
|
+
|
|
13
|
+
## 1. Run with Docker and the published Gem
|
|
14
|
+
|
|
15
|
+
Prerequisite: an existing Docker installation. No Ruby or SQLite installation on
|
|
16
|
+
the host is needed. From a fresh repository checkout:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
git clone https://github.com/cuichangquan/ap2-mandate-verifier.git
|
|
20
|
+
cd ap2-mandate-verifier
|
|
21
|
+
docker build -f examples/integration/Dockerfile -t ap2-ruby-integration .
|
|
22
|
+
docker volume create ap2-ruby-integration-state
|
|
23
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration init /state/happy
|
|
24
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration run /state/happy success
|
|
25
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration inspect /state/happy
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Build downloads Ruby/dependencies; the sample runs without networking. The image
|
|
29
|
+
uses Ruby 4.0.9, published `ap2_mandate_verifier = 1.6.0` and optional
|
|
30
|
+
`sqlite3 = 2.10.2`. The new example source comes from this checkout, **not from the
|
|
31
|
+
published 1.6.0 Gem archive**. Verify the installed SDK path/version independently:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
docker run --rm --network none --entrypoint ruby ap2-ruby-integration -rap2_mandate_verifier -e 's = Gem.loaded_specs.fetch("ap2_mandate_verifier"); puts "gem=#{s.version}; path=#{s.full_gem_path}"'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The SDK path must be the installed Gem directory, not this repository's `lib`.
|
|
38
|
+
Do not add `-Ilib` or set `RUBYLIB` when claiming a published-Gem run. Existing
|
|
39
|
+
`conditional_checkout.rb`, `payment.rb` and `payment_acceptance.rb` are already
|
|
40
|
+
Gem-only examples. Follow the [Quick Start](https://github.com/cuichangquan/ap2-mandate-verifier/blob/main/docs/QUICK_START.md) to locate them.
|
|
41
|
+
The CLI and its helper files are packaged in `1.6.1`. Before publication, this
|
|
42
|
+
means the source-built **1.6.1 candidate**, not a registry release. Its provenance
|
|
43
|
+
is different from public 1.6.0; installing public 1.6.0 alone does not supply this CLI.
|
|
44
|
+
Check the [release preparation](RELEASE_161_CANDIDATE.md) and RubyGems version
|
|
45
|
+
record before treating an archive as published.
|
|
46
|
+
|
|
47
|
+
Once 1.6.1 has been installed in an isolated Ruby environment with the
|
|
48
|
+
optional SQLite driver, no repository is needed to run its packaged CLI:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
AP2_GEM_DIR="$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier").full_gem_path')"
|
|
52
|
+
test -f "$AP2_GEM_DIR/examples/ruby_integration.rb"
|
|
53
|
+
ruby "$AP2_GEM_DIR/examples/ruby_integration.rb" init /tmp/ap2-integration-new
|
|
54
|
+
ruby "$AP2_GEM_DIR/examples/ruby_integration.rb" run /tmp/ap2-integration-new success
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The `test` is a packaging check, not a fallback to another source. Use a new
|
|
58
|
+
destination; do not remove an old state directory to make `init` succeed.
|
|
59
|
+
Until a new version is published, the Docker/repository route above is the
|
|
60
|
+
reproducible public route. Publication of the exact 1.6.1 archive is a separate gate.
|
|
61
|
+
|
|
62
|
+
All example time is virtual: the initial epoch is **1,800,000,000**, never the
|
|
63
|
+
wall clock. Mandate/challenge expiry is +60 seconds; the delayed Receipt uses
|
|
64
|
+
+120 seconds within a separately pinned Receipt window. Re-running in a later
|
|
65
|
+
calendar year does not unexpectedly expire the happy path. Production must use
|
|
66
|
+
an independent current trusted clock. Each command selects its scenario time
|
|
67
|
+
independently: `run`/`retry` use the initial epoch and `recover` uses +120.
|
|
68
|
+
Commands do not advance a persistent clock. Retries shown after recovery model
|
|
69
|
+
still-valid retransmission, not acceptance after expiry; use lookup/reconciliation
|
|
70
|
+
for an actually expired original Mandate. The new CLI is validated on Linux
|
|
71
|
+
Docker; broader SDK platform coverage does not certify this sample on native Windows.
|
|
72
|
+
|
|
73
|
+
Expected happy-path meaning: acceptance produces the first Ticket; fresh `start`
|
|
74
|
+
allows one mock dispatch; the authenticated Success Receipt finalizes
|
|
75
|
+
`receipt_success`. The persisted mock execution count is **1**. This is not proof
|
|
76
|
+
of real settlement. `inspect` exposes a safe summary, not raw signing material.
|
|
77
|
+
|
|
78
|
+
## 2. Actually terminate, then recover in another process
|
|
79
|
+
|
|
80
|
+
Use a different directory for each independent synthetic scenario. `init` refuses
|
|
81
|
+
an existing directory. All other commands require the existing `app.json`,
|
|
82
|
+
`acceptance.sqlite3` and `processor.sqlite3`; they never repair loss by bootstrap.
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration init /state/crash
|
|
86
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration run /state/crash crash-after-charge
|
|
87
|
+
# Expected exit status: 75. The original Ruby process has ended.
|
|
88
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration recover /state/crash
|
|
89
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration inspect /state/crash
|
|
90
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration retry /state/crash
|
|
91
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration retry /state/crash resigned
|
|
92
|
+
docker run --rm --network none -v ap2-ruby-integration-state:/state ap2-ruby-integration inspect /state/crash
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Run the recovery command even though the crash command is deliberately nonzero;
|
|
96
|
+
do not join them with `&&`. Each `docker run` launches a separate Ruby process.
|
|
97
|
+
The named volume survives `--rm`. Before recovery the SDK record is `pending`
|
|
98
|
+
and the durable mock has one execution/result. Recovery looks up the original
|
|
99
|
+
processor key, verifies its signed original-bound Receipt, and reaches
|
|
100
|
+
`receipt_success` without dispatch. Both retries return the original record with
|
|
101
|
+
**no Ticket**; the durable mock count stays **1**. A re-signature is not a new
|
|
102
|
+
business occurrence and does not replace the first signed bytes.
|
|
103
|
+
|
|
104
|
+
The older [`payment_acceptance.rb`](../examples/payment_acceptance.rb) opens a
|
|
105
|
+
second Store in the **same Ruby process**, retaining an in-memory mock result.
|
|
106
|
+
It teaches the coordinator API but does not demonstrate process restart or a
|
|
107
|
+
persisted processor result. Read this CLI first for restart integration, then the
|
|
108
|
+
older example for the smaller API-focused comparison.
|
|
109
|
+
|
|
110
|
+
## 3. Where application inputs come from
|
|
111
|
+
|
|
112
|
+
Never derive trusted approval, order or keys from received Mandate assertions.
|
|
113
|
+
The synthetic bootstrap supplies both sides only to make this example standalone.
|
|
114
|
+
|
|
115
|
+
| Input | Application owner / independent source | What to retain and recheck |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
| Approval and purchase conditions | Authenticated buyer consent / protected approval backend | Approved candidates, quantities, amounts, currency, allowed payment instrument and exact grant; current active/revoked status |
|
|
118
|
+
| Canonical order | Merchant order DB | Tenant, buyer/account, order ID/version, merchant, audience, exact Checkout and expected totals; current order before start |
|
|
119
|
+
| Current trust | Protected issuer/Agent/merchant registry | Identity, purpose, key selector, public key, activity, validity and policy version; reload current registry, never trust a JWT header as authority |
|
|
120
|
+
| Challenge | Host challenge/nonce service | Saved `InputBuilder.prepare` record, bindings, nonce, audience and expiry; `restore` against fresh inputs, with atomic current consumption in production |
|
|
121
|
+
| Expected Payment | Approved order and payment choice | Amount, currency, payee, instrument and Checkout binding, independent of incoming Payment |
|
|
122
|
+
| Stable business scope | Authenticated application workflow | Tenant, merchant, operation, approval, occurrence and order IDs; preserve across every retry/restart |
|
|
123
|
+
| Original signed wires | First successfully reserved attempt | Exact Checkout/Open/Closed bytes and Receipt reference, never regenerated for recovery |
|
|
124
|
+
| Processor identity/result | Acceptance record and processor | Original processor key plus durable query/result data; never allocate a replacement key on timeout |
|
|
125
|
+
| Receipt context | Protected enrollment / processor contract | Pinned issuer, public key, expected payment ID, original Closed reference and independent time window |
|
|
126
|
+
|
|
127
|
+
`InputBuilder.prepare` creates the saved challenge. At verification/start the
|
|
128
|
+
example reloads the protected fixture records, selects trust, calls `restore`
|
|
129
|
+
and `inputs`, then passes complete raw verification inputs to the existing SDK.
|
|
130
|
+
`Payment.present` restores the saved Payment bytes before verification; it does
|
|
131
|
+
not authenticate them. Restoring a record or loading a stored Result/Evidence is **not current
|
|
132
|
+
verification**. The coordinator verifies again; the real application must also
|
|
133
|
+
recheck authoritative current authorization and consume nonce/order state atomically.
|
|
134
|
+
|
|
135
|
+
The private directory (0700) and `app.json` (0600) hold synthetic signing keys,
|
|
136
|
+
trusted application inputs, saved challenge and exact first wires. The two SQLite
|
|
137
|
+
files hold the acceptance ledger and mock processor results. Protect and retain
|
|
138
|
+
the entire state set; do not commit it, print it, or share it as logs. The example
|
|
139
|
+
prints no private keys, reusable signed wires, nonce or Ticket values. Production
|
|
140
|
+
needs secret storage, access control, retention, encryption and backup policy.
|
|
141
|
+
|
|
142
|
+
The CLI prints one JSON summary per completed command. For example, the happy
|
|
143
|
+
path includes these fields (runtime metadata is omitted here):
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{"event":"finished","sdk_state":"receipt_success","ticket":false,"mock_dispatches":1,"receipt_authentic":true,"reported_outcome":"Success"}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`ticket` is only a boolean, never the capability. `sdk_version`, `sdk_load`,
|
|
150
|
+
`ruby` and `fixture_clock` identify the runtime. The Docker/public route reports
|
|
151
|
+
`1.6.0`, `installed_gem`, `4.0.9` and `1800000000`; the bundled 1.6.1 candidate
|
|
152
|
+
reports `sdk_version: 1.6.1` and the Ruby version actually used. Crash output carries
|
|
153
|
+
`simulated_process_exit: 75`. Missing query results report
|
|
154
|
+
`event: operator_reconciliation_required` and `result: unknown`; the SDK may
|
|
155
|
+
still say `pending`. That distinction does not authorize dispatch.
|
|
156
|
+
|
|
157
|
+
## 4. State transitions and recovery decisions
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
protected approval + raw verification
|
|
161
|
+
-> reserved (first caller receives opaque Ticket)
|
|
162
|
+
-> fresh start + fenced CAS -> processing (lookup reports pending)
|
|
163
|
+
| -> receipt_success
|
|
164
|
+
| -> receipt_error
|
|
165
|
+
| -> unknown -> verified reconciliation -> receipt_success/error
|
|
166
|
+
-> invalid current inputs: no dispatch
|
|
167
|
+
|
|
168
|
+
retry / re-sign / process restart -> lookup original record; no new Ticket
|
|
169
|
+
missing/corrupt storage -> stop; never initialize a replacement ledger
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`reserved` and `processing` are internal phases; a later lookup/retry reports
|
|
173
|
+
`pending` for an unfinished record. Only the original opaque Ticket can attempt
|
|
174
|
+
fresh `start`. Losing that capability in a process crash does not mint another.
|
|
175
|
+
|
|
176
|
+
For each row below, run `init /state/NAME`, then `run /state/NAME SCENARIO`, using
|
|
177
|
+
the same Docker command prefix above. Run `recover /state/NAME` and `inspect`
|
|
178
|
+
afterwards. A scenario directory is one protected synthetic occurrence, not a
|
|
179
|
+
way to allocate new authority for a retry.
|
|
180
|
+
|
|
181
|
+
| Scenario | Expected durable state / mock count | Safe next step |
|
|
182
|
+
| --- | --- | --- |
|
|
183
|
+
| `success` | `receipt_success` / 1 | Read final original outcome; no dispatch on retry |
|
|
184
|
+
| `error` | `receipt_error` / 1 | Authentic reported Error; not proof of no charge, no automatic retry |
|
|
185
|
+
| `pause-before-start` | Same-process reopen retains Ticket; completes / 1 | Fresh current inputs permit start; this is not a crash recovery |
|
|
186
|
+
| `expired-before-start` | No start / 0; reservation remains unfinished | Stop on expired challenge/Mandate; no replacement Ticket or automatic release |
|
|
187
|
+
| `crash-before-start` | Exit 75; `pending` / 0 | New process can inspect, but lost Ticket cannot be restored; operator reconciliation |
|
|
188
|
+
| `crash-after-start` | Exit 75; `pending` / 0 | No Receipt; preserve pending, even if mock count is zero |
|
|
189
|
+
| `crash-after-charge` | Exit 75; `pending` / 1, stored signed Receipt | `recover` reaches `receipt_success` / 1 without another dispatch |
|
|
190
|
+
| `unknown` | `unknown` / 1, no Receipt | Recovery preserves unknown; query original key and escalate unresolved outcome |
|
|
191
|
+
| `delayed` | `unknown` / 1 with later Receipt | `recover` at +120 verifies original Receipt window and reaches `receipt_success` / 1 |
|
|
192
|
+
|
|
193
|
+
Zero observed calls, missing Receipt, elapsed time, `pending`, `unknown`, or an
|
|
194
|
+
authentic Error Receipt never authorize a new payment or release the occurrence.
|
|
195
|
+
The mock records its effect and result in one local transaction; this **does not
|
|
196
|
+
prove distributed exactly-once behavior** for a real processor.
|
|
197
|
+
|
|
198
|
+
## 5. Replace the fixtures before production
|
|
199
|
+
|
|
200
|
+
1. Replace synthetic approval and keys with authenticated consent, protected
|
|
201
|
+
issuance and a current trust registry. Replace JSON order records with the
|
|
202
|
+
authoritative order service. Do not enroll a grant from an incoming flag.
|
|
203
|
+
2. Integrate current grant, order, nonce and occurrence checks with the same
|
|
204
|
+
authoritative reservation/start CAS. A fixture snapshot and a check in one DB
|
|
205
|
+
followed by a CAS in another do not prove production authorization atomicity.
|
|
206
|
+
3. Replace the mock with a PSP adapter whose idempotency/query contract is known.
|
|
207
|
+
Retain the first processor key and original signed wires. Persist outcomes
|
|
208
|
+
without logging reusable material. Use a trusted current clock, not this fixture.
|
|
209
|
+
4. Automate only read/query plus authenticated original-bound reconciliation when
|
|
210
|
+
the result is available. Verify Receipt signature, issuer, payment ID, original
|
|
211
|
+
reference and Receipt window. A valid signature with a different reference is
|
|
212
|
+
rejected; never attach that Receipt to a re-signed replacement instruction.
|
|
213
|
+
5. Escalate lost Ticket, missing result, storage loss/corruption, rollback, trust
|
|
214
|
+
rotation or conflicting evidence to the application operator. Stop dispatch,
|
|
215
|
+
reconcile the original transaction with the PSP, and follow an explicit
|
|
216
|
+
business recovery policy. Do not delete the ledger or manufacture a new ID.
|
|
217
|
+
|
|
218
|
+
Keep five questions separate: **Was the Mandate verified? Does the application
|
|
219
|
+
currently authorize execution? Did the processor execute? Is the Receipt
|
|
220
|
+
authentic? What result does it report?** A Success report alone is not settlement
|
|
221
|
+
proof. [Payment acceptance](PAYMENT_ACCEPTANCE.md) defines the API/storage
|
|
222
|
+
contract and remaining durability limits.
|
data/docs/SUPPORT_CONTRACT.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# AP2 Checkout Ruby SDK — support contract and history
|
|
2
2
|
|
|
3
|
-
## Current published
|
|
3
|
+
## Current published scope
|
|
4
4
|
|
|
5
|
-
Published stable is1.
|
|
5
|
+
Published stable is1.6.0: [verified publication](POST_RELEASE_160.md). It adds opt-in [transactional Payment acceptance](PAYMENT_ACCEPTANCE.md) while preserving all existing1.x verifier APIs, defaults and stored formats. The SQLite reference adapter additionally requires optional pinned driver2.10.2 and a protected local persistent filesystem; other adapters require their own atomicity/durability validation. No new external exactly-once or production authorization guarantee is made.
|
|
6
|
+
|
|
7
|
+
## Published1.6.0 subset
|
|
8
|
+
|
|
9
|
+
The additive release retains bounded JPY/ON_DEMAND profiles and adds an explicit complete [LongPayment JPY/UTC-month profile](LONG_PAYMENT.md), with up to400day content, fresh proof/start checks and optional schema3 authority/period storage. General calendar/timezone semantics and other currencies remain unsupported. Existing schema1/2,1.x defaults and short-profile limits remain unchanged; no automatic history migration is provided.
|
|
6
10
|
|
|
7
11
|
## Historical1.0.0 baseline contract
|
|
8
12
|
|
|
@@ -32,6 +36,19 @@ retain their preparation snapshot; repository updates do not rebuild or replace
|
|
|
32
36
|
Formal support remains MRI 3.4.12 and MRI 4.0.9 with JSON 2.19.9, JWT 3.3.0,
|
|
33
37
|
base64 0.3.0, OpenSSL gem 4.0.2 and Digest 3.2.1. The Gem's Ruby resolution range
|
|
34
38
|
does not certify every intervening version, engine, OS or native provider.
|
|
39
|
+
Native Linux ARM64/AMD64 and published 1.6.0 macOS Intel/Apple Silicon / Windows
|
|
40
|
+
Server 2022 X64 observations are recorded in [PLATFORM_SUPPORT](PLATFORM_SUPPORT.md).
|
|
41
|
+
Both exact MRIs passed the recorded native core and optional SQLite scenarios.
|
|
42
|
+
SDK support is independent of the Rails demo. These observations do not certify
|
|
43
|
+
all OS versions or native providers through Ruby's resolution range.
|
|
44
|
+
The core has no Rails or SQLite runtime dependency; optional reference persistence
|
|
45
|
+
uses an OS/CPU-specific SQLite driver. Source candidate checks never substitute
|
|
46
|
+
for the immutable published archive's SHA256 and installed payload checks.
|
|
47
|
+
|
|
48
|
+
環境ごとの実測範囲は上記リンクを正本とし、RailsデモとSDK単体を分けます。
|
|
49
|
+
macOS Intel・Apple SiliconとWindows Server 2022 X64も両MRIで合格しました。
|
|
50
|
+
記録した構成の実測に限定し、公開Gemとローカル候補の証拠は流用しません。
|
|
51
|
+
|
|
35
52
|
AP2 source `b4587ac1d055888a73b4b21750973cffba961793`, the three documented v1
|
|
36
53
|
profile identities and InputBuilder preparation format `1` remain unchanged.
|
|
37
54
|
|
|
@@ -8,7 +8,7 @@ module ConditionalCheckoutExample
|
|
|
8
8
|
PROFILE = M::ConditionalCheckout::PROFILE_REF
|
|
9
9
|
NOW = 1_800_000_000
|
|
10
10
|
def self.totals(n) = %w[subtotal total].map { |type| {"type" => type, "amount" => n} }
|
|
11
|
-
def self.run
|
|
11
|
+
def self.run(currency: "USD")
|
|
12
12
|
provider, agent, merchant = Array.new(3) { OpenSSL::PKey::EC.generate("prime256v1") }
|
|
13
13
|
seller = {"id" => "shop", "name" => "Office supplies"}
|
|
14
14
|
# This protected record is created AFTER application authentication, display
|
|
@@ -25,7 +25,7 @@ module ConditionalCheckoutExample
|
|
|
25
25
|
"quantity" => 1, "totals" => totals(100)}
|
|
26
26
|
end
|
|
27
27
|
order = {"id" => "office-1", "merchant" => seller, "status" => "ready_for_complete",
|
|
28
|
-
"currency" =>
|
|
28
|
+
"currency" => currency, "line_items" => lines, "totals" => totals(300), "links" => []}
|
|
29
29
|
checkout = M::CheckoutJWT.sign(checkout: order, profile_ref: PROFILE,
|
|
30
30
|
signer: M::CheckoutJWT.es256_signer(private_key: merchant), public_key_pem: merchant.public_to_pem)
|
|
31
31
|
|
|
@@ -41,7 +41,7 @@ module ConditionalCheckoutExample
|
|
|
41
41
|
"not_before" => NOW - 1, "not_after" => NOW + 1000, "records" => records},
|
|
42
42
|
tenant_id: "tenant", verified_at: NOW, profile_ref: PROFILE, **selectors)
|
|
43
43
|
host_order = {"tenant_id" => "tenant", "buyer_account_id" => "buyer", "order_id" => "office-1",
|
|
44
|
-
"merchant_id" => "shop", "audience" => "merchant-host", "order_version" => "1", "currency" =>
|
|
44
|
+
"merchant_id" => "shop", "audience" => "merchant-host", "order_version" => "1", "currency" => currency, "expected_total" => 300}
|
|
45
45
|
host_inputs = {trust: trust, order: host_order, root_presentation: opening.root_presentation, host_checkout_jws: checkout.jwt}
|
|
46
46
|
saved = M::InputBuilder.prepare(**host_inputs, challenge_id: "challenge-1", nonce: "synthetic-one-use-nonce",
|
|
47
47
|
issuer_id: "host", not_before: NOW, not_after: NOW + 60)
|