kiosk-core 0.5.20 → 0.6.28

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: e13d8c20ff22d54f80b08ce121162c575f73cf7159f2a623c9a52dc8afda820a
4
- data.tar.gz: 4cd1571a390aad1e782ce844b2d35d7d4bfe2697466ad14b0e1ef3c49cf3cfc7
3
+ metadata.gz: 771cd195ba7e72ae0996466be7c0cab4eb3b1fa35ebfd4506b0d13eb7bb0ce08
4
+ data.tar.gz: bcf91d7119b9bfe67458d4e250da00ba55ccd5e59310c2431be04025faa20221
5
5
  SHA512:
6
- metadata.gz: 75e6135c30f091b70d05104c8179bcf275b4ec99a8e0e771981c7ab90ae3c6c2de8f180efc9d3d37ba0f16116e302843a6d1a945356cc163f337caabbbfd17b2
7
- data.tar.gz: d9e5bbd82971df57550ace1912ef0d499b0066f7a7d325ea6c5e334063c37e132a4731602d5f7096bc101aa164b690acf7558dd83d85816710212f1314aed08f
6
+ metadata.gz: 0aa408791a5e60ce07a1916084e20635773537a534bef508c5627432dfe13400ee46b52e4a74552684d2f4beddd5615259d9ff32ad0f536c76d362d746cb5c63
7
+ data.tar.gz: 4a12f9d851edd714c8b4e3680119456184565d953dfd1c5a11d81b75d321369e730279beba287a8f339be0d18482eb3b3ddcd5b204d4aa6bcdcd840e7cfc7f4d
data/CHANGELOG.md CHANGED
@@ -12,6 +12,155 @@ already written is edited.
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [0.6.28] — 2026-10-26
16
+
17
+ - 2026-10-26: Version 0.6.28, the tree cut that matches skill 0.6.28.
18
+
19
+ ## [0.6.27] — 2026-10-26
20
+
21
+ - 2026-10-26: Version 0.6.27, the tree cut that matches skill 0.6.27.
22
+ ## [0.6.26] — 2026-10-26
23
+
24
+ - 2026-10-26: Version 0.6.26, the tree cut that matches skill 0.6.26.
25
+ ## [0.6.25] — 2026-10-26
26
+
27
+ - 2026-10-26: Version 0.6.25, the tree cut that matches skill 0.6.25.
28
+ - 2026-10-26: The README names the mandate types the gem defines: `Kiosk::Mandate::CheckoutMandate` and `Kiosk::Mandate::PaymentMandate`.
29
+
30
+ ## [0.6.24] — 2026-10-26
31
+
32
+ - 2026-10-26: Version 0.6.24, the tree cut that matches skill 0.6.24.
33
+
34
+ ## [0.6.23] — 2026-10-26
35
+
36
+ - 2026-10-26: Version 0.6.23, the tree cut that matches skill 0.6.23.
37
+
38
+ ## [0.6.22] — 2026-10-26
39
+
40
+ - 2026-10-26: Version 0.6.22, the tree cut that matches skill 0.6.22.
41
+
42
+ ## [0.6.21] — 2026-10-26
43
+
44
+ - 2026-10-26: Version 0.6.21, the tree cut that matches skill 0.6.21.
45
+
46
+ ## [0.6.20] — 2026-10-26
47
+
48
+ - 2026-10-26: Version 0.6.20, the tree cut that matches skill 0.6.20.
49
+
50
+ ## [0.6.19] — 2026-10-26
51
+
52
+ - 2026-10-26: Version 0.6.19, the tree cut that matches skill 0.6.19.
53
+
54
+ ## [0.6.18] — 2026-10-25
55
+
56
+ - 2026-10-25: Version 0.6.18, the tree cut that matches skill 0.6.18.
57
+
58
+ ## [0.6.17] — 2026-10-25
59
+
60
+ - 2026-10-25: Version 0.6.17, the tree cut that matches skill 0.6.17.
61
+
62
+ ## [0.6.16] — 2026-10-25
63
+
64
+ - 2026-10-25: Version 0.6.16, the tree cut that matches skill 0.6.16.
65
+ - 2026-10-25: `Kiosk::Identity` takes the actor `agent` or `human`; `service` is removed.
66
+
67
+ ## [0.6.15] — 2026-10-25
68
+
69
+ - 2026-10-25: Version 0.6.15, the tree cut that matches skill 0.6.15.
70
+
71
+ ## [0.6.14] — 2026-10-25
72
+
73
+ - 2026-10-25: Version 0.6.14, the tree cut that matches skill 0.6.14.
74
+
75
+ ## [0.6.13] — 2026-10-25
76
+
77
+ - 2026-10-25: Version 0.6.13, the tree cut that matches skill 0.6.13.
78
+
79
+ ## [0.6.12] — 2026-10-24
80
+
81
+ - 2026-10-24: Version 0.6.12, the tree cut that matches skill 0.6.12.
82
+
83
+ - 2026-10-24: `KycProviders::Base.new(issuer:, public_key:, audience:)` names what an attestation is checked against; `open_verification` takes no `audience:`.
84
+
85
+ ## [0.6.11] — 2026-10-24
86
+
87
+ - 2026-10-24: Version 0.6.11, the tree cut that matches skill 0.6.11.
88
+
89
+ ## [0.6.10] — 2026-10-23
90
+
91
+ - 2026-10-23: Version 0.6.10, the tree cut that matches skill 0.6.10.
92
+
93
+ ## [0.6.9] — 2026-10-23
94
+
95
+ - 2026-10-23: Version 0.6.9, the tree cut that matches skill 0.6.9.
96
+
97
+ ## [0.6.8] — 2026-10-22
98
+
99
+ - 2026-10-22: Version 0.6.8, the tree cut that matches skill 0.6.8.
100
+
101
+ ## [0.6.7] — 2026-10-22
102
+
103
+ - 2026-10-22: Version 0.6.7, the tree cut that matches skill 0.6.7.
104
+
105
+ ## [0.6.6] — 2026-10-22
106
+
107
+ - 2026-10-22: Version 0.6.6, the tree cut that matches skill 0.6.6.
108
+
109
+ ## [0.6.5] — 2026-10-22
110
+
111
+ - 2026-10-22: Version 0.6.5, the tree cut that matches skill 0.6.5.
112
+
113
+ ## [0.6.4] — 2026-10-22
114
+
115
+ - 2026-10-22: Version 0.6.4, the tree cut that matches skill 0.6.4.
116
+
117
+ ## [0.6.3] — 2026-10-22
118
+
119
+ - 2026-10-22: Version 0.6.3, the tree cut that matches skill 0.6.3.
120
+
121
+ ## [0.6.2] — 2026-10-22
122
+
123
+ - 2026-10-22: Version 0.6.2, the tree cut that matches skill 0.6.2.
124
+
125
+ ## [0.6.1] — 2026-10-22
126
+
127
+ - 2026-10-22: Version 0.6.1, the tree cut that matches skill 0.6.1.
128
+
129
+ ## [0.6.0] — 2026-10-21
130
+
131
+ - 2026-10-21: Version 0.6.0, the tree cut that matches skill 0.6.0.
132
+
133
+ ## [0.5.27] — 2026-10-21
134
+
135
+ - 2026-10-21: Version 0.5.27, the tree cut that matches skill 0.5.27.
136
+
137
+ ## [0.5.26] — 2026-10-21
138
+
139
+ - 2026-10-21: Version 0.5.26, the tree cut that matches skill 0.5.26.
140
+
141
+ ## [0.5.25] — 2026-10-21
142
+
143
+ - 2026-10-21: Version 0.5.25, the tree cut that matches skill 0.5.25.
144
+
145
+ ## [0.5.24] — 2026-10-21
146
+
147
+ - 2026-10-21: `PaymentProviders::Base#capture` may answer `network_confirmation_id`, the card network's id of the charge, which the payment receipt names.
148
+ - 2026-10-21: Version 0.5.24, the tree cut that matches skill 0.5.24.
149
+
150
+ ## [0.5.23] — 2026-10-21
151
+
152
+ - 2026-10-21: `AgentIdentityProviders::Base` states that an identity's claims carry `cnf: { jkt: }`, the key that signs the call's DPoP proof.
153
+ - 2026-10-21: Version 0.5.23, the tree cut that matches skill 0.5.23.
154
+
155
+ ## [0.5.22] — 2026-10-21
156
+
157
+ - 2026-10-21: `Kiosk::Mandate` holds the two AP2 v0.2 mandates, `CheckoutMandate` and `PaymentMandate`; the payment port captures a checkout mandate.
158
+ - 2026-10-21: Version 0.5.22, the tree cut that matches skill 0.5.22.
159
+
160
+ ## [0.5.21] — 2026-10-21
161
+
162
+ - 2026-10-21: Version 0.5.21, the tree cut that matches skill 0.5.21.
163
+
15
164
  ## [0.5.20] — 2026-10-20
