ap2_mandate_verifier 1.4.0 → 1.6.0
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 +31 -8
- data/README.md +31 -8
- data/SECURITY.md +8 -2
- data/docs/LONG_PAYMENT.md +82 -0
- data/docs/PAYMENT_ACCEPTANCE.md +90 -0
- data/docs/PAYMENT_POLICY.md +4 -2
- data/docs/PUBLIC_API.md +16 -2
- data/docs/RECURRING_PAYMENT.md +54 -0
- data/docs/RELEASE_140_CANDIDATE.md +2 -0
- data/docs/RELEASE_150_CANDIDATE.md +23 -0
- data/docs/RELEASE_160_CANDIDATE.md +30 -0
- data/docs/SUPPORT_CONTRACT.md +9 -1
- data/examples/conditional_checkout.rb +3 -3
- data/examples/long_payment.rb +116 -0
- data/examples/long_payment_acceptance.rb +89 -0
- data/examples/payment_acceptance.rb +77 -0
- data/examples/recurring_payment.rb +99 -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 +344 -0
- data/lib/ap2_mandate_verifier/payment_acceptance.rb +285 -0
- 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 +6 -0
- metadata +22 -5
|
@@ -48,13 +48,18 @@ module AP2MandateVerifier
|
|
|
48
48
|
open = root.fetch("delegate_payload").first
|
|
49
49
|
exact!(open, %w[cnf constraints exp iat vct])
|
|
50
50
|
raise Rejected, :unsupported_purchase_profile unless open["vct"] == "mandate.checkout.open.1"
|
|
51
|
-
times!(open, verified_at)
|
|
51
|
+
times!(open, verified_at, profile_ref: profile_ref)
|
|
52
52
|
exact!(open["cnf"], %w[jwk])
|
|
53
53
|
exact!(open["cnf"]["jwk"], %w[kty crv x y])
|
|
54
54
|
raise Rejected, :agent_key_mismatch unless open["cnf"]["jwk"] == RootSignature.public_jwk!(agent_pem)
|
|
55
55
|
|
|
56
56
|
terminal = RootSignature.verified_payload!(terminal_wire, agent_pem, expected_typ: "kb+sd-jwt")
|
|
57
|
-
|
|
57
|
+
fields = %w[aud delegate_payload iat nonce sd_hash]
|
|
58
|
+
if profile_ref == TrustContext::LONG_PROFILE_REF
|
|
59
|
+
fields += ["ap2_profile"]
|
|
60
|
+
raise Rejected, :unsupported_purchase_profile unless terminal["ap2_profile"] == profile_ref
|
|
61
|
+
end
|
|
62
|
+
exact!(terminal, fields)
|
|
58
63
|
raise Rejected, :root_binding_mismatch unless terminal["sd_hash"] == hash(root_wire)
|
|
59
64
|
raise Rejected, :audience_mismatch unless terminal["aud"] == aud
|
|
60
65
|
raise Rejected, :nonce_mismatch unless terminal["nonce"] == nonce
|
|
@@ -66,7 +71,7 @@ module AP2MandateVerifier
|
|
|
66
71
|
closed = payloads.first
|
|
67
72
|
exact!(closed, %w[checkout_hash checkout_jwt exp iat vct])
|
|
68
73
|
raise Rejected, :unsupported_purchase_profile unless closed["vct"] == "mandate.checkout.1"
|
|
69
|
-
times!(closed, verified_at)
|
|
74
|
+
times!(closed, verified_at, profile_ref: profile_ref)
|
|
70
75
|
# R06 fixed shared claims: no shortening or extending Issuer iat/exp.
|
|
71
76
|
raise Rejected, :delegation_claim_mismatch unless closed["iat"] == open["iat"] && closed["exp"] == open["exp"]
|
|
72
77
|
raise Rejected, :checkout_binding_mismatch unless closed["checkout_jwt"] == checkout_wire &&
|
|
@@ -90,11 +95,12 @@ module AP2MandateVerifier
|
|
|
90
95
|
raise RootSignature::Unavailable, :purchase_context_unavailable
|
|
91
96
|
end
|
|
92
97
|
|
|
93
|
-
def self.times!(claims, now)
|
|
98
|
+
def self.times!(claims, now, profile_ref: TrustContext::PROFILE_REF)
|
|
94
99
|
iat, exp = claims.values_at("iat", "exp")
|
|
100
|
+
limit = profile_ref == TrustContext::LONG_PROFILE_REF ? LongPayment::MAX_CONTENT_LIFETIME : 7_200
|
|
95
101
|
raise Rejected, :invalid_purchase_time unless integer?(iat) && integer?(exp) &&
|
|
96
102
|
iat.between?(0, MAX_EPOCH) && exp.between?(0, MAX_EPOCH) &&
|
|
97
|
-
iat <= now && now < exp && exp > iat && exp - iat <=
|
|
103
|
+
iat <= now && now < exp && exp > iat && exp - iat <= limit
|
|
98
104
|
end
|
|
99
105
|
|
|
100
106
|
def self.exact!(value, keys)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AP2MandateVerifier
|
|
4
|
+
# Narrow signed wire profile only. Aggregate occurrence/budget reservation
|
|
5
|
+
# belongs to the protected durable acceptance store, never to this verifier.
|
|
6
|
+
module RecurringPayment
|
|
7
|
+
PROFILE_REF = "ap2.payment.recurring.jpy_on_demand.complete.1".freeze
|
|
8
|
+
SELECTIVE_PROFILE_REF = "ap2.payment.recurring.jpy_on_demand.selective.1".freeze
|
|
9
|
+
TYPES = %w[payment.agent_recurrence payment.budget].freeze
|
|
10
|
+
MAX_OCCURRENCES = 1_000_000
|
|
11
|
+
class Invalid < ArgumentError
|
|
12
|
+
def initialize = super("invalid recurring payment information")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.profile?(profile) = [PROFILE_REF, SELECTIVE_PROFILE_REF].include?(profile)
|
|
16
|
+
def self.profile!(value)
|
|
17
|
+
profile = InputValidator.snapshot!(value, max_bytes: 256)
|
|
18
|
+
raise Invalid unless profile?(profile)
|
|
19
|
+
profile
|
|
20
|
+
end
|
|
21
|
+
def self.selective?(profile) = profile == SELECTIVE_PROFILE_REF
|
|
22
|
+
|
|
23
|
+
# Internal structural handoff only; it does not authenticate a signature.
|
|
24
|
+
def self.validated_open!(source, profile_ref:, complete:)
|
|
25
|
+
profile = profile!(profile_ref)
|
|
26
|
+
raise Invalid unless complete == true || complete == false
|
|
27
|
+
if selective?(profile)
|
|
28
|
+
parsed = SelectivePayment.send(:parse!, source, complete: complete, profile_ref: profile)
|
|
29
|
+
opening, wire, compact = parsed.values_at(:opening, :wire, :compact)
|
|
30
|
+
else
|
|
31
|
+
opening, wire = Payment.send(:root!, source, profile_ref: profile)
|
|
32
|
+
Payment.send(:open!, opening, profile_ref: profile)
|
|
33
|
+
compact = wire.split("~", -1).first
|
|
34
|
+
end
|
|
35
|
+
recurrence = opening.fetch("constraints").find { |c| c["type"] == TYPES[0] }
|
|
36
|
+
budget = opening.fetch("constraints").find { |c| c["type"] == TYPES[1] }
|
|
37
|
+
{opening: ResearchEvidence.send(:copy_frozen, opening), root_wire: compact.freeze,
|
|
38
|
+
presentation_wire: wire.freeze, reference: Payment.send(:digest, compact).freeze,
|
|
39
|
+
currency: "JPY".freeze, max_occurrences: recurrence.fetch("max_occurrences"), budget_max: budget.fetch("max"),
|
|
40
|
+
profile_ref: profile}.freeze
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Protected Host enrollment uses confidential complete issuance. The root
|
|
44
|
+
# reference covers the original JWS alone so leaf selection cannot reset it.
|
|
45
|
+
def self.approved_open!(open_sd_jwt:, profile_ref:, trusted_provider_public_key_pem:, expected_agent_public_key_pem:, verified_at:)
|
|
46
|
+
profile = profile!(profile_ref)
|
|
47
|
+
wire = InputValidator.snapshot!(open_sd_jwt, max_bytes: selective?(profile) ? SelectivePayment::MAX_WIRE : 32_769)
|
|
48
|
+
provider = InputValidator.snapshot!(trusted_provider_public_key_pem, max_bytes: 1024)
|
|
49
|
+
agent = InputValidator.snapshot!(expected_agent_public_key_pem, max_bytes: 1024)
|
|
50
|
+
CheckoutReceipt.send(:epoch!, verified_at)
|
|
51
|
+
# Authenticate the exact original compact JWS before parsing its graph.
|
|
52
|
+
RootSignature.verified_payload!(wire.split("~", -1).first, provider, max_bytes: 32_768)
|
|
53
|
+
parsed = validated_open!(wire, profile_ref: profile, complete: true)
|
|
54
|
+
opening = parsed.fetch(:opening)
|
|
55
|
+
Payment.send(:valid_now!, opening, verified_at)
|
|
56
|
+
raise Invalid unless opening.fetch("cnf") == {"jwk" => RootSignature.public_jwk!(agent)}
|
|
57
|
+
parsed
|
|
58
|
+
rescue StandardError, LoadError
|
|
59
|
+
raise Invalid.new, cause: nil
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.constraints!(opening)
|
|
63
|
+
raise Invalid unless opening.instance_of?(Hash)
|
|
64
|
+
cs = opening.fetch("constraints")
|
|
65
|
+
raise Invalid unless cs.instance_of?(Array) && cs.size == 6 && cs.all? { |c| c.instance_of?(Hash) }
|
|
66
|
+
recurrence = cs.select { |c| c["type"] == TYPES[0] }
|
|
67
|
+
budget = cs.select { |c| c["type"] == TYPES[1] }
|
|
68
|
+
raise Invalid unless recurrence.size == 1 && budget.size == 1
|
|
69
|
+
recurrence, budget = recurrence.first, budget.first
|
|
70
|
+
Payment.send(:exact!, recurrence, %w[type frequency max_occurrences])
|
|
71
|
+
Payment.send(:exact!, budget, %w[type max currency])
|
|
72
|
+
raise Invalid unless recurrence["frequency"] == "ON_DEMAND" && integer?(recurrence["max_occurrences"]) &&
|
|
73
|
+
recurrence["max_occurrences"].between?(1, MAX_OCCURRENCES) && budget["currency"] == "JPY" &&
|
|
74
|
+
integer?(budget["max"]) && budget["max"].between?(1, ScopedConstraints::MAX_AMOUNT)
|
|
75
|
+
amount = cs.select { |c| c["type"] == "payment.amount_range" }
|
|
76
|
+
raise Invalid unless amount.size == 1 && amount.first["currency"] == "JPY"
|
|
77
|
+
# This only detects an impossible individual payment, not aggregate use.
|
|
78
|
+
raise Invalid if integer?(amount.first.fetch("min", 0)) && amount.first.fetch("min", 0) > budget["max"]
|
|
79
|
+
if opening.key?("payment_amount")
|
|
80
|
+
Payment.send(:amount!, opening["payment_amount"])
|
|
81
|
+
raise Invalid unless opening["payment_amount"]["currency"] == "JPY" && opening["payment_amount"]["amount"] <= budget["max"]
|
|
82
|
+
end
|
|
83
|
+
opening.merge("constraints" => cs.reject { |c| TYPES.include?(c["type"]) })
|
|
84
|
+
end
|
|
85
|
+
def self.conditions!(opening, closed)
|
|
86
|
+
base = constraints!(opening)
|
|
87
|
+
budget = opening.fetch("constraints").find { |c| c["type"] == TYPES[1] }
|
|
88
|
+
raise Invalid unless closed.fetch("payment_amount").fetch("currency") == "JPY" && closed["payment_amount"]["amount"] <= budget.fetch("max")
|
|
89
|
+
Payment.send(:conditions!, base, closed)
|
|
90
|
+
end
|
|
91
|
+
def self.integer?(value) = Object.instance_method(:instance_of?).bind_call(value, Integer)
|
|
92
|
+
|
|
93
|
+
# Same raw public lifecycle as Payment/SelectivePayment. No direct Closed
|
|
94
|
+
# issuance is exposed because the mandatory limits belong to signed Open.
|
|
95
|
+
%i[details issue_open issue_closed present verify select].each do |name|
|
|
96
|
+
define_singleton_method(name) do |profile_ref: PROFILE_REF, **arguments|
|
|
97
|
+
profile = profile!(profile_ref)
|
|
98
|
+
if name == :details
|
|
99
|
+
next Payment.details(**arguments, profile_ref: PROFILE_REF)
|
|
100
|
+
end
|
|
101
|
+
raise Invalid if name == :select && !selective?(profile)
|
|
102
|
+
api = selective?(profile) ? SelectivePayment : Payment
|
|
103
|
+
api.public_send(name, **arguments, profile_ref: profile)
|
|
104
|
+
rescue StandardError, LoadError
|
|
105
|
+
next Payment::Verification.send(:new) if name == :verify
|
|
106
|
+
raise Invalid.new, cause: nil
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
private_class_method :profile!, :validated_open!, :constraints!, :conditions!, :integer?
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -30,7 +30,8 @@ module AP2MandateVerifier
|
|
|
30
30
|
raise Rejected.new(:unsupported_disclosure_profile), cause: nil
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
|
-
|
|
33
|
+
long = profile_ref == TrustContext::LONG_PROFILE_REF
|
|
34
|
+
multi = long || profile_ref == "ap2.checkout.single_merchant_multi_item"
|
|
34
35
|
raise Rejected, :unsupported_disclosure_profile unless multi || profile_ref == TrustContext::PROFILE_REF
|
|
35
36
|
wire = InputValidator.snapshot!(source)
|
|
36
37
|
raise Rejected, :invalid_root_presentation unless wire.ascii_only? && wire.end_with?("~")
|
|
@@ -39,12 +40,13 @@ module AP2MandateVerifier
|
|
|
39
40
|
parts.last == "" && !parts.first.empty? && parts[1...-1].none?(&:empty?)
|
|
40
41
|
# No disclosure decode, digest graph or trusted claims before signature.
|
|
41
42
|
payload = RootSignature.verified_payload!(parts.first, issuer_pem)
|
|
42
|
-
resolve!(parts, payload, multi)
|
|
43
|
+
resolve!(parts, payload, multi, marker_profile: long ? profile_ref : nil)
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
# Internal structural restoration only. Never authenticates an issuer.
|
|
46
47
|
# Shares the exact closure walker with the authenticated verification path.
|
|
47
|
-
def self.structural_root!(source)
|
|
48
|
+
def self.structural_root!(source, profile_ref: nil)
|
|
49
|
+
raise Rejected, :unsupported_disclosure_profile unless profile_ref.nil? || profile_ref == TrustContext::LONG_PROFILE_REF
|
|
48
50
|
wire = InputValidator.snapshot!(source)
|
|
49
51
|
raise Rejected, :invalid_root_presentation unless wire.ascii_only? && wire.end_with?("~")
|
|
50
52
|
parts = wire.split("~", -1)
|
|
@@ -57,13 +59,14 @@ module AP2MandateVerifier
|
|
|
57
59
|
CheckoutReceipt.send(:header!, header, "example+sd-jwt")
|
|
58
60
|
raise Rejected, :invalid_root_presentation unless RootSignature.send(:decode!, jwt[2], 64).bytesize == 64
|
|
59
61
|
payload = InputValidator.parse!(RootSignature.send(:decode!, jwt[1], 24_576))
|
|
60
|
-
resolve!(parts, payload, true)
|
|
62
|
+
resolve!(parts, payload, true, marker_profile: profile_ref)
|
|
61
63
|
end
|
|
62
64
|
|
|
63
|
-
def self.resolve!(parts, payload, multi)
|
|
65
|
+
def self.resolve!(parts, payload, multi, marker_profile: nil)
|
|
64
66
|
raise Rejected, :unsupported_disclosure_profile unless
|
|
65
67
|
payload.instance_of?(Hash) &&
|
|
66
|
-
(payload.keys - %w[delegate_payload _sd_alg]).empty? &&
|
|
68
|
+
(payload.keys - (marker_profile ? %w[delegate_payload _sd_alg ap2_profile] : %w[delegate_payload _sd_alg])).empty? &&
|
|
69
|
+
(!marker_profile || payload["ap2_profile"] == marker_profile) &&
|
|
67
70
|
(!payload.key?("_sd_alg") || payload["_sd_alg"] == "sha-256") &&
|
|
68
71
|
payload["delegate_payload"].instance_of?(Array) && payload["delegate_payload"].size == 1
|
|
69
72
|
require "digest"
|
|
@@ -29,7 +29,7 @@ module AP2MandateVerifier
|
|
|
29
29
|
raise RootSignature::Unavailable, :constraint_context_unavailable unless
|
|
30
30
|
CURRENCIES.include?(currency) && CORE_INSTANCE_OF.bind_call(expected_total_minor, Integer) &&
|
|
31
31
|
expected_total_minor.between?(0, MAX_AMOUNT)
|
|
32
|
-
if [MULTI_PROFILE_REF, TrustContext::SELECTIVE_PROFILE_REF].include?(profile_ref)
|
|
32
|
+
if [MULTI_PROFILE_REF, TrustContext::SELECTIVE_PROFILE_REF, TrustContext::LONG_PROFILE_REF].include?(profile_ref)
|
|
33
33
|
details = PurchaseBinding.verified_details!(**binding_inputs, profile_ref: profile_ref)
|
|
34
34
|
multi_constraints!(details, currency, expected_total_minor)
|
|
35
35
|
return details
|
|
@@ -97,7 +97,7 @@ module AP2MandateVerifier
|
|
|
97
97
|
Payment.send(:text!, aud, 512); Payment.send(:text!, challenge, 512)
|
|
98
98
|
claims = {"delegate_payload" => [closed], "iat" => verified_at, "aud" => aud, "nonce" => challenge,
|
|
99
99
|
"sd_hash" => digest(parsed.fetch(:wire))}
|
|
100
|
-
claims["ap2_profile"] = profile_ref if PaymentPolicy.
|
|
100
|
+
claims["ap2_profile"] = profile_ref if PaymentPolicy.marked?(profile_ref)
|
|
101
101
|
Payment.send(:preflight!, claims, "kb+sd-jwt", profile_ref: profile_ref)
|
|
102
102
|
terminal = MerchantSignature.sign!(claims, signer, agent, typ: "kb+sd-jwt")
|
|
103
103
|
Payment::Presentation.send(:new, parsed.fetch(:wire), terminal + "~")
|
|
@@ -12,6 +12,10 @@ module AP2MandateVerifier
|
|
|
12
12
|
MULTI_PROFILE_VERSION = "1"
|
|
13
13
|
MULTI_PROFILE_BODY = '{"profile_ref":"ap2.checkout.single_merchant_multi_item","version":"1","ap2_source":"b4587ac1d055888a73b4b21750973cffba961793","algorithm":"ES256","key_format":"canonical-public-SPKI-P256-SHA256","root_type":"example+sd-jwt","terminal_type":"kb+sd-jwt","checkout_type":"JWT","disclosure_path_semantics":"root-walker-with-synthetic-disclosed-edges","disclosure_positions":["delegate_payload[0]","delegate_payload[0].disclosed.constraints[0].items[*].acceptable_items[*]","delegate_payload[0].disclosed.constraints[1].allowed[0]"],"constraints":["checkout.line_items","checkout.allowed_merchants"],"max_disclosures":66,"max_disclosure_segment_bytes":8192,"max_root_bytes":131072,"max_graph_nodes":2048,"max_graph_depth":24,"max_array_entries":16,"max_line_items":8,"max_requirements":8,"max_candidates_per_requirement":8,"quantity_matching":"integer-max-flow-product-id-exact-coverage","duplicate_line_ids":"reject","duplicate_requirement_ids":"reject","same_product_multiple_lines":"allow","amount_model":"integer-minor-unit-no-tax-shipping-discount"}'.freeze
|
|
14
14
|
MULTI_PROFILE_HASH = Digest::SHA256.hexdigest(MULTI_PROFILE_BODY).freeze
|
|
15
|
+
LONG_PROFILE_REF = "ap2.checkout.long_open.multi_item.1".freeze
|
|
16
|
+
LONG_PROFILE_VERSION = "1".freeze
|
|
17
|
+
LONG_PROFILE_BODY = '{"profile_ref":"ap2.checkout.long_open.multi_item.1","version":"1","ap2_source":"b4587ac1d055888a73b4b21750973cffba961793","algorithm":"ES256","root_type":"example+sd-jwt","terminal_type":"kb+sd-jwt","checkout_type":"JWT","signed_profile_marker":"ap2_profile","disclosure_positions":["delegate_payload[0]","delegate_payload[0].disclosed.constraints[0].items[*].acceptable_items[*]","delegate_payload[0].disclosed.constraints[1].allowed[0]"],"constraints":["checkout.line_items","checkout.allowed_merchants"],"max_content_seconds":34560000,"shared_content_iat_exp":"exact-open-closed","outer_proof_age_seconds":300,"max_disclosures":66,"max_disclosure_segment_bytes":8192,"max_root_bytes":131072,"max_graph_nodes":2048,"max_graph_depth":24,"max_line_items":8,"max_requirements":8,"max_candidates_per_requirement":8,"quantity_matching":"integer-max-flow-product-id-exact-coverage","merchant_selection":"single-complete","amount_model":"integer-minor-unit-no-tax-shipping-discount"}'.freeze
|
|
18
|
+
LONG_PROFILE_HASH = Digest::SHA256.hexdigest(LONG_PROFILE_BODY).freeze
|
|
15
19
|
SELECTIVE_PROFILE_REF = "ap2.checkout.selective_candidates.1".freeze
|
|
16
20
|
SELECTIVE_PROFILE_VERSION = "1".freeze
|
|
17
21
|
SELECTIVE_PROFILE_BODY = '{"profile_ref":"ap2.checkout.selective_candidates.1","version":"1","ap2_source":"b4587ac1d055888a73b4b21750973cffba961793","algorithm":"ES256","root_type":"example+sd-jwt","terminal_type":"kb+sd-jwt","checkout_type":"JWT","signed_profile_marker":"ap2_profile","mandatory_content":"all-requirements-id-quantity-cnf-iat-exp","selective_positions":["constraints[0].items[*].acceptable_items[*]","constraints[1].allowed[*]"],"max_disclosures":73,"max_disclosure_segment_bytes":8192,"max_root_bytes":131072,"max_requirements":8,"max_candidates_per_requirement":8,"max_merchants":8,"merchant_selection":"exactly-one","item_selection":"nonempty-subset-per-requirement","candidate_policy":"independent-lists-no-correlation","quantity_matching":"integer-max-flow-product-id-exact-coverage","amount_model":"integer-minor-unit-no-tax-shipping-discount"}'.freeze
|
|
@@ -24,6 +28,8 @@ module AP2MandateVerifier
|
|
|
24
28
|
{ref: PROFILE_REF, version: PROFILE_VERSION, body: PROFILE_BODY, hash: PROFILE_HASH}.freeze
|
|
25
29
|
when MULTI_PROFILE_REF
|
|
26
30
|
{ref: MULTI_PROFILE_REF, version: MULTI_PROFILE_VERSION, body: MULTI_PROFILE_BODY, hash: MULTI_PROFILE_HASH}.freeze
|
|
31
|
+
when LONG_PROFILE_REF
|
|
32
|
+
{ref: LONG_PROFILE_REF, version: LONG_PROFILE_VERSION, body: LONG_PROFILE_BODY, hash: LONG_PROFILE_HASH}.freeze
|
|
27
33
|
when SELECTIVE_PROFILE_REF
|
|
28
34
|
{ref: SELECTIVE_PROFILE_REF, version: SELECTIVE_PROFILE_VERSION, body: SELECTIVE_PROFILE_BODY, hash: SELECTIVE_PROFILE_HASH}.freeze
|
|
29
35
|
else
|
data/lib/ap2_mandate_verifier.rb
CHANGED
|
@@ -20,6 +20,12 @@ require_relative "ap2_mandate_verifier/payment_receipt"
|
|
|
20
20
|
require_relative "ap2_mandate_verifier/selective_payment"
|
|
21
21
|
require_relative "ap2_mandate_verifier/selective_checkout"
|
|
22
22
|
require_relative "ap2_mandate_verifier/payment_policy"
|
|
23
|
+
require_relative "ap2_mandate_verifier/recurring_payment"
|
|
24
|
+
require_relative "ap2_mandate_verifier/long_payment"
|
|
25
|
+
require_relative "ap2_mandate_verifier/payment_acceptance"
|
|
26
|
+
require_relative "ap2_mandate_verifier/payment_acceptance/sqlite_store"
|
|
27
|
+
require_relative "ap2_mandate_verifier/payment_acceptance/recurring_sqlite_store"
|
|
28
|
+
require_relative "ap2_mandate_verifier/payment_acceptance/long_sqlite_store"
|
|
23
29
|
|
|
24
30
|
module AP2MandateVerifier
|
|
25
31
|
# Accepts original JSON bytes only. Syntax validity is not AP2 validity,
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ap2_mandate_verifier
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- AP2 Mandate Verifier contributors
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-11-
|
|
10
|
+
date: 2026-11-05 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: json
|
|
@@ -82,9 +82,11 @@ dependencies:
|
|
|
82
82
|
description: 'Framework-independent Ruby SDK for supported AP2 Checkout profiles:
|
|
83
83
|
Merchant JWT signing, Direct and conditional Mandate issuance and presentation,
|
|
84
84
|
full verification with immutable Evidence, Checkout Receipts, Direct and conditional
|
|
85
|
-
Payment Mandates, and Payment Receipts. Adds
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
Payment Mandates, and Payment Receipts. Adds selective Checkout/Payment, PISP/date
|
|
86
|
+
constraints opt-in transactional Payment acceptance/idempotency support and explicit
|
|
87
|
+
bounded JPY/ON_DEMAND quotas and separate long Open UTC-monthly JPY profiles with
|
|
88
|
+
protected current authority and Root/key continuity. Requires independently trusted
|
|
89
|
+
application inputs; verification does not grant purchase or payment permission.'
|
|
88
90
|
executables: []
|
|
89
91
|
extensions: []
|
|
90
92
|
extra_rdoc_files: []
|
|
@@ -98,25 +100,34 @@ files:
|
|
|
98
100
|
- docs/DIAGNOSTICS.ja.md
|
|
99
101
|
- docs/DIAGNOSTICS.md
|
|
100
102
|
- docs/INPUT_BUILDER.md
|
|
103
|
+
- docs/LONG_PAYMENT.md
|
|
101
104
|
- docs/MERCHANT_SIGNING.md
|
|
102
105
|
- docs/MULTI_ITEM_CHECKOUT.md
|
|
103
106
|
- docs/PAYMENT.md
|
|
107
|
+
- docs/PAYMENT_ACCEPTANCE.md
|
|
104
108
|
- docs/PAYMENT_POLICY.md
|
|
105
109
|
- docs/POST_RELEASE_110.md
|
|
106
110
|
- docs/POST_RELEASE_MAINTENANCE.md
|
|
107
111
|
- docs/PUBLIC_API.md
|
|
112
|
+
- docs/RECURRING_PAYMENT.md
|
|
108
113
|
- docs/RELEASE_100_CANDIDATE.md
|
|
109
114
|
- docs/RELEASE_110_CANDIDATE.md
|
|
110
115
|
- docs/RELEASE_120_CANDIDATE.md
|
|
111
116
|
- docs/RELEASE_130_CANDIDATE.md
|
|
112
117
|
- docs/RELEASE_140_CANDIDATE.md
|
|
118
|
+
- docs/RELEASE_150_CANDIDATE.md
|
|
119
|
+
- docs/RELEASE_160_CANDIDATE.md
|
|
113
120
|
- docs/SELECTIVE_CHECKOUT.md
|
|
114
121
|
- docs/SELECTIVE_PAYMENT.md
|
|
115
122
|
- docs/SUPPORT_CONTRACT.md
|
|
116
123
|
- docs/evidence/1.1.0_publication.json
|
|
117
124
|
- examples/conditional_checkout.rb
|
|
125
|
+
- examples/long_payment.rb
|
|
126
|
+
- examples/long_payment_acceptance.rb
|
|
118
127
|
- examples/payment.rb
|
|
128
|
+
- examples/payment_acceptance.rb
|
|
119
129
|
- examples/payment_policy.rb
|
|
130
|
+
- examples/recurring_payment.rb
|
|
120
131
|
- examples/selective_checkout.rb
|
|
121
132
|
- examples/selective_checkout_payment.rb
|
|
122
133
|
- examples/selective_payment.rb
|
|
@@ -129,11 +140,17 @@ files:
|
|
|
129
140
|
- lib/ap2_mandate_verifier/host_binding.rb
|
|
130
141
|
- lib/ap2_mandate_verifier/input_builder.rb
|
|
131
142
|
- lib/ap2_mandate_verifier/input_validator.rb
|
|
143
|
+
- lib/ap2_mandate_verifier/long_payment.rb
|
|
132
144
|
- lib/ap2_mandate_verifier/merchant_signature.rb
|
|
133
145
|
- lib/ap2_mandate_verifier/payment.rb
|
|
146
|
+
- lib/ap2_mandate_verifier/payment_acceptance.rb
|
|
147
|
+
- lib/ap2_mandate_verifier/payment_acceptance/long_sqlite_store.rb
|
|
148
|
+
- lib/ap2_mandate_verifier/payment_acceptance/recurring_sqlite_store.rb
|
|
149
|
+
- lib/ap2_mandate_verifier/payment_acceptance/sqlite_store.rb
|
|
134
150
|
- lib/ap2_mandate_verifier/payment_policy.rb
|
|
135
151
|
- lib/ap2_mandate_verifier/payment_receipt.rb
|
|
136
152
|
- lib/ap2_mandate_verifier/purchase_binding.rb
|
|
153
|
+
- lib/ap2_mandate_verifier/recurring_payment.rb
|
|
137
154
|
- lib/ap2_mandate_verifier/research_result.rb
|
|
138
155
|
- lib/ap2_mandate_verifier/result.rb
|
|
139
156
|
- lib/ap2_mandate_verifier/root_disclosures.rb
|