agentic-commerce-protocol 0.1.3 → 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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/agentic_commerce_protocol/models/address.rb +67 -0
  3. data/lib/agentic_commerce_protocol/models/allowance.rb +67 -0
  4. data/lib/agentic_commerce_protocol/models/allowance_reason.rb +28 -0
  5. data/lib/agentic_commerce_protocol/models/buyer.rb +58 -0
  6. data/lib/agentic_commerce_protocol/models/card_funding_type.rb +30 -0
  7. data/lib/agentic_commerce_protocol/models/card_number_type.rb +29 -0
  8. data/lib/agentic_commerce_protocol/models/check_performed_type.rb +31 -0
  9. data/lib/agentic_commerce_protocol/models/checkout_session.rb +113 -0
  10. data/lib/agentic_commerce_protocol/models/checkout_session_complete_request.rb +52 -0
  11. data/lib/agentic_commerce_protocol/models/checkout_session_create_request.rb +61 -0
  12. data/lib/agentic_commerce_protocol/models/checkout_session_status.rb +32 -0
  13. data/lib/agentic_commerce_protocol/models/checkout_session_update_request.rb +70 -0
  14. data/lib/agentic_commerce_protocol/models/content_type.rb +29 -0
  15. data/lib/agentic_commerce_protocol/models/delegate_payment_request.rb +64 -0
  16. data/lib/agentic_commerce_protocol/models/delegate_payment_response.rb +55 -0
  17. data/lib/agentic_commerce_protocol/models/error.rb +58 -0
  18. data/lib/agentic_commerce_protocol/models/error_code.rb +33 -0
  19. data/lib/agentic_commerce_protocol/models/error_type.rb +31 -0
  20. data/lib/agentic_commerce_protocol/models/event_data_order.rb +64 -0
  21. data/lib/agentic_commerce_protocol/models/fulfillment_option.rb +89 -0
  22. data/lib/agentic_commerce_protocol/models/fulfillment_option_digital.rb +64 -0
  23. data/lib/agentic_commerce_protocol/models/fulfillment_option_shipping.rb +89 -0
  24. data/lib/agentic_commerce_protocol/models/item.rb +52 -0
  25. data/lib/agentic_commerce_protocol/models/line_item.rb +67 -0
  26. data/lib/agentic_commerce_protocol/models/link.rb +52 -0
  27. data/lib/agentic_commerce_protocol/models/link_type.rb +30 -0
  28. data/lib/agentic_commerce_protocol/models/message.rb +89 -0
  29. data/lib/agentic_commerce_protocol/models/message_error.rb +58 -0
  30. data/lib/agentic_commerce_protocol/models/message_info.rb +55 -0
  31. data/lib/agentic_commerce_protocol/models/order.rb +58 -0
  32. data/lib/agentic_commerce_protocol/models/payment_data.rb +58 -0
  33. data/lib/agentic_commerce_protocol/models/payment_method_card.rb +124 -0
  34. data/lib/agentic_commerce_protocol/models/payment_method_type.rb +28 -0
  35. data/lib/agentic_commerce_protocol/models/payment_provider.rb +57 -0
  36. data/lib/agentic_commerce_protocol/models/payment_provider_type.rb +28 -0
  37. data/lib/agentic_commerce_protocol/models/refund.rb +52 -0
  38. data/lib/agentic_commerce_protocol/models/refund_type.rb +29 -0
  39. data/lib/agentic_commerce_protocol/models/risk_signal.rb +55 -0
  40. data/lib/agentic_commerce_protocol/models/risk_signal_action.rb +30 -0
  41. data/lib/agentic_commerce_protocol/models/risk_signal_type.rb +28 -0
  42. data/lib/agentic_commerce_protocol/models/total.rb +55 -0
  43. data/lib/agentic_commerce_protocol/models/total_type.rb +35 -0
  44. data/lib/agentic_commerce_protocol/models/webhook_event.rb +52 -0
  45. data/lib/agentic_commerce_protocol/models/webhook_event_type.rb +29 -0
  46. data/lib/agentic_commerce_protocol/models/webhook_order_status.rb +33 -0
  47. data/lib/agentic_commerce_protocol/util.rb +70 -0
  48. data/lib/agentic_commerce_protocol/version.rb +2 -1
  49. data/lib/agentic_commerce_protocol.rb +50 -6
  50. metadata +48 -3
  51. data/lib/agentic_commerce_protocol/types.rb +0 -13
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module AgenticCommerceProtocol
6
+ class LineItem
7
+ attr_accessor :id
8
+ attr_accessor :item
9
+ attr_accessor :base_amount
10
+ attr_accessor :discount
11
+ attr_accessor :subtotal
12
+ attr_accessor :tax
13
+ attr_accessor :total
14
+
15
+ ALL_FIELD ||= ["id", "item", "base_amount", "discount", "subtotal", "tax", "total"].freeze
16
+ private_constant :ALL_FIELD
17
+
18
+ def initialize(attributes = {})
19
+ unless attributes.is_a?(Hash)
20
+ fail(
21
+ ArgumentError,
22
+ "The input argument (attributes) must be a hash in `AgenticCommerceProtocol::LineItem` new method"
23
+ )
24
+ end
25
+
26
+ attributes.each do |k, v|
27
+ unless ALL_FIELD.include?(k.to_s)
28
+ fail(ArgumentError, "The field #{k} is not part of AgenticCommerceProtocol::LineItem")
29
+ end
30
+
31
+ instance_variable_set("@#{k}", v)
32
+ instance_variable_set("@__#{k}_is_defined", true)
33
+ end
34
+ end
35
+
36
+ def self.deserialize(attributes = {})
37
+ attributes = attributes.transform_keys(&:to_s)
38
+ attrs = Hash.new
39
+ attrs["id"] = attributes["id"]
40
+ attrs["item"] = AgenticCommerceProtocol::Item.deserialize(attributes["item"])
41
+ attrs["base_amount"] = attributes["base_amount"]
42
+ attrs["discount"] = attributes["discount"]
43
+ attrs["subtotal"] = attributes["subtotal"]
44
+ attrs["tax"] = attributes["tax"]
45
+ attrs["total"] = attributes["total"]
46
+ new(attrs)
47
+ end
48
+
49
+ def serialize
50
+ out = Hash.new
51
+ out["id"] = AgenticCommerceProtocol::serialize_primitive(@id) if @id
52
+ out["item"] = AgenticCommerceProtocol::serialize_schema_ref(@item) if @item
53
+ out["base_amount"] = AgenticCommerceProtocol::serialize_primitive(@base_amount) if @base_amount
54
+ out["discount"] = AgenticCommerceProtocol::serialize_primitive(@discount) if @discount
55
+ out["subtotal"] = AgenticCommerceProtocol::serialize_primitive(@subtotal) if @subtotal
56
+ out["tax"] = AgenticCommerceProtocol::serialize_primitive(@tax) if @tax
57
+ out["total"] = AgenticCommerceProtocol::serialize_primitive(@total) if @total
58
+ out
59
+ end
60
+
61
+ # Serializes the object to a json string
62
+ # @return String
63
+ def to_json
64
+ JSON.dump(serialize)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module AgenticCommerceProtocol
6
+ class Link
7
+ attr_accessor :type
8
+ attr_accessor :url
9
+
10
+ ALL_FIELD ||= ["type", "url"].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::Link` 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::Link")
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::LinkType.deserialize(attributes["type"])
35
+ attrs["url"] = attributes["url"]
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["url"] = AgenticCommerceProtocol::serialize_primitive(@url) if @url
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,30 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ module AgenticCommerceProtocol
4
+ class LinkType
5
+ TERMS_OF_USE = "terms_of_use".freeze
6
+ PRIVACY_POLICY = "privacy_policy".freeze
7
+ SELLER_SHOP_POLICIES = "seller_shop_policies".freeze
8
+
9
+ def self.all_vars
10
+ @all_vars ||= [TERMS_OF_USE, PRIVACY_POLICY, SELLER_SHOP_POLICIES].freeze
11
+ end
12
+
13
+ def initialize(value)
14
+ unless LinkType.all_vars.include?(value)
15
+ raise "Invalid ENUM value '#{value}' for class #LinkType"
16
+ end
17
+
18
+ @value = value
19
+ end
20
+
21
+ def self.deserialize(value)
22
+ return value if LinkType.all_vars.include?(value)
23
+ raise "Invalid ENUM value '#{value}' for class #LinkType"
24
+ end
25
+
26
+ def serialize
27
+ @value
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ require_relative "./message_error"
6
+ require_relative "./message_info"
7
+
8
+ module AgenticCommerceProtocol
9
+ class MessageData
10
+ class Info < MessageInfo
11
+ end
12
+
13
+ class Error < MessageError
14
+ end
15
+ end
16
+
17
+ class Message
18
+ attr_accessor :data
19
+
20
+ ALL_FIELD ||= ["data"].freeze
21
+ private_constant :ALL_FIELD
22
+ TYPE_TO_NAME = {
23
+ MessageData::Info => "info",
24
+ MessageData::Error => "error"
25
+ }
26
+ private_constant :TYPE_TO_NAME
27
+ NAME_TO_TYPE = TYPE_TO_NAME.invert
28
+ private_constant :NAME_TO_TYPE
29
+
30
+ def initialize(attributes = {})
31
+ unless attributes.is_a?(Hash)
32
+ fail(
33
+ ArgumentError,
34
+ "The input argument (attributes) must be a hash in `AgenticCommerceProtocol::Message` new method"
35
+ )
36
+ end
37
+
38
+ attributes.each do |k, v|
39
+ unless ALL_FIELD.include?(k.to_s)
40
+ fail(ArgumentError, "The field #{k} is not part of AgenticCommerceProtocol::Message")
41
+ end
42
+
43
+ if k == "data"
44
+ unless TYPE_TO_NAME.key?(v.class)
45
+ fail(ArgumentError, "The field #{k} can't be a `#{v.class}` expected one of #{TYPE_TO_NAME.keys}")
46
+ end
47
+
48
+ instance_variable_set("@__enum_discriminator", TYPE_TO_NAME[v.class])
49
+ end
50
+
51
+ instance_variable_set("@#{k}", v)
52
+ instance_variable_set("@__#{k}_is_defined", true)
53
+ end
54
+
55
+ if @__enum_discriminator.nil?
56
+ fail(ArgumentError, "Required data field was not set")
57
+ end
58
+ end
59
+
60
+ def self.deserialize(attributes = {})
61
+ attributes = attributes.transform_keys(&:to_s)
62
+ attrs = Hash.new
63
+ unless NAME_TO_TYPE.key?(attributes["type"])
64
+ fail(ArgumentError, "Invalid type `#{attributes["type"]}` expected on of #{NAME_TO_TYPE.keys}")
65
+ end
66
+
67
+ unless attributes.key?("data")
68
+ fail(ArgumentError, "Missing required field data")
69
+ end
70
+
71
+ attrs["data"] = NAME_TO_TYPE[attributes["type"]].deserialize(attributes["data"])
72
+ new(attrs)
73
+ end
74
+
75
+ def serialize
76
+ out = Hash.new
77
+ out["type"] = @__enum_discriminator
78
+ out["data"] = @data.serialize
79
+ out
80
+ end
81
+
82
+ # Serializes the object to a json string
83
+ # @return String
84
+ def to_json
85
+ JSON.dump(serialize)
86
+ end
87
+
88
+ end
89
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module AgenticCommerceProtocol
6
+ class MessageError
7
+ attr_accessor :code
8
+ attr_accessor :param
9
+ attr_accessor :content_type
10
+ attr_accessor :content
11
+
12
+ ALL_FIELD ||= ["code", "param", "content_type", "content"].freeze
13
+ private_constant :ALL_FIELD
14
+
15
+ def initialize(attributes = {})
16
+ unless attributes.is_a?(Hash)
17
+ fail(
18
+ ArgumentError,
19
+ "The input argument (attributes) must be a hash in `AgenticCommerceProtocol::MessageError` new method"
20
+ )
21
+ end
22
+
23
+ attributes.each do |k, v|
24
+ unless ALL_FIELD.include?(k.to_s)
25
+ fail(ArgumentError, "The field #{k} is not part of AgenticCommerceProtocol::MessageError")
26
+ end
27
+
28
+ instance_variable_set("@#{k}", v)
29
+ instance_variable_set("@__#{k}_is_defined", true)
30
+ end
31
+ end
32
+
33
+ def self.deserialize(attributes = {})
34
+ attributes = attributes.transform_keys(&:to_s)
35
+ attrs = Hash.new
36
+ attrs["code"] = AgenticCommerceProtocol::ErrorCode.deserialize(attributes["code"])
37
+ attrs["param"] = attributes["param"]
38
+ attrs["content_type"] = AgenticCommerceProtocol::ContentType.deserialize(attributes["content_type"])
39
+ attrs["content"] = attributes["content"]
40
+ new(attrs)
41
+ end
42
+
43
+ def serialize
44
+ out = Hash.new
45
+ out["code"] = AgenticCommerceProtocol::serialize_schema_ref(@code) if @code
46
+ out["param"] = AgenticCommerceProtocol::serialize_primitive(@param) if @param
47
+ out["content_type"] = AgenticCommerceProtocol::serialize_schema_ref(@content_type) if @content_type
48
+ out["content"] = AgenticCommerceProtocol::serialize_primitive(@content) if @content
49
+ out
50
+ end
51
+
52
+ # Serializes the object to a json string
53
+ # @return String
54
+ def to_json
55
+ JSON.dump(serialize)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module AgenticCommerceProtocol
6
+ class MessageInfo
7
+ attr_accessor :param
8
+ attr_accessor :content_type
9
+ attr_accessor :content
10
+
11
+ ALL_FIELD ||= ["param", "content_type", "content"].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::MessageInfo` 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::MessageInfo")
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["param"] = attributes["param"]
36
+ attrs["content_type"] = AgenticCommerceProtocol::ContentType.deserialize(attributes["content_type"])
37
+ attrs["content"] = attributes["content"]
38
+ new(attrs)
39
+ end
40
+
41
+ def serialize
42
+ out = Hash.new
43
+ out["param"] = AgenticCommerceProtocol::serialize_primitive(@param) if @param
44
+ out["content_type"] = AgenticCommerceProtocol::serialize_schema_ref(@content_type) if @content_type
45
+ out["content"] = AgenticCommerceProtocol::serialize_primitive(@content) if @content
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,58 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module AgenticCommerceProtocol
6
+ class Order
7
+ attr_accessor :id
8
+ attr_accessor :checkout_session_id
9
+ attr_accessor :permalink_url
10
+
11
+ ALL_FIELD ||= ["id", "checkout_session_id", "permalink_url"].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::Order` 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::Order")
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["id"] = attributes["id"]
36
+ attrs["checkout_session_id"] = attributes["checkout_session_id"]
37
+ attrs["permalink_url"] = attributes["permalink_url"]
38
+ new(attrs)
39
+ end
40
+
41
+ def serialize
42
+ out = Hash.new
43
+ out["id"] = AgenticCommerceProtocol::serialize_primitive(@id) if @id
44
+ if @checkout_session_id
45
+ out["checkout_session_id"] = AgenticCommerceProtocol::serialize_primitive(@checkout_session_id)
46
+ end
47
+
48
+ out["permalink_url"] = AgenticCommerceProtocol::serialize_primitive(@permalink_url) if @permalink_url
49
+ out
50
+ end
51
+
52
+ # Serializes the object to a json string
53
+ # @return String
54
+ def to_json
55
+ JSON.dump(serialize)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module AgenticCommerceProtocol
6
+ class PaymentData
7
+ attr_accessor :token
8
+ attr_accessor :provider
9
+ attr_accessor :billing_address
10
+
11
+ ALL_FIELD ||= ["token", "provider", "billing_address"].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::PaymentData` 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::PaymentData")
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["token"] = attributes["token"]
36
+ attrs["provider"] = AgenticCommerceProtocol::PaymentProviderType.deserialize(attributes["provider"])
37
+ if attributes["billing_address"]
38
+ attrs["billing_address"] = AgenticCommerceProtocol::Address.deserialize(attributes["billing_address"])
39
+ end
40
+
41
+ new(attrs)
42
+ end
43
+
44
+ def serialize
45
+ out = Hash.new
46
+ out["token"] = AgenticCommerceProtocol::serialize_primitive(@token) if @token
47
+ out["provider"] = AgenticCommerceProtocol::serialize_schema_ref(@provider) if @provider
48
+ out["billing_address"] = AgenticCommerceProtocol::serialize_schema_ref(@billing_address) if @billing_address
49
+ out
50
+ end
51
+
52
+ # Serializes the object to a json string
53
+ # @return String
54
+ def to_json
55
+ JSON.dump(serialize)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module AgenticCommerceProtocol
6
+ class PaymentMethodCard
7
+ attr_accessor :type
8
+ attr_accessor :card_number_type
9
+ attr_accessor :number
10
+ attr_accessor :exp_month
11
+ attr_accessor :exp_year
12
+ attr_accessor :name
13
+ attr_accessor :cvc
14
+ attr_accessor :cryptogram
15
+ attr_accessor :eci_value
16
+ attr_accessor :checks_performed
17
+ attr_accessor :iin
18
+ attr_accessor :display_card_funding_type
19
+ attr_accessor :display_wallet_type
20
+ attr_accessor :display_brand
21
+ attr_accessor :display_last4
22
+ attr_accessor :metadata
23
+
24
+ ALL_FIELD ||= [
25
+ "type",
26
+ "card_number_type",
27
+ "number",
28
+ "exp_month",
29
+ "exp_year",
30
+ "name",
31
+ "cvc",
32
+ "cryptogram",
33
+ "eci_value",
34
+ "checks_performed",
35
+ "iin",
36
+ "display_card_funding_type",
37
+ "display_wallet_type",
38
+ "display_brand",
39
+ "display_last4",
40
+ "metadata"
41
+ ].freeze
42
+ private_constant :ALL_FIELD
43
+
44
+ def initialize(attributes = {})
45
+ unless attributes.is_a?(Hash)
46
+ fail(
47
+ ArgumentError,
48
+ "The input argument (attributes) must be a hash in `AgenticCommerceProtocol::PaymentMethodCard` new method"
49
+ )
50
+ end
51
+
52
+ attributes.each do |k, v|
53
+ unless ALL_FIELD.include?(k.to_s)
54
+ fail(ArgumentError, "The field #{k} is not part of AgenticCommerceProtocol::PaymentMethodCard")
55
+ end
56
+
57
+ instance_variable_set("@#{k}", v)
58
+ instance_variable_set("@__#{k}_is_defined", true)
59
+ end
60
+ end
61
+
62
+ def self.deserialize(attributes = {})
63
+ attributes = attributes.transform_keys(&:to_s)
64
+ attrs = Hash.new
65
+ attrs["type"] = attributes["type"]
66
+ attrs["card_number_type"] = AgenticCommerceProtocol::CardNumberType.deserialize(attributes["card_number_type"])
67
+ attrs["number"] = attributes["number"]
68
+ attrs["exp_month"] = attributes["exp_month"]
69
+ attrs["exp_year"] = attributes["exp_year"]
70
+ attrs["name"] = attributes["name"]
71
+ attrs["cvc"] = attributes["cvc"]
72
+ attrs["cryptogram"] = attributes["cryptogram"]
73
+ attrs["eci_value"] = attributes["eci_value"]
74
+ if attributes["checks_performed"]
75
+ attrs["checks_performed"] = attributes["checks_performed"].map { |v|
76
+ AgenticCommerceProtocol::CheckPerformedType.deserialize(v)
77
+ }
78
+ end
79
+
80
+ attrs["iin"] = attributes["iin"]
81
+ attrs["display_card_funding_type"] = AgenticCommerceProtocol::CardFundingType.deserialize(
82
+ attributes["display_card_funding_type"]
83
+ )
84
+ attrs["display_wallet_type"] = attributes["display_wallet_type"]
85
+ attrs["display_brand"] = attributes["display_brand"]
86
+ attrs["display_last4"] = attributes["display_last4"]
87
+ attrs["metadata"] = attributes["metadata"]
88
+ new(attrs)
89
+ end
90
+
91
+ def serialize
92
+ out = Hash.new
93
+ out["type"] = AgenticCommerceProtocol::serialize_primitive(@type) if @type
94
+ out["card_number_type"] = AgenticCommerceProtocol::serialize_schema_ref(@card_number_type) if @card_number_type
95
+ out["number"] = AgenticCommerceProtocol::serialize_primitive(@number) if @number
96
+ out["exp_month"] = AgenticCommerceProtocol::serialize_primitive(@exp_month) if @exp_month
97
+ out["exp_year"] = AgenticCommerceProtocol::serialize_primitive(@exp_year) if @exp_year
98
+ out["name"] = AgenticCommerceProtocol::serialize_primitive(@name) if @name
99
+ out["cvc"] = AgenticCommerceProtocol::serialize_primitive(@cvc) if @cvc
100
+ out["cryptogram"] = AgenticCommerceProtocol::serialize_primitive(@cryptogram) if @cryptogram
101
+ out["eci_value"] = AgenticCommerceProtocol::serialize_primitive(@eci_value) if @eci_value
102
+ out["checks_performed"] = @checks_performed.map { |v| v.serialize } if @checks_performed
103
+ out["iin"] = AgenticCommerceProtocol::serialize_primitive(@iin) if @iin
104
+ if @display_card_funding_type
105
+ out["display_card_funding_type"] = AgenticCommerceProtocol::serialize_schema_ref(@display_card_funding_type)
106
+ end
107
+
108
+ if @display_wallet_type
109
+ out["display_wallet_type"] = AgenticCommerceProtocol::serialize_primitive(@display_wallet_type)
110
+ end
111
+
112
+ out["display_brand"] = AgenticCommerceProtocol::serialize_primitive(@display_brand) if @display_brand
113
+ out["display_last4"] = AgenticCommerceProtocol::serialize_primitive(@display_last4) if @display_last4
114
+ out["metadata"] = AgenticCommerceProtocol::serialize_primitive(@metadata) if @metadata
115
+ out
116
+ end
117
+
118
+ # Serializes the object to a json string
119
+ # @return String
120
+ def to_json
121
+ JSON.dump(serialize)
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ module AgenticCommerceProtocol
4
+ class PaymentMethodType
5
+ CARD = "card".freeze
6
+
7
+ def self.all_vars
8
+ @all_vars ||= [CARD].freeze
9
+ end
10
+
11
+ def initialize(value)
12
+ unless PaymentMethodType.all_vars.include?(value)
13
+ raise "Invalid ENUM value '#{value}' for class #PaymentMethodType"
14
+ end
15
+
16
+ @value = value
17
+ end
18
+
19
+ def self.deserialize(value)
20
+ return value if PaymentMethodType.all_vars.include?(value)
21
+ raise "Invalid ENUM value '#{value}' for class #PaymentMethodType"
22
+ end
23
+
24
+ def serialize
25
+ @value
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module AgenticCommerceProtocol
6
+ class PaymentProvider
7
+ attr_accessor :provider
8
+ attr_accessor :supported_payment_methods
9
+
10
+ ALL_FIELD ||= ["provider", "supported_payment_methods"].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::PaymentProvider` 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::PaymentProvider")
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["provider"] = AgenticCommerceProtocol::PaymentProviderType.deserialize(attributes["provider"])
35
+ attrs["supported_payment_methods"] = attributes["supported_payment_methods"].map { |v|
36
+ AgenticCommerceProtocol::PaymentMethodType.deserialize(v)
37
+ }
38
+ new(attrs)
39
+ end
40
+
41
+ def serialize
42
+ out = Hash.new
43
+ out["provider"] = AgenticCommerceProtocol::serialize_schema_ref(@provider) if @provider
44
+ if @supported_payment_methods
45
+ out["supported_payment_methods"] = @supported_payment_methods.map { |v| v.serialize }
46
+ end
47
+
48
+ out
49
+ end
50
+
51
+ # Serializes the object to a json string
52
+ # @return String
53
+ def to_json
54
+ JSON.dump(serialize)
55
+ end
56
+ end
57
+ end