16
165
 
17
166
  - 2026-10-20: Version 0.5.20, the tree cut that matches skill 0.5.20.
data/README.md CHANGED
@@ -4,13 +4,13 @@ Core abstractions for the [Kiosk](https://kiosk.tech) framework.
4
4
 
5
5
  ## What is Kiosk
6
6
 
7
- Kiosk is the standards-based open protocol that lets your customers' AI assistants discover, transact with, and pay your service. Its Ruby reference implementation is a Rails engine: REST endpoint, multi-assistant identity per user, app-layer-authorized data plane with opt-in Postgres RLS defense-in-depth, AP2 mandate trail. Alpha. Apache-2.0.
7
+ Kiosk is the standards-based open protocol that lets the AI assistants of visitors and customers discover, transact with, and pay an operator's service. Its Ruby reference implementation is a Rails engine: one HTTP API, several assistants on one customer account, app-layer-authorized data plane with opt-in Postgres RLS defense-in-depth, AP2 mandate trail. Alpha. Apache-2.0.
8
8
 
9
9
  ## What is kiosk-core
10
10
 
11
11
  The foundation. Defines:
12
12
 
13
- - **Value types** — `Kiosk::Identity`, `Kiosk::Mandate` (intent / cart / payment)
13
+ - **Value types** — `Kiosk::Identity`, `Kiosk::Mandate::CheckoutMandate` and `Kiosk::Mandate::PaymentMandate` (the AP2 checkout and payment mandates)
14
14
  - **Abstract base classes** that adapter gems extend:
15
15
  - `Kiosk::AgentIdentityProviders::Base`
16
16
  - `Kiosk::UserIdentityProviders::Base`
@@ -18,13 +18,13 @@ The foundation. Defines:
18
18
  - `Kiosk::KycProviders::Base`
19
19
 
20
20
  An agent-IdP adapter's `agent_id` **must be a UUID string**: `Identity`
21
- checks only that it is present, but every `agent_id` column in the canonical
22
- Postgres schema and the `kiosk.current_agent_id()` helper are typed `uuid`,
21
+ checks only that it is present, but every `agent_id` column of the Kiosk tables
22
+ (and kiosk-rls's `kiosk_current_agent_id()`) is typed `uuid`,
23
23
  and there is no `user_id_type`-style knob for it. Map a foreign issuer's
24
24
  agent identifier onto a local uuid inside the adapter. `user_id`
25
25
  carries no such constraint — it follows `c.user_id_type` (`Kiosk.configuration.user_id_type`).
26
26
  - **Postgres GUC namespace constants** — `Kiosk::GUC`
27
- - **Canonical-uuid shape guard** — `Kiosk::UuidCheck` (`valid?`)
27
+ - **Canonical-uuid shape check** — `Kiosk::UuidCheck` (`valid?`)
28
28
  - **Protocol-version surface** — `Kiosk::Protocol` (API version, min client, response header names, default mount path)
29
29
  - **Configuration** — `Kiosk.configure { |c| ... }`
30
30
 
@@ -32,21 +32,19 @@ No Rails dependency. Loadable in any Ruby app. Heavier `kiosk-server`, `kiosk-rl
32
32
 
33
33
  ## Install
34
34
 
35
- > **Not on RubyGems yet** — so every `gem` line below carries `github: "kiosk-hq/kiosk"`, which is what makes it copy-pasteable today. Publication status and the canonical install are stated once, in the monorepo README's [Install](https://github.com/kiosk-hq/kiosk#install) section.
36
-
37
35
  ```ruby
38
- gem "kiosk-core", github: "kiosk-hq/kiosk"
36
+ gem "kiosk-core"
39
37
  ```
40
38
 
41
- For the data plane (core + server), install the meta-gem — add RLS, payment, and IdP adapters per stack:
39
+ For the data plane (core + server), install the meta-gem, then add RLS and the payment and identity adapters that your stack needs:
42
40
 
43
41
  ```ruby
44
- gem "kiosk-all", github: "kiosk-hq/kiosk"
42
+ gem "kiosk-all"
45
43
  ```
46
44
 
47
45
  ## Status
48
46
 
49
- Pre-v1.0 alpha. Wire-protocol semver stability begins at v1.0; pre-v1.0 minor bumps may break compatibility (CHANGELOG.md tracks).
47
+ Pre-v1.0 alpha. Protocol semver stability begins at v1.0; pre-v1.0 minor bumps may break compatibility (CHANGELOG.md tracks).
50
48
 
51
49
  ## License
52
50
 
@@ -5,8 +5,11 @@ module Kiosk
5
5
  # Base for an agent-IdP adapter fronting an external agent-identity issuer
6
6
  # (`c.agent_idp`). The engine calls only `verify`: it mints tokens and reads
7
7
  # mandate-signing keys through its bundled DefaultAgentIdp. The `agent_id` it
8
- # returns must be a uuid: every schema column and `kiosk.current_agent_id()`
9
- # are typed `uuid`, so map foreign ids.
8
+ # returns must be a uuid: every `agent_id` column and `kiosk_current_agent_id()`
9
+ # are typed `uuid`, so map foreign ids. The token comes as
10
+ # `Authorization: DPoP <token>`, and the identity's `claims` carry
11
+ # `cnf: { jkt: }`, the thumbprint of the key that must sign the request's
12
+ # DPoP proof (RFC 9449).
10
13
  class Base
11
14
  # @return [Kiosk::Identity, nil] nil when the credential is absent or invalid (the caller answers 401)
12
15
  def verify(_request)
@@ -3,42 +3,82 @@
3
3
  require 'uri'
4
4
 
5
5
  module Kiosk
6
- # Host-application settings, filled via `Kiosk.configure`. Defaults suit a greenfield
7
- # Rails app on the bundled agent-IdP; the provider supplies its own user
8
- # model and (optionally) a user-IdP adapter.
6
+ # The settings of an origin, set in `config/initializers/kiosk.rb` with
7
+ # `Kiosk.configure { |c| ... }`. Each setting below says what it does, its
8
+ # default and an example. kiosk-server and the adapter gems add more settings.
9
9
  class Configuration
10
- # Class name as a String, resolved at request time.
10
+ # The class name of your account model, as a String. Registration makes an
11
+ # account in it for each new assistant, and account binding finds the
12
+ # person's account in it. Required.
13
+ # c.user_model = 'User'
11
14
  attr_accessor :user_model
12
15
 
13
- # :uuid (default), :bigint, :integer or :text.
16
+ # The type of the primary key of `user_model`: :uuid, :bigint, :integer or
17
+ # :text. The kiosk tables and SQL functions store the account id in this
18
+ # type. Default :uuid. A table that Rails made with its default key is :bigint.
19
+ # c.user_id_type = :bigint
14
20
  attr_accessor :user_id_type
15
21
 
16
- # Nil in satellite mode: the provider's own frontend drives the wire endpoints.
22
+ # The adapter that tells which person is signed in on your own site, from
23
+ # the browser session. The account-binding pages read it: the page that
24
+ # makes a link code, the page that approves a device code, and the page
25
+ # that unlinks an assistant. Default nil: these pages refuse every person,
26
+ # so nobody can link an assistant to an account. With Devise, use the
27
+ # adapter of the kiosk-user-idp-devise gem.
28
+ # c.user_idp = Kiosk::UserIdentityProviders::Devise.new
17
29
  attr_accessor :user_idp
18
30
 
19
- # Nil uses kiosk-server's bundled DefaultAgentIdp; set only to front another agent-identity system.
31
+ # The adapter that verifies the access token of an assistant on each call.
32
+ # Default nil: kiosk-server verifies the tokens that its own token endpoint
33
+ # issues. Keep the default. Set it only when another system issues the
34
+ # tokens of the assistants. The value is a {Kiosk::AgentIdentityProviders::Base}.
35
+ # c.agent_idp = MyTokenVerifier.new
20
36
  attr_accessor :agent_idp
21
37
 
22
- # A {Kiosk::PaymentProviders::Base}; nil means no payment.
38
+ # The adapter that charges the card of a customer for a paid action, a
39
+ # {Kiosk::PaymentProviders::Base}. Default nil: the origin takes no money,
40
+ # and discovery does not list `pay`. The kiosk-pay-stripe gem gives Stripe.
41
+ # c.payment_provider = Kiosk::PaymentProviders::Stripe.new(api_key: ENV.fetch('STRIPE_SECRET_KEY'))
23
42
  attr_accessor :payment_provider
24
43
 
25
- # A {Kiosk::KycProviders::Base}; nil makes `request_kyc` answer `module_not_served`.
44
+ # The KYC service that confirms facts about a customer, for example an age
45
+ # over 18, a {Kiosk::KycProviders::Base}. Default nil: the action
46
+ # `request_kyc` answers `module_not_served`. The kiosk-kyc-proveli gem gives
47
+ # the Proveli broker.
48
+ # c.kyc_provider = Kiosk::KycProviders::Proveli.new(operator_id: 'shop',
49
+ # intake_secret: ENV.fetch('KIOSK_PROVELI_INTAKE_SECRET'), public_key: ENV.fetch('KIOSK_PROVELI_PUBLIC_KEY_PEM'))
26
50
  attr_accessor :kyc_provider
27
51
 
28
- # Runtime DB role named in kiosk-rls GRANTs and `SET LOCAL ROLE`; the DBA creates it.
52
+ # The Postgres role that the opt-in kiosk-rls gem gives table access to,
53
+ # and that kiosk-server changes to with `SET LOCAL ROLE` when
54
+ # `enforce_db_role` is true. Your database administrator makes the role.
55
+ # Default 'app_role'. Without kiosk-rls and with `enforce_db_role` false
56
+ # (the default), nothing reads it: do not set it.
57
+ # c.app_role = 'shop_app'
29
58
  attr_accessor :app_role
30
59
 
31
- # E.g. `%i[customer master support]`. Never `:admin`.
60
+ # The roles that an assistant can get, as Symbols. A token carries one of
61
+ # them, and your code reads it to decide what the assistant can do. Name a
62
+ # role by the job of a person (customer, support), not by a power (admin).
63
+ # Default []: no token carries a role. Most origins need one role,
64
+ # %i[customer]. kiosk-server's `registration_role` names the role that a
65
+ # new assistant gets.
66
+ # c.roles = %i[customer support]
32
67
  attr_accessor :roles
33
68
 
34
- # The default origin served: `iss` of tokens and mandates, required proof `aud`,
35
- # discovery `issuer`. Readers ask `Kiosk.current_issuer`.
69
+ # The origin of this deployment: scheme, host and port. It is the `iss` of
70
+ # the tokens and checkouts that the engine signs, the `aud` that the proof
71
+ # of an assistant must name, and the `issuer` of discovery. Required.
72
+ # Code reads it with `Kiosk.current_issuer`.
73
+ # c.issuer = 'https://shop.example'
36
74
  attr_accessor :issuer
37
75
 
38
- # Further origins, each a separate operator on the wire. Exact origins only;
39
- # an alias of the SAME business is better redirected
76
+ # More origins, each a separate operator for the protocol, with its own
77
+ # discovery and its own assistant accounts. Exact origins only. Default [].
78
+ # A second name of the SAME business is better redirected
40
79
  # to the issuer at the edge. (Rails' `config.hosts` governs which Host
41
80
  # headers are accepted, not which origin the operator is.)
81
+ # c.additional_origins = ['https://second-shop.example']
42
82
  attr_accessor :additional_origins
43
83
 
44
84
  def initialize
@@ -1,14 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kiosk
4
- # The principal making a request, as an IdP adapter's #verify returns it.
5
- # `actor` is "agent", "human" or "service"; `agent_id` is present iff the
6
- # actor is an agent and must be a uuid (the schema types it so, with no knob).
4
+ # The principal of a request, as the #verify of an identity adapter returns
5
+ # it. `actor` says who makes the request:
6
+ # "agent" — an AI assistant with an access token. kiosk-server makes it.
7
+ # "human" — a person signed in on the site of the operator. The `user_idp`
8
+ # adapter makes it, for example kiosk-user-idp-devise.
9
+ # The audit sink receives the actor of each action, and an RLS policy reads
10
+ # it with `kiosk_current_actor()` (kiosk-rls).
11
+ # `agent_id` is the UUID of the assistant: present for an agent, nil otherwise.
7
12
  Identity = Data.define(:user_id, :role, :actor, :agent_id, :claims)
8
13
 
9
14
  # Validates user_id, actor and agent_id on construction.
10
15
  class Identity
11
- VALID_ACTORS = %w[agent human service].freeze
16
+ VALID_ACTORS = %w[agent human].freeze
12
17
 
13
18
  def initialize(user_id:, role:, actor:, agent_id: nil, claims: {})
14
19
  actor = actor.to_s
@@ -1,18 +1,42 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'openssl'
4
+
3
5
  module Kiosk
4
6
  module KycProviders
5
7
  # The provider did not open a verification now; a later attempt may.
6
8
  class Unavailable < StandardError
7
9
  end
8
10
 
9
- # Port for a KYC provider (`kiosk-kyc-*`); kiosk-server serves `request_kyc`
10
- # whenever `Kiosk.configuration.kyc_provider` is set.
11
+ # The KYC provider an operator trusts, set as `Kiosk.configuration.kyc_provider`.
12
+ # It names the issuer, the Ed25519 key and the audience that the engine
13
+ # checks every attestation against. A `Base` accepts attestations at
14
+ # `POST <endpoint>/agents/kyc` only; an adapter (`kiosk-kyc-*`) that opens
15
+ # verifications also serves `request_kyc`.
11
16
  class Base
17
+ attr_reader :issuer, :public_key
18
+
19
+ # @param issuer [String] the `iss` the provider signs
20
+ # @param public_key [OpenSSL::PKey::PKey, String] its Ed25519 public key, or the key's PEM
21
+ # @param audience [String, nil] the `aud` it mints for this operator; nil: the origin being served
22
+ def initialize(issuer:, public_key:, audience: nil)
23
+ @issuer = issuer.to_s
24
+ @public_key = public_key.is_a?(String) ? OpenSSL::PKey.read(public_key) : public_key
25
+ @audience = audience
26
+ return if @public_key.is_a?(OpenSSL::PKey::PKey) && @public_key.oid == 'ED25519'
27
+
28
+ raise ArgumentError, "a KYC provider's public_key must be an Ed25519 key or its PEM, got #{@public_key.class}"
29
+ end
30
+
31
+ def audience = (@audience || Kiosk.current_issuer).to_s
32
+
33
+ # True when the provider opens verifications, so the engine serves `request_kyc`.
34
+ def opens_verifications? = false
35
+
12
36
  # The provider later POSTs `{request_id, nonce, kyc_jws}` to `callback_url`.
13
37
  # @return [Hash] `request_id:`, `verification_url:`, `nonce:`
14
38
  # @raise [Unavailable]
15
- def open_verification(subject:, claims:, audience:, callback_url:)
39
+ def open_verification(subject:, claims:, callback_url:)
16
40
  raise NotImplementedError, "#{self.class}#open_verification must be implemented by the adapter"
17
41
  end
18
42
 
data/lib/kiosk/mandate.rb CHANGED
@@ -2,21 +2,21 @@
2
2
 
3
3
  module Kiosk
4
4
  # AP2 (Agent Payments Protocol) mandate value objects.
5
- # Each is a JWS the assistant signs; its `iss` must equal the origin's issuer.
5
+ # Each is a closed AP2 v0.2 mandate: an SD-JWT the assistant signs with its
6
+ # registered key. `reference` is the base64url SHA-256 of the presented SD-JWT.
6
7
  module Mandate
7
- IntentMandate = Data.define(
8
- :id, :user_id, :agent_id, :issuer, :scope, :cap_amount_cents, :currency,
9
- :expires_at, :created_at, :raw_jws
10
- )
11
-
12
- CartMandate = Data.define(
13
- :id, :intent_mandate_id, :user_id, :agent_id, :issuer, :line_items,
14
- :total_amount_cents, :currency, :expires_at, :created_at, :raw_jws
8
+ # Binds the operator-signed checkout by `checkout_hash`; the line items,
9
+ # total and currency come from that checkout.
10
+ CheckoutMandate = Data.define(
11
+ :reference, :checkout_hash, :user_id, :agent_id, :issuer, :line_items,
12
+ :total_amount_cents, :currency, :expires_at, :sd_jwt
15
13
  )
16
14
 
15
+ # Pays for the checkout whose hash is `transaction_id`. `payment_instrument`
16
+ # is the instrument id: a PSP payment-method id, or `on_file`.
17
17
  PaymentMandate = Data.define(
18
- :id, :cart_mandate_id, :user_id, :agent_id, :issuer, :payment_method,
19
- :amount_cents, :currency, :expires_at, :created_at, :raw_jws
18
+ :reference, :transaction_id, :user_id, :agent_id, :issuer, :payment_instrument,
19
+ :amount_cents, :currency, :expires_at, :sd_jwt
20
20
  )
21
21
  end
22
22
  end
@@ -31,8 +31,11 @@ module Kiosk
31
31
  'whose setup_required? can answer true'
32
32
  end
33
33
 
34
- # @return [Hash] `psp_reference`, `settled_amount_cents`, `settled_at`
35
- def capture(_cart_mandate, payment_method:)
34
+ # @param checkout_mandate [Kiosk::Mandate::CheckoutMandate] what to charge, and its key
35
+ # @param payment_method [String, nil] the PSP payment-method id; nil charges the saved card
36
+ # @return [Hash] `psp_reference`, `settled_amount_cents`, `settled_at`, and
37
+ # `network_confirmation_id`: the card network's id of the charge, or nil when the PSP reports none
38
+ def capture(_checkout_mandate, payment_method:)
36
39
  raise NotImplementedError, "#{self.class}#capture must be implemented by the adapter"
37
40
  end
38
41
 
@@ -44,9 +47,10 @@ module Kiosk
44
47
  raise NotImplementedError, "#{self.class}#refund must be implemented by an adapter whose operator refunds"
45
48
  end
46
49
 
47
- # A repeat of a chain whose capture did not complete. The adapter keys its
48
- # capture by the cart mandate id, so a second capture cannot charge twice.
49
- def resume(cart_mandate, payment_method:) = capture(cart_mandate, payment_method:)
50
+ # A repeat of a pair of mandates whose capture did not complete. The adapter
51
+ # keys its capture by the checkout mandate's `reference`, so a second
52
+ # capture cannot charge twice.
53
+ def resume(checkout_mandate, payment_method:) = capture(checkout_mandate, payment_method:)
50
54
  end
51
55
  end
52
56
  end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kiosk
4
- # Wire-protocol version and header names.
4
+ # Protocol version and header names.
5
5
  module Protocol
6
6
  # Before 1.0 every gem and every pinned skill cut carry this exact version (spec §14.1).
7
- API_VERSION = '0.5.20'
7
+ API_VERSION = '0.6.28'
8
8
 
9
9
  # The oldest skill cut that works with this release: same MAJOR.MINOR as
10
10
  # API_VERSION, no newer (spec §3.6). Advisory.
11
- MIN_CLIENT = '0.5.20'
11
+ MIN_CLIENT = '0.6.0'
12
12
 
13
13
  HEADER_SERVER_VERSION = 'Kiosk-Server-Version'
14
14
  HEADER_API_VERSION = 'Kiosk-API-Version'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kiosk
4
- # Shape check for wire-supplied uuids, so a malformed id is a typed 4xx rather
4
+ # Shape check for request-supplied uuids, so a malformed id is a typed 4xx rather
5
5
  # than a 500 from Postgres or a false ownership refusal from Active Record's
6
6
  # NULL cast. Format only: it says nothing about whether the row exists.
7
7
  module UuidCheck
data/lib/kiosk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kiosk
4
- VERSION = '0.5.20'
4
+ VERSION = '0.6.28'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiosk-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.20
4
+ version: 0.6.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Pirozhkov