agentic-commerce-protocol 0.1.2 → 0.1.5
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/lib/agentic_commerce_protocol/models/address.rb +67 -0
- data/lib/agentic_commerce_protocol/models/allowance.rb +67 -0
- data/lib/agentic_commerce_protocol/models/allowance_reason.rb +28 -0
- data/lib/agentic_commerce_protocol/models/buyer.rb +58 -0
- data/lib/agentic_commerce_protocol/models/card_funding_type.rb +30 -0
- data/lib/agentic_commerce_protocol/models/card_number_type.rb +29 -0
- data/lib/agentic_commerce_protocol/models/check_performed_type.rb +31 -0
- data/lib/agentic_commerce_protocol/models/checkout_session.rb +113 -0
- data/lib/agentic_commerce_protocol/models/checkout_session_complete_request.rb +52 -0
- data/lib/agentic_commerce_protocol/models/checkout_session_create_request.rb +61 -0
- data/lib/agentic_commerce_protocol/models/checkout_session_status.rb +32 -0
- data/lib/agentic_commerce_protocol/models/checkout_session_update_request.rb +70 -0
- data/lib/agentic_commerce_protocol/models/content_type.rb +29 -0
- data/lib/agentic_commerce_protocol/models/delegate_payment_request.rb +64 -0
- data/lib/agentic_commerce_protocol/models/delegate_payment_response.rb +55 -0
- data/lib/agentic_commerce_protocol/models/error.rb +58 -0
- data/lib/agentic_commerce_protocol/models/error_code.rb +33 -0
- data/lib/agentic_commerce_protocol/models/error_type.rb +31 -0
- data/lib/agentic_commerce_protocol/models/event_data_order.rb +64 -0
- data/lib/agentic_commerce_protocol/models/fulfillment_option.rb +89 -0
- data/lib/agentic_commerce_protocol/models/fulfillment_option_digital.rb +64 -0
- data/lib/agentic_commerce_protocol/models/fulfillment_option_shipping.rb +89 -0
- data/lib/agentic_commerce_protocol/models/item.rb +52 -0
- data/lib/agentic_commerce_protocol/models/line_item.rb +67 -0
- data/lib/agentic_commerce_protocol/models/link.rb +52 -0
- data/lib/agentic_commerce_protocol/models/link_type.rb +30 -0
- data/lib/agentic_commerce_protocol/models/message.rb +89 -0
- data/lib/agentic_commerce_protocol/models/message_error.rb +58 -0
- data/lib/agentic_commerce_protocol/models/message_info.rb +55 -0
- data/lib/agentic_commerce_protocol/models/order.rb +58 -0
- data/lib/agentic_commerce_protocol/models/payment_data.rb +58 -0
- data/lib/agentic_commerce_protocol/models/payment_method_card.rb +124 -0
- data/lib/agentic_commerce_protocol/models/payment_method_type.rb +28 -0
- data/lib/agentic_commerce_protocol/models/payment_provider.rb +57 -0
- data/lib/agentic_commerce_protocol/models/payment_provider_type.rb +28 -0
- data/lib/agentic_commerce_protocol/models/refund.rb +52 -0
- data/lib/agentic_commerce_protocol/models/refund_type.rb +29 -0
- data/lib/agentic_commerce_protocol/models/risk_signal.rb +55 -0
- data/lib/agentic_commerce_protocol/models/risk_signal_action.rb +30 -0
- data/lib/agentic_commerce_protocol/models/risk_signal_type.rb +28 -0
- data/lib/agentic_commerce_protocol/models/total.rb +55 -0
- data/lib/agentic_commerce_protocol/models/total_type.rb +35 -0
- data/lib/agentic_commerce_protocol/models/webhook_event.rb +52 -0
- data/lib/agentic_commerce_protocol/models/webhook_event_type.rb +29 -0
- data/lib/agentic_commerce_protocol/models/webhook_order_status.rb +33 -0
- data/lib/agentic_commerce_protocol/util.rb +70 -0
- data/lib/agentic_commerce_protocol/version.rb +2 -1
- data/lib/agentic_commerce_protocol.rb +50 -6
- metadata +48 -3
- data/lib/agentic_commerce_protocol/types.rb +0 -13
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module AgenticCommerceProtocol
|
|
4
|
+
class PaymentProviderType
|
|
5
|
+
STRIPE = "stripe".freeze
|
|
6
|
+
|
|
7
|
+
def self.all_vars
|
|
8
|
+
@all_vars ||= [STRIPE].freeze
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(value)
|
|
12
|
+
unless PaymentProviderType.all_vars.include?(value)
|
|
13
|
+
raise "Invalid ENUM value '#{value}' for class #PaymentProviderType"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
@value = value
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.deserialize(value)
|
|
20
|
+
return value if PaymentProviderType.all_vars.include?(value)
|
|
21
|
+
raise "Invalid ENUM value '#{value}' for class #PaymentProviderType"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def serialize
|
|
25
|
+
@value
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module AgenticCommerceProtocol
|
|
6
|
+
class Refund
|
|
7
|
+
attr_accessor :type
|
|
8
|
+
attr_accessor :amount
|
|
9
|
+
|
|
10
|
+
ALL_FIELD ||= ["type", "amount"].freeze
|
|
11
|
+
private_constant :ALL_FIELD
|
|
12
|
+
|
|
13
|
+
def initialize(attributes = {})
|
|
14
|
+
unless attributes.is_a?(Hash)
|
|
15
|
+
fail(
|
|
16
|
+
ArgumentError,
|
|
17
|
+
"The input argument (attributes) must be a hash in `AgenticCommerceProtocol::Refund` new method"
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
attributes.each do |k, v|
|
|
22
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
23
|
+
fail(ArgumentError, "The field #{k} is not part of AgenticCommerceProtocol::Refund")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
instance_variable_set("@#{k}", v)
|
|
27
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.deserialize(attributes = {})
|
|
32
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
33
|
+
attrs = Hash.new
|
|
34
|
+
attrs["type"] = AgenticCommerceProtocol::RefundType.deserialize(attributes["type"])
|
|
35
|
+
attrs["amount"] = attributes["amount"]
|
|
36
|
+
new(attrs)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def serialize
|
|
40
|
+
out = Hash.new
|
|
41
|
+
out["type"] = AgenticCommerceProtocol::serialize_schema_ref(@type) if @type
|
|
42
|
+
out["amount"] = AgenticCommerceProtocol::serialize_primitive(@amount) if @amount
|
|
43
|
+
out
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Serializes the object to a json string
|
|
47
|
+
# @return String
|
|
48
|
+
def to_json
|
|
49
|
+
JSON.dump(serialize)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module AgenticCommerceProtocol
|
|
4
|
+
class RefundType
|
|
5
|
+
STORE_CREDIT = "store_credit".freeze
|
|
6
|
+
ORIGINAL_PAYMENT = "original_payment".freeze
|
|
7
|
+
|
|
8
|
+
def self.all_vars
|
|
9
|
+
@all_vars ||= [STORE_CREDIT, ORIGINAL_PAYMENT].freeze
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def initialize(value)
|
|
13
|
+
unless RefundType.all_vars.include?(value)
|
|
14
|
+
raise "Invalid ENUM value '#{value}' for class #RefundType"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@value = value
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.deserialize(value)
|
|
21
|
+
return value if RefundType.all_vars.include?(value)
|
|
22
|
+
raise "Invalid ENUM value '#{value}' for class #RefundType"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def serialize
|
|
26
|
+
@value
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module AgenticCommerceProtocol
|
|
6
|
+
class RiskSignal
|
|
7
|
+
attr_accessor :type
|
|
8
|
+
attr_accessor :score
|
|
9
|
+
attr_accessor :action
|
|
10
|
+
|
|
11
|
+
ALL_FIELD ||= ["type", "score", "action"].freeze
|
|
12
|
+
private_constant :ALL_FIELD
|
|
13
|
+
|
|
14
|
+
def initialize(attributes = {})
|
|
15
|
+
unless attributes.is_a?(Hash)
|
|
16
|
+
fail(
|
|
17
|
+
ArgumentError,
|
|
18
|
+
"The input argument (attributes) must be a hash in `AgenticCommerceProtocol::RiskSignal` new method"
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
attributes.each do |k, v|
|
|
23
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
24
|
+
fail(ArgumentError, "The field #{k} is not part of AgenticCommerceProtocol::RiskSignal")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
instance_variable_set("@#{k}", v)
|
|
28
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.deserialize(attributes = {})
|
|
33
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
34
|
+
attrs = Hash.new
|
|
35
|
+
attrs["type"] = AgenticCommerceProtocol::RiskSignalType.deserialize(attributes["type"])
|
|
36
|
+
attrs["score"] = attributes["score"]
|
|
37
|
+
attrs["action"] = AgenticCommerceProtocol::RiskSignalAction.deserialize(attributes["action"])
|
|
38
|
+
new(attrs)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def serialize
|
|
42
|
+
out = Hash.new
|
|
43
|
+
out["type"] = AgenticCommerceProtocol::serialize_schema_ref(@type) if @type
|
|
44
|
+
out["score"] = AgenticCommerceProtocol::serialize_primitive(@score) if @score
|
|
45
|
+
out["action"] = AgenticCommerceProtocol::serialize_schema_ref(@action) if @action
|
|
46
|
+
out
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Serializes the object to a json string
|
|
50
|
+
# @return String
|
|
51
|
+
def to_json
|
|
52
|
+
JSON.dump(serialize)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module AgenticCommerceProtocol
|
|
4
|
+
class RiskSignalAction
|
|
5
|
+
BLOCKED = "blocked".freeze
|
|
6
|
+
MANUAL_REVIEW = "manual_review".freeze
|
|
7
|
+
AUTHORIZED = "authorized".freeze
|
|
8
|
+
|
|
9
|
+
def self.all_vars
|
|
10
|
+
@all_vars ||= [BLOCKED, MANUAL_REVIEW, AUTHORIZED].freeze
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def initialize(value)
|
|
14
|
+
unless RiskSignalAction.all_vars.include?(value)
|
|
15
|
+
raise "Invalid ENUM value '#{value}' for class #RiskSignalAction"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
@value = value
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.deserialize(value)
|
|
22
|
+
return value if RiskSignalAction.all_vars.include?(value)
|
|
23
|
+
raise "Invalid ENUM value '#{value}' for class #RiskSignalAction"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def serialize
|
|
27
|
+
@value
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module AgenticCommerceProtocol
|
|
4
|
+
class RiskSignalType
|
|
5
|
+
CARD_TESTING = "card_testing".freeze
|
|
6
|
+
|
|
7
|
+
def self.all_vars
|
|
8
|
+
@all_vars ||= [CARD_TESTING].freeze
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(value)
|
|
12
|
+
unless RiskSignalType.all_vars.include?(value)
|
|
13
|
+
raise "Invalid ENUM value '#{value}' for class #RiskSignalType"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
@value = value
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.deserialize(value)
|
|
20
|
+
return value if RiskSignalType.all_vars.include?(value)
|
|
21
|
+
raise "Invalid ENUM value '#{value}' for class #RiskSignalType"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def serialize
|
|
25
|
+
@value
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module AgenticCommerceProtocol
|
|
6
|
+
class Total
|
|
7
|
+
attr_accessor :type
|
|
8
|
+
attr_accessor :display_text
|
|
9
|
+
attr_accessor :amount
|
|
10
|
+
|
|
11
|
+
ALL_FIELD ||= ["type", "display_text", "amount"].freeze
|
|
12
|
+
private_constant :ALL_FIELD
|
|
13
|
+
|
|
14
|
+
def initialize(attributes = {})
|
|
15
|
+
unless attributes.is_a?(Hash)
|
|
16
|
+
fail(
|
|
17
|
+
ArgumentError,
|
|
18
|
+
"The input argument (attributes) must be a hash in `AgenticCommerceProtocol::Total` new method"
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
attributes.each do |k, v|
|
|
23
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
24
|
+
fail(ArgumentError, "The field #{k} is not part of AgenticCommerceProtocol::Total")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
instance_variable_set("@#{k}", v)
|
|
28
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.deserialize(attributes = {})
|
|
33
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
34
|
+
attrs = Hash.new
|
|
35
|
+
attrs["type"] = AgenticCommerceProtocol::TotalType.deserialize(attributes["type"])
|
|
36
|
+
attrs["display_text"] = attributes["display_text"]
|
|
37
|
+
attrs["amount"] = attributes["amount"]
|
|
38
|
+
new(attrs)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def serialize
|
|
42
|
+
out = Hash.new
|
|
43
|
+
out["type"] = AgenticCommerceProtocol::serialize_schema_ref(@type) if @type
|
|
44
|
+
out["display_text"] = AgenticCommerceProtocol::serialize_primitive(@display_text) if @display_text
|
|
45
|
+
out["amount"] = AgenticCommerceProtocol::serialize_primitive(@amount) if @amount
|
|
46
|
+
out
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Serializes the object to a json string
|
|
50
|
+
# @return String
|
|
51
|
+
def to_json
|
|
52
|
+
JSON.dump(serialize)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module AgenticCommerceProtocol
|
|
4
|
+
class TotalType
|
|
5
|
+
ITEMS_BASE_AMOUNT = "items_base_amount".freeze
|
|
6
|
+
ITEMS_DISCOUNT = "items_discount".freeze
|
|
7
|
+
SUBTOTAL = "subtotal".freeze
|
|
8
|
+
DISCOUNT = "discount".freeze
|
|
9
|
+
FULFILLMENT = "fulfillment".freeze
|
|
10
|
+
TAX = "tax".freeze
|
|
11
|
+
FEE = "fee".freeze
|
|
12
|
+
TOTAL = "total".freeze
|
|
13
|
+
|
|
14
|
+
def self.all_vars
|
|
15
|
+
@all_vars ||= [ITEMS_BASE_AMOUNT, ITEMS_DISCOUNT, SUBTOTAL, DISCOUNT, FULFILLMENT, TAX, FEE, TOTAL].freeze
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def initialize(value)
|
|
19
|
+
unless TotalType.all_vars.include?(value)
|
|
20
|
+
raise "Invalid ENUM value '#{value}' for class #TotalType"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
@value = value
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.deserialize(value)
|
|
27
|
+
return value if TotalType.all_vars.include?(value)
|
|
28
|
+
raise "Invalid ENUM value '#{value}' for class #TotalType"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def serialize
|
|
32
|
+
@value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module AgenticCommerceProtocol
|
|
6
|
+
class WebhookEvent
|
|
7
|
+
attr_accessor :type
|
|
8
|
+
attr_accessor :data
|
|
9
|
+
|
|
10
|
+
ALL_FIELD ||= ["type", "data"].freeze
|
|
11
|
+
private_constant :ALL_FIELD
|
|
12
|
+
|
|
13
|
+
def initialize(attributes = {})
|
|
14
|
+
unless attributes.is_a?(Hash)
|
|
15
|
+
fail(
|
|
16
|
+
ArgumentError,
|
|
17
|
+
"The input argument (attributes) must be a hash in `AgenticCommerceProtocol::WebhookEvent` new method"
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
attributes.each do |k, v|
|
|
22
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
23
|
+
fail(ArgumentError, "The field #{k} is not part of AgenticCommerceProtocol::WebhookEvent")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
instance_variable_set("@#{k}", v)
|
|
27
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.deserialize(attributes = {})
|
|
32
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
33
|
+
attrs = Hash.new
|
|
34
|
+
attrs["type"] = AgenticCommerceProtocol::WebhookEventType.deserialize(attributes["type"])
|
|
35
|
+
attrs["data"] = AgenticCommerceProtocol::EventDataOrder.deserialize(attributes["data"])
|
|
36
|
+
new(attrs)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def serialize
|
|
40
|
+
out = Hash.new
|
|
41
|
+
out["type"] = AgenticCommerceProtocol::serialize_schema_ref(@type) if @type
|
|
42
|
+
out["data"] = AgenticCommerceProtocol::serialize_schema_ref(@data) if @data
|
|
43
|
+
out
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Serializes the object to a json string
|
|
47
|
+
# @return String
|
|
48
|
+
def to_json
|
|
49
|
+
JSON.dump(serialize)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module AgenticCommerceProtocol
|
|
4
|
+
class WebhookEventType
|
|
5
|
+
ORDER_CREATE = "order_create".freeze
|
|
6
|
+
ORDER_UPDATE = "order_update".freeze
|
|
7
|
+
|
|
8
|
+
def self.all_vars
|
|
9
|
+
@all_vars ||= [ORDER_CREATE, ORDER_UPDATE].freeze
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def initialize(value)
|
|
13
|
+
unless WebhookEventType.all_vars.include?(value)
|
|
14
|
+
raise "Invalid ENUM value '#{value}' for class #WebhookEventType"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@value = value
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.deserialize(value)
|
|
21
|
+
return value if WebhookEventType.all_vars.include?(value)
|
|
22
|
+
raise "Invalid ENUM value '#{value}' for class #WebhookEventType"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def serialize
|
|
26
|
+
@value
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module AgenticCommerceProtocol
|
|
4
|
+
class WebhookOrderStatus
|
|
5
|
+
CREATED = "created".freeze
|
|
6
|
+
MANUAL_REVIEW = "manual_review".freeze
|
|
7
|
+
CONFIRMED = "confirmed".freeze
|
|
8
|
+
CANCELED = "canceled".freeze
|
|
9
|
+
SHIPPED = "shipped".freeze
|
|
10
|
+
FULFILLED = "fulfilled".freeze
|
|
11
|
+
|
|
12
|
+
def self.all_vars
|
|
13
|
+
@all_vars ||= [CREATED, MANUAL_REVIEW, CONFIRMED, CANCELED, SHIPPED, FULFILLED].freeze
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def initialize(value)
|
|
17
|
+
unless WebhookOrderStatus.all_vars.include?(value)
|
|
18
|
+
raise "Invalid ENUM value '#{value}' for class #WebhookOrderStatus"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@value = value
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.deserialize(value)
|
|
25
|
+
return value if WebhookOrderStatus.all_vars.include?(value)
|
|
26
|
+
raise "Invalid ENUM value '#{value}' for class #WebhookOrderStatus"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def serialize
|
|
30
|
+
@value
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# typed: false
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
require "date"
|
|
4
|
+
|
|
5
|
+
# Constant time string comparison, for fixed length strings.
|
|
6
|
+
# Code borrowed from ActiveSupport
|
|
7
|
+
# https://github.com/rails/rails/blob/75ac626c4e21129d8296d4206a1960563cc3d4aa/activesupport/lib/active_support/security_utils.rb#L33
|
|
8
|
+
#
|
|
9
|
+
# The values compared should be of fixed length, such as strings
|
|
10
|
+
# that have already been processed by HMAC. Raises in case of length mismatch.
|
|
11
|
+
module AgenticCommerceProtocol
|
|
12
|
+
if defined?(OpenSSL.fixed_length_secure_compare)
|
|
13
|
+
def fixed_length_secure_compare(a, b)
|
|
14
|
+
OpenSSL.fixed_length_secure_compare(a, b)
|
|
15
|
+
end
|
|
16
|
+
else
|
|
17
|
+
def fixed_length_secure_compare(a, b)
|
|
18
|
+
raise ArgumentError, "string length mismatch." unless a.bytesize == b.bytesize
|
|
19
|
+
|
|
20
|
+
l = a.unpack("C#{a.bytesize}")
|
|
21
|
+
|
|
22
|
+
res = 0
|
|
23
|
+
b.each_byte { |byte| res |= byte ^ l.shift }
|
|
24
|
+
res == 0
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
module_function :fixed_length_secure_compare
|
|
29
|
+
|
|
30
|
+
# Secure string comparison for strings of variable length.
|
|
31
|
+
#
|
|
32
|
+
# While a timing attack would not be able to discern the content of
|
|
33
|
+
# a secret compared via secure_compare, it is possible to determine
|
|
34
|
+
# the secret length. This should be considered when using secure_compare
|
|
35
|
+
# to compare weak, short secrets to user input.
|
|
36
|
+
def secure_compare(a, b)
|
|
37
|
+
a.length == b.length && fixed_length_secure_compare(a, b)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
module_function :secure_compare
|
|
41
|
+
|
|
42
|
+
def serialize_primitive(v)
|
|
43
|
+
if v.kind_of?(Time)
|
|
44
|
+
v.utc.to_datetime.rfc3339
|
|
45
|
+
else
|
|
46
|
+
v
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
module_function :serialize_primitive
|
|
51
|
+
|
|
52
|
+
def deserialize_date(v)
|
|
53
|
+
DateTime.rfc3339(v)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
module_function :deserialize_date
|
|
57
|
+
|
|
58
|
+
def serialize_schema_ref(v)
|
|
59
|
+
# Enums are a schema_ref but since we pass them around using the underlying value
|
|
60
|
+
# we need to check if they have the serialize method before calling it
|
|
61
|
+
if v.class.method_defined? :serialize
|
|
62
|
+
v.serialize
|
|
63
|
+
else
|
|
64
|
+
v
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
module_function :serialize_schema_ref
|
|
69
|
+
|
|
70
|
+
end
|
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
# Models
|
|
5
|
+
require "agentic_commerce_protocol/models/address"
|
|
6
|
+
require "agentic_commerce_protocol/models/allowance"
|
|
7
|
+
require "agentic_commerce_protocol/models/allowance_reason"
|
|
8
|
+
require "agentic_commerce_protocol/models/buyer"
|
|
9
|
+
require "agentic_commerce_protocol/models/card_funding_type"
|
|
10
|
+
require "agentic_commerce_protocol/models/card_number_type"
|
|
11
|
+
require "agentic_commerce_protocol/models/check_performed_type"
|
|
12
|
+
require "agentic_commerce_protocol/models/checkout_session"
|
|
13
|
+
require "agentic_commerce_protocol/models/checkout_session_complete_request"
|
|
14
|
+
require "agentic_commerce_protocol/models/checkout_session_create_request"
|
|
15
|
+
require "agentic_commerce_protocol/models/checkout_session_status"
|
|
16
|
+
require "agentic_commerce_protocol/models/checkout_session_update_request"
|
|
17
|
+
require "agentic_commerce_protocol/models/content_type"
|
|
18
|
+
require "agentic_commerce_protocol/models/delegate_payment_request"
|
|
19
|
+
require "agentic_commerce_protocol/models/delegate_payment_response"
|
|
20
|
+
require "agentic_commerce_protocol/models/error"
|
|
21
|
+
require "agentic_commerce_protocol/models/error_code"
|
|
22
|
+
require "agentic_commerce_protocol/models/error_type"
|
|
23
|
+
require "agentic_commerce_protocol/models/event_data_order"
|
|
24
|
+
require "agentic_commerce_protocol/models/fulfillment_option"
|
|
25
|
+
require "agentic_commerce_protocol/models/fulfillment_option_digital"
|
|
26
|
+
require "agentic_commerce_protocol/models/fulfillment_option_shipping"
|
|
27
|
+
require "agentic_commerce_protocol/models/item"
|
|
28
|
+
require "agentic_commerce_protocol/models/line_item"
|
|
29
|
+
require "agentic_commerce_protocol/models/link"
|
|
30
|
+
require "agentic_commerce_protocol/models/link_type"
|
|
31
|
+
require "agentic_commerce_protocol/models/message"
|
|
32
|
+
require "agentic_commerce_protocol/models/message_error"
|
|
33
|
+
require "agentic_commerce_protocol/models/message_info"
|
|
34
|
+
require "agentic_commerce_protocol/models/order"
|
|
35
|
+
require "agentic_commerce_protocol/models/payment_data"
|
|
36
|
+
require "agentic_commerce_protocol/models/payment_method_card"
|
|
37
|
+
require "agentic_commerce_protocol/models/payment_method_type"
|
|
38
|
+
require "agentic_commerce_protocol/models/payment_provider"
|
|
39
|
+
require "agentic_commerce_protocol/models/payment_provider_type"
|
|
40
|
+
require "agentic_commerce_protocol/models/refund"
|
|
41
|
+
require "agentic_commerce_protocol/models/refund_type"
|
|
42
|
+
require "agentic_commerce_protocol/models/risk_signal"
|
|
43
|
+
require "agentic_commerce_protocol/models/risk_signal_action"
|
|
44
|
+
require "agentic_commerce_protocol/models/risk_signal_type"
|
|
45
|
+
require "agentic_commerce_protocol/models/total"
|
|
46
|
+
require "agentic_commerce_protocol/models/total_type"
|
|
47
|
+
require "agentic_commerce_protocol/models/webhook_event"
|
|
48
|
+
require "agentic_commerce_protocol/models/webhook_event_type"
|
|
49
|
+
require "agentic_commerce_protocol/models/webhook_order_status"
|
|
9
50
|
|
|
51
|
+
# Core
|
|
52
|
+
require "agentic_commerce_protocol/util"
|
|
53
|
+
require "agentic_commerce_protocol/version"
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: agentic-commerce-protocol
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Svix
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-10-
|
|
10
|
+
date: 2025-10-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: Type definitions for the Agentic Commerce Protocol specification
|
|
13
13
|
email: []
|
|
@@ -17,7 +17,52 @@ extra_rdoc_files: []
|
|
|
17
17
|
files:
|
|
18
18
|
- README.md
|
|
19
19
|
- lib/agentic_commerce_protocol.rb
|
|
20
|
-
- lib/agentic_commerce_protocol/
|
|
20
|
+
- lib/agentic_commerce_protocol/models/address.rb
|
|
21
|
+
- lib/agentic_commerce_protocol/models/allowance.rb
|
|
22
|
+
- lib/agentic_commerce_protocol/models/allowance_reason.rb
|
|
23
|
+
- lib/agentic_commerce_protocol/models/buyer.rb
|
|
24
|
+
- lib/agentic_commerce_protocol/models/card_funding_type.rb
|
|
25
|
+
- lib/agentic_commerce_protocol/models/card_number_type.rb
|
|
26
|
+
- lib/agentic_commerce_protocol/models/check_performed_type.rb
|
|
27
|
+
- lib/agentic_commerce_protocol/models/checkout_session.rb
|
|
28
|
+
- lib/agentic_commerce_protocol/models/checkout_session_complete_request.rb
|
|
29
|
+
- lib/agentic_commerce_protocol/models/checkout_session_create_request.rb
|
|
30
|
+
- lib/agentic_commerce_protocol/models/checkout_session_status.rb
|
|
31
|
+
- lib/agentic_commerce_protocol/models/checkout_session_update_request.rb
|
|
32
|
+
- lib/agentic_commerce_protocol/models/content_type.rb
|
|
33
|
+
- lib/agentic_commerce_protocol/models/delegate_payment_request.rb
|
|
34
|
+
- lib/agentic_commerce_protocol/models/delegate_payment_response.rb
|
|
35
|
+
- lib/agentic_commerce_protocol/models/error.rb
|
|
36
|
+
- lib/agentic_commerce_protocol/models/error_code.rb
|
|
37
|
+
- lib/agentic_commerce_protocol/models/error_type.rb
|
|
38
|
+
- lib/agentic_commerce_protocol/models/event_data_order.rb
|
|
39
|
+
- lib/agentic_commerce_protocol/models/fulfillment_option.rb
|
|
40
|
+
- lib/agentic_commerce_protocol/models/fulfillment_option_digital.rb
|
|
41
|
+
- lib/agentic_commerce_protocol/models/fulfillment_option_shipping.rb
|
|
42
|
+
- lib/agentic_commerce_protocol/models/item.rb
|
|
43
|
+
- lib/agentic_commerce_protocol/models/line_item.rb
|
|
44
|
+
- lib/agentic_commerce_protocol/models/link.rb
|
|
45
|
+
- lib/agentic_commerce_protocol/models/link_type.rb
|
|
46
|
+
- lib/agentic_commerce_protocol/models/message.rb
|
|
47
|
+
- lib/agentic_commerce_protocol/models/message_error.rb
|
|
48
|
+
- lib/agentic_commerce_protocol/models/message_info.rb
|
|
49
|
+
- lib/agentic_commerce_protocol/models/order.rb
|
|
50
|
+
- lib/agentic_commerce_protocol/models/payment_data.rb
|
|
51
|
+
- lib/agentic_commerce_protocol/models/payment_method_card.rb
|
|
52
|
+
- lib/agentic_commerce_protocol/models/payment_method_type.rb
|
|
53
|
+
- lib/agentic_commerce_protocol/models/payment_provider.rb
|
|
54
|
+
- lib/agentic_commerce_protocol/models/payment_provider_type.rb
|
|
55
|
+
- lib/agentic_commerce_protocol/models/refund.rb
|
|
56
|
+
- lib/agentic_commerce_protocol/models/refund_type.rb
|
|
57
|
+
- lib/agentic_commerce_protocol/models/risk_signal.rb
|
|
58
|
+
- lib/agentic_commerce_protocol/models/risk_signal_action.rb
|
|
59
|
+
- lib/agentic_commerce_protocol/models/risk_signal_type.rb
|
|
60
|
+
- lib/agentic_commerce_protocol/models/total.rb
|
|
61
|
+
- lib/agentic_commerce_protocol/models/total_type.rb
|
|
62
|
+
- lib/agentic_commerce_protocol/models/webhook_event.rb
|
|
63
|
+
- lib/agentic_commerce_protocol/models/webhook_event_type.rb
|
|
64
|
+
- lib/agentic_commerce_protocol/models/webhook_order_status.rb
|
|
65
|
+
- lib/agentic_commerce_protocol/util.rb
|
|
21
66
|
- lib/agentic_commerce_protocol/version.rb
|
|
22
67
|
homepage: https://github.com/svix/agentic-commerce-protocol
|
|
23
68
|
licenses:
|