splitit-apimatic-sdk 1.0.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.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +154 -0
  4. data/bin/console +15 -0
  5. data/lib/splitit_web_api_v4/api_helper.rb +10 -0
  6. data/lib/splitit_web_api_v4/client.rb +83 -0
  7. data/lib/splitit_web_api_v4/configuration.rb +188 -0
  8. data/lib/splitit_web_api_v4/controllers/base_controller.rb +60 -0
  9. data/lib/splitit_web_api_v4/controllers/installment_plan_controller.rb +242 -0
  10. data/lib/splitit_web_api_v4/controllers/o_auth_authorization_controller.rb +42 -0
  11. data/lib/splitit_web_api_v4/exceptions/api_error_response_exception.rb +51 -0
  12. data/lib/splitit_web_api_v4/exceptions/api_exception.rb +21 -0
  13. data/lib/splitit_web_api_v4/exceptions/o_auth_provider_exception.rb +64 -0
  14. data/lib/splitit_web_api_v4/http/auth/api_key.rb +52 -0
  15. data/lib/splitit_web_api_v4/http/auth/o_auth2.rb +156 -0
  16. data/lib/splitit_web_api_v4/http/http_call_back.rb +10 -0
  17. data/lib/splitit_web_api_v4/http/http_method_enum.rb +10 -0
  18. data/lib/splitit_web_api_v4/http/http_request.rb +10 -0
  19. data/lib/splitit_web_api_v4/http/http_response.rb +10 -0
  20. data/lib/splitit_web_api_v4/http/proxy_settings.rb +22 -0
  21. data/lib/splitit_web_api_v4/models/amount_data.rb +70 -0
  22. data/lib/splitit_web_api_v4/models/api_error_model.rb +93 -0
  23. data/lib/splitit_web_api_v4/models/apr_data.rb +70 -0
  24. data/lib/splitit_web_api_v4/models/authorization_status_enum.rb +40 -0
  25. data/lib/splitit_web_api_v4/models/authorize_authorization_data.rb +154 -0
  26. data/lib/splitit_web_api_v4/models/authorize_request.rb +115 -0
  27. data/lib/splitit_web_api_v4/models/authorize_response.rb +221 -0
  28. data/lib/splitit_web_api_v4/models/base_model.rb +110 -0
  29. data/lib/splitit_web_api_v4/models/billing_address_data.rb +111 -0
  30. data/lib/splitit_web_api_v4/models/card_details.rb +108 -0
  31. data/lib/splitit_web_api_v4/models/card_validity_request.rb +62 -0
  32. data/lib/splitit_web_api_v4/models/card_validity_response.rb +80 -0
  33. data/lib/splitit_web_api_v4/models/checkout_url_data.rb +80 -0
  34. data/lib/splitit_web_api_v4/models/content_segment.rb +90 -0
  35. data/lib/splitit_web_api_v4/models/external_provider_types_enum.rb +48 -0
  36. data/lib/splitit_web_api_v4/models/inline_content.rb +71 -0
  37. data/lib/splitit_web_api_v4/models/installment_item.rb +101 -0
  38. data/lib/splitit_web_api_v4/models/installment_plan_details_response.rb +280 -0
  39. data/lib/splitit_web_api_v4/models/installment_plan_search_details_response.rb +71 -0
  40. data/lib/splitit_web_api_v4/models/installment_plan_search_request.rb +79 -0
  41. data/lib/splitit_web_api_v4/models/installment_plan_status_enum.rb +72 -0
  42. data/lib/splitit_web_api_v4/models/installment_status_enum.rb +60 -0
  43. data/lib/splitit_web_api_v4/models/masked_card_details.rb +82 -0
  44. data/lib/splitit_web_api_v4/models/metadata_item.rb +71 -0
  45. data/lib/splitit_web_api_v4/models/o_auth_provider_error_enum.rb +62 -0
  46. data/lib/splitit_web_api_v4/models/o_auth_scope_o_auth2_enum.rb +26 -0
  47. data/lib/splitit_web_api_v4/models/o_auth_token.rb +96 -0
  48. data/lib/splitit_web_api_v4/models/offer_item.rb +164 -0
  49. data/lib/splitit_web_api_v4/models/offers_billing_address.rb +108 -0
  50. data/lib/splitit_web_api_v4/models/offers_card_details.rb +108 -0
  51. data/lib/splitit_web_api_v4/models/offers_merchant_details.rb +82 -0
  52. data/lib/splitit_web_api_v4/models/offers_payment_method.rb +66 -0
  53. data/lib/splitit_web_api_v4/models/offers_payment_method_response.rb +88 -0
  54. data/lib/splitit_web_api_v4/models/offers_request.rb +145 -0
  55. data/lib/splitit_web_api_v4/models/offers_response.rb +156 -0
  56. data/lib/splitit_web_api_v4/models/offers_shopper_details.rb +112 -0
  57. data/lib/splitit_web_api_v4/models/offers_store_location.rb +108 -0
  58. data/lib/splitit_web_api_v4/models/payment_link_request.rb +195 -0
  59. data/lib/splitit_web_api_v4/models/payment_link_response.rb +107 -0
  60. data/lib/splitit_web_api_v4/models/payment_method.rb +66 -0
  61. data/lib/splitit_web_api_v4/models/payment_method_data.rb +78 -0
  62. data/lib/splitit_web_api_v4/models/payment_method_type_enum.rb +26 -0
  63. data/lib/splitit_web_api_v4/models/pis_error_codes_enum.rb +1021 -0
  64. data/lib/splitit_web_api_v4/models/plan_authorization_data.rb +172 -0
  65. data/lib/splitit_web_api_v4/models/plan_links_data.rb +91 -0
  66. data/lib/splitit_web_api_v4/models/plan_status_enum.rb +48 -0
  67. data/lib/splitit_web_api_v4/models/processing_data.rb +63 -0
  68. data/lib/splitit_web_api_v4/models/purchase_method_enum.rb +52 -0
  69. data/lib/splitit_web_api_v4/models/redirect_urls.rb +81 -0
  70. data/lib/splitit_web_api_v4/models/refund_item.rb +136 -0
  71. data/lib/splitit_web_api_v4/models/refund_request.rb +70 -0
  72. data/lib/splitit_web_api_v4/models/refund_response.rb +105 -0
  73. data/lib/splitit_web_api_v4/models/shipping_status_enum.rb +40 -0
  74. data/lib/splitit_web_api_v4/models/shopper_details_data.rb +113 -0
  75. data/lib/splitit_web_api_v4/models/three_ds_authentication_data.rb +90 -0
  76. data/lib/splitit_web_api_v4/models/three_ds_execute.rb +62 -0
  77. data/lib/splitit_web_api_v4/models/three_ds_redirect_data.rb +93 -0
  78. data/lib/splitit_web_api_v4/models/three_ds_request_data.rb +84 -0
  79. data/lib/splitit_web_api_v4/models/update_offers_payment_method.rb +66 -0
  80. data/lib/splitit_web_api_v4/models/update_offers_request.rb +105 -0
  81. data/lib/splitit_web_api_v4/models/update_order_request.rb +104 -0
  82. data/lib/splitit_web_api_v4/models/update_order_response.rb +126 -0
  83. data/lib/splitit_web_api_v4/models/validation_error.rb +71 -0
  84. data/lib/splitit_web_api_v4/utilities/date_time_helper.rb +11 -0
  85. data/lib/splitit_web_api_v4/utilities/file_wrapper.rb +28 -0
  86. data/lib/splitit_web_api_v4.rb +108 -0
  87. metadata +170 -0
@@ -0,0 +1,22 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ ##
8
+ # ProxySettings encapsulates HTTP proxy configuration for Faraday,
9
+ # including optional basic authentication.
10
+ #
11
+ class ProxySettings < CoreLibrary::ProxySettings
12
+ def self.from_env
13
+ address = ENV['PROXY_ADDRESS']
14
+ port = ENV['PROXY_PORT']
15
+ username = ENV['PROXY_USERNAME']
16
+ password = ENV['PROXY_PASSWORD']
17
+ return nil if address.nil? || address.strip.empty?
18
+
19
+ new(address: address, port: port, username: username, password: password)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,70 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # AmountData Model.
8
+ class AmountData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Float]
14
+ attr_accessor :value
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :symbol
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['value'] = 'Value'
24
+ @_hash['symbol'] = 'Symbol'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ symbol
32
+ ]
33
+ end
34
+
35
+ # An array for nullable fields
36
+ def self.nullables
37
+ []
38
+ end
39
+
40
+ def initialize(value = nil, symbol = SKIP)
41
+ @value = value
42
+ @symbol = symbol unless symbol == SKIP
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ value = hash.key?('Value') ? hash['Value'] : nil
51
+ symbol = hash.key?('Symbol') ? hash['Symbol'] : SKIP
52
+
53
+ # Create object from extracted values.
54
+ AmountData.new(value,
55
+ symbol)
56
+ end
57
+
58
+ # Provides a human-readable string representation of the object.
59
+ def to_s
60
+ class_name = self.class.name.split('::').last
61
+ "<#{class_name} value: #{@value}, symbol: #{@symbol}>"
62
+ end
63
+
64
+ # Provides a debugging-friendly string with detailed object information.
65
+ def inspect
66
+ class_name = self.class.name.split('::').last
67
+ "<#{class_name} value: #{@value.inspect}, symbol: #{@symbol.inspect}>"
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,93 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # ApiErrorModel Model.
8
+ class ApiErrorModel < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :code
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :message
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :additional_info
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [Hash[String, String]]
26
+ attr_accessor :extra_data
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['code'] = 'Code'
32
+ @_hash['message'] = 'Message'
33
+ @_hash['additional_info'] = 'AdditionalInfo'
34
+ @_hash['extra_data'] = 'ExtraData'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ code
42
+ message
43
+ additional_info
44
+ extra_data
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(code = SKIP, message = SKIP, additional_info = SKIP,
54
+ extra_data = SKIP)
55
+ @code = code unless code == SKIP
56
+ @message = message unless message == SKIP
57
+ @additional_info = additional_info unless additional_info == SKIP
58
+ @extra_data = extra_data unless extra_data == SKIP
59
+ end
60
+
61
+ # Creates an instance of the object from a hash.
62
+ def self.from_hash(hash)
63
+ return nil unless hash
64
+
65
+ # Extract variables from the hash.
66
+ code = hash.key?('Code') ? hash['Code'] : SKIP
67
+ message = hash.key?('Message') ? hash['Message'] : SKIP
68
+ additional_info =
69
+ hash.key?('AdditionalInfo') ? hash['AdditionalInfo'] : SKIP
70
+ extra_data = hash.key?('ExtraData') ? hash['ExtraData'] : SKIP
71
+
72
+ # Create object from extracted values.
73
+ ApiErrorModel.new(code,
74
+ message,
75
+ additional_info,
76
+ extra_data)
77
+ end
78
+
79
+ # Provides a human-readable string representation of the object.
80
+ def to_s
81
+ class_name = self.class.name.split('::').last
82
+ "<#{class_name} code: #{@code}, message: #{@message}, additional_info: #{@additional_info},"\
83
+ " extra_data: #{@extra_data}>"
84
+ end
85
+
86
+ # Provides a debugging-friendly string with detailed object information.
87
+ def inspect
88
+ class_name = self.class.name.split('::').last
89
+ "<#{class_name} code: #{@code.inspect}, message: #{@message.inspect}, additional_info:"\
90
+ " #{@additional_info.inspect}, extra_data: #{@extra_data.inspect}>"
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,70 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # AprData Model.
8
+ class AprData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Float]
14
+ attr_accessor :value
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :symbol
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['value'] = 'Value'
24
+ @_hash['symbol'] = 'Symbol'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ symbol
32
+ ]
33
+ end
34
+
35
+ # An array for nullable fields
36
+ def self.nullables
37
+ []
38
+ end
39
+
40
+ def initialize(value = nil, symbol = SKIP)
41
+ @value = value
42
+ @symbol = symbol unless symbol == SKIP
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ value = hash.key?('Value') ? hash['Value'] : nil
51
+ symbol = hash.key?('Symbol') ? hash['Symbol'] : SKIP
52
+
53
+ # Create object from extracted values.
54
+ AprData.new(value,
55
+ symbol)
56
+ end
57
+
58
+ # Provides a human-readable string representation of the object.
59
+ def to_s
60
+ class_name = self.class.name.split('::').last
61
+ "<#{class_name} value: #{@value}, symbol: #{@symbol}>"
62
+ end
63
+
64
+ # Provides a debugging-friendly string with detailed object information.
65
+ def inspect
66
+ class_name = self.class.name.split('::').last
67
+ "<#{class_name} value: #{@value.inspect}, symbol: #{@symbol.inspect}>"
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,40 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # AuthorizationStatus.
8
+ class AuthorizationStatusEnum
9
+ AUTHORIZATION_STATUS_ENUM = [
10
+ # Authorization succeeded
11
+ SUCCEEDED = 'Succeeded'.freeze,
12
+
13
+ # Waiting for 3DS authentication
14
+ PENDING3DS = 'Pending3DS'.freeze,
15
+
16
+ # Authorization Failed
17
+ FAILED = 'Failed'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ AUTHORIZATION_STATUS_ENUM.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = SUCCEEDED)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'succeeded' then SUCCEEDED
33
+ when 'pending3ds' then PENDING3DS
34
+ when 'failed' then FAILED
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,154 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # AuthorizeAuthorizationData Model.
8
+ class AuthorizeAuthorizationData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [AuthorizationStatusEnum]
14
+ attr_accessor :status
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :splitit_error_result_code
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :gateway_transaction_id
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :gateway_result_code
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :gateway_result_message
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [ThreeDSRedirectData]
34
+ attr_accessor :three_ds_redirect
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [String]
38
+ attr_accessor :cavv
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [String]
42
+ attr_accessor :eci
43
+
44
+ # TODO: Write general description for this method
45
+ # @return [String]
46
+ attr_accessor :gateway_source_response
47
+
48
+ # A mapping from model property names to API property names.
49
+ def self.names
50
+ @_hash = {} if @_hash.nil?
51
+ @_hash['status'] = 'Status'
52
+ @_hash['splitit_error_result_code'] = 'SplititErrorResultCode'
53
+ @_hash['gateway_transaction_id'] = 'GatewayTransactionID'
54
+ @_hash['gateway_result_code'] = 'GatewayResultCode'
55
+ @_hash['gateway_result_message'] = 'GatewayResultMessage'
56
+ @_hash['three_ds_redirect'] = 'ThreeDSRedirect'
57
+ @_hash['cavv'] = 'CAVV'
58
+ @_hash['eci'] = 'ECI'
59
+ @_hash['gateway_source_response'] = 'GatewaySourceResponse'
60
+ @_hash
61
+ end
62
+
63
+ # An array for optional fields
64
+ def self.optionals
65
+ %w[
66
+ splitit_error_result_code
67
+ gateway_transaction_id
68
+ gateway_result_code
69
+ gateway_result_message
70
+ three_ds_redirect
71
+ cavv
72
+ eci
73
+ gateway_source_response
74
+ ]
75
+ end
76
+
77
+ # An array for nullable fields
78
+ def self.nullables
79
+ []
80
+ end
81
+
82
+ def initialize(status = nil, splitit_error_result_code = SKIP,
83
+ gateway_transaction_id = SKIP, gateway_result_code = SKIP,
84
+ gateway_result_message = SKIP, three_ds_redirect = SKIP,
85
+ cavv = SKIP, eci = SKIP, gateway_source_response = SKIP)
86
+ @status = status
87
+ unless splitit_error_result_code == SKIP
88
+ @splitit_error_result_code =
89
+ splitit_error_result_code
90
+ end
91
+ @gateway_transaction_id = gateway_transaction_id unless gateway_transaction_id == SKIP
92
+ @gateway_result_code = gateway_result_code unless gateway_result_code == SKIP
93
+ @gateway_result_message = gateway_result_message unless gateway_result_message == SKIP
94
+ @three_ds_redirect = three_ds_redirect unless three_ds_redirect == SKIP
95
+ @cavv = cavv unless cavv == SKIP
96
+ @eci = eci unless eci == SKIP
97
+ @gateway_source_response = gateway_source_response unless gateway_source_response == SKIP
98
+ end
99
+
100
+ # Creates an instance of the object from a hash.
101
+ def self.from_hash(hash)
102
+ return nil unless hash
103
+
104
+ # Extract variables from the hash.
105
+ status = hash.key?('Status') ? hash['Status'] : nil
106
+ splitit_error_result_code =
107
+ hash.key?('SplititErrorResultCode') ? hash['SplititErrorResultCode'] : SKIP
108
+ gateway_transaction_id =
109
+ hash.key?('GatewayTransactionID') ? hash['GatewayTransactionID'] : SKIP
110
+ gateway_result_code =
111
+ hash.key?('GatewayResultCode') ? hash['GatewayResultCode'] : SKIP
112
+ gateway_result_message =
113
+ hash.key?('GatewayResultMessage') ? hash['GatewayResultMessage'] : SKIP
114
+ three_ds_redirect = ThreeDSRedirectData.from_hash(hash['ThreeDSRedirect']) if
115
+ hash['ThreeDSRedirect']
116
+ cavv = hash.key?('CAVV') ? hash['CAVV'] : SKIP
117
+ eci = hash.key?('ECI') ? hash['ECI'] : SKIP
118
+ gateway_source_response =
119
+ hash.key?('GatewaySourceResponse') ? hash['GatewaySourceResponse'] : SKIP
120
+
121
+ # Create object from extracted values.
122
+ AuthorizeAuthorizationData.new(status,
123
+ splitit_error_result_code,
124
+ gateway_transaction_id,
125
+ gateway_result_code,
126
+ gateway_result_message,
127
+ three_ds_redirect,
128
+ cavv,
129
+ eci,
130
+ gateway_source_response)
131
+ end
132
+
133
+ # Provides a human-readable string representation of the object.
134
+ def to_s
135
+ class_name = self.class.name.split('::').last
136
+ "<#{class_name} status: #{@status}, splitit_error_result_code:"\
137
+ " #{@splitit_error_result_code}, gateway_transaction_id: #{@gateway_transaction_id},"\
138
+ " gateway_result_code: #{@gateway_result_code}, gateway_result_message:"\
139
+ " #{@gateway_result_message}, three_ds_redirect: #{@three_ds_redirect}, cavv: #{@cavv}, eci:"\
140
+ " #{@eci}, gateway_source_response: #{@gateway_source_response}>"
141
+ end
142
+
143
+ # Provides a debugging-friendly string with detailed object information.
144
+ def inspect
145
+ class_name = self.class.name.split('::').last
146
+ "<#{class_name} status: #{@status.inspect}, splitit_error_result_code:"\
147
+ " #{@splitit_error_result_code.inspect}, gateway_transaction_id:"\
148
+ " #{@gateway_transaction_id.inspect}, gateway_result_code: #{@gateway_result_code.inspect},"\
149
+ " gateway_result_message: #{@gateway_result_message.inspect}, three_ds_redirect:"\
150
+ " #{@three_ds_redirect.inspect}, cavv: #{@cavv.inspect}, eci: #{@eci.inspect},"\
151
+ " gateway_source_response: #{@gateway_source_response.inspect}>"
152
+ end
153
+ end
154
+ end
@@ -0,0 +1,115 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # AuthorizeRequest Model.
8
+ class AuthorizeRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :offer_id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [TrueClass | FalseClass]
18
+ attr_accessor :auto_capture
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [TrueClass | FalseClass]
22
+ attr_accessor :shopper_accepted_terms
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :merchant_order_reference
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [ThreeDSRequestData]
30
+ attr_accessor :three_ds
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [ProcessingData]
34
+ attr_accessor :processing_data
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['offer_id'] = 'OfferId'
40
+ @_hash['auto_capture'] = 'AutoCapture'
41
+ @_hash['shopper_accepted_terms'] = 'ShopperAcceptedTerms'
42
+ @_hash['merchant_order_reference'] = 'MerchantOrderReference'
43
+ @_hash['three_ds'] = 'ThreeDS'
44
+ @_hash['processing_data'] = 'ProcessingData'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ merchant_order_reference
52
+ three_ds
53
+ processing_data
54
+ ]
55
+ end
56
+
57
+ # An array for nullable fields
58
+ def self.nullables
59
+ []
60
+ end
61
+
62
+ def initialize(offer_id = nil, auto_capture = nil,
63
+ shopper_accepted_terms = nil,
64
+ merchant_order_reference = SKIP, three_ds = SKIP,
65
+ processing_data = SKIP)
66
+ @offer_id = offer_id
67
+ @auto_capture = auto_capture
68
+ @shopper_accepted_terms = shopper_accepted_terms
69
+ @merchant_order_reference = merchant_order_reference unless merchant_order_reference == SKIP
70
+ @three_ds = three_ds unless three_ds == SKIP
71
+ @processing_data = processing_data unless processing_data == SKIP
72
+ end
73
+
74
+ # Creates an instance of the object from a hash.
75
+ def self.from_hash(hash)
76
+ return nil unless hash
77
+
78
+ # Extract variables from the hash.
79
+ offer_id = hash.key?('OfferId') ? hash['OfferId'] : nil
80
+ auto_capture = hash.key?('AutoCapture') ? hash['AutoCapture'] : nil
81
+ shopper_accepted_terms =
82
+ hash.key?('ShopperAcceptedTerms') ? hash['ShopperAcceptedTerms'] : nil
83
+ merchant_order_reference =
84
+ hash.key?('MerchantOrderReference') ? hash['MerchantOrderReference'] : SKIP
85
+ three_ds = ThreeDSRequestData.from_hash(hash['ThreeDS']) if hash['ThreeDS']
86
+ processing_data = ProcessingData.from_hash(hash['ProcessingData']) if hash['ProcessingData']
87
+
88
+ # Create object from extracted values.
89
+ AuthorizeRequest.new(offer_id,
90
+ auto_capture,
91
+ shopper_accepted_terms,
92
+ merchant_order_reference,
93
+ three_ds,
94
+ processing_data)
95
+ end
96
+
97
+ # Provides a human-readable string representation of the object.
98
+ def to_s
99
+ class_name = self.class.name.split('::').last
100
+ "<#{class_name} offer_id: #{@offer_id}, auto_capture: #{@auto_capture},"\
101
+ " shopper_accepted_terms: #{@shopper_accepted_terms}, merchant_order_reference:"\
102
+ " #{@merchant_order_reference}, three_ds: #{@three_ds}, processing_data:"\
103
+ " #{@processing_data}>"
104
+ end
105
+
106
+ # Provides a debugging-friendly string with detailed object information.
107
+ def inspect
108
+ class_name = self.class.name.split('::').last
109
+ "<#{class_name} offer_id: #{@offer_id.inspect}, auto_capture: #{@auto_capture.inspect},"\
110
+ " shopper_accepted_terms: #{@shopper_accepted_terms.inspect}, merchant_order_reference:"\
111
+ " #{@merchant_order_reference.inspect}, three_ds: #{@three_ds.inspect}, processing_data:"\
112
+ " #{@processing_data.inspect}>"
113
+ end
114
+ end
115
+ end