citypay_api_client 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 (115) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +176 -0
  4. data/Rakefile +10 -0
  5. data/citypay_api_client.gemspec +39 -0
  6. data/docs/AccountCreate.md +19 -0
  7. data/docs/AccountStatus.md +17 -0
  8. data/docs/Acknowledgement.md +23 -0
  9. data/docs/AirlineAdvice.md +47 -0
  10. data/docs/AirlineSegment.md +31 -0
  11. data/docs/AuthReference.md +43 -0
  12. data/docs/AuthReferences.md +17 -0
  13. data/docs/AuthRequest.md +59 -0
  14. data/docs/AuthResponse.md +69 -0
  15. data/docs/AuthenRequired.md +21 -0
  16. data/docs/CResAuthRequest.md +17 -0
  17. data/docs/CaptureRequest.md +27 -0
  18. data/docs/Card.md +51 -0
  19. data/docs/CardHolderAccount.md +31 -0
  20. data/docs/CardHolderAccountApi.md +515 -0
  21. data/docs/CardStatus.md +19 -0
  22. data/docs/ChargeRequest.md +41 -0
  23. data/docs/ContactDetails.md +41 -0
  24. data/docs/Decision.md +21 -0
  25. data/docs/Error.md +23 -0
  26. data/docs/ExternalMPI.md +25 -0
  27. data/docs/ListMerchantsResponse.md +21 -0
  28. data/docs/MCC6012.md +23 -0
  29. data/docs/Merchant.md +25 -0
  30. data/docs/OperationalApi.md +118 -0
  31. data/docs/PaResAuthRequest.md +19 -0
  32. data/docs/PaymentProcessingApi.md +338 -0
  33. data/docs/Ping.md +17 -0
  34. data/docs/RegisterCard.md +23 -0
  35. data/docs/RequestChallenged.md +25 -0
  36. data/docs/RetrieveRequest.md +21 -0
  37. data/docs/ThreeDSecure.md +25 -0
  38. data/docs/VoidRequest.md +23 -0
  39. data/git_push.sh +58 -0
  40. data/lib/citypay_api_client.rb +72 -0
  41. data/lib/citypay_api_client/api/card_holder_account_api.rb +628 -0
  42. data/lib/citypay_api_client/api/operational_api.rb +148 -0
  43. data/lib/citypay_api_client/api/payment_processing_api.rb +406 -0
  44. data/lib/citypay_api_client/api_client.rb +388 -0
  45. data/lib/citypay_api_client/api_error.rb +57 -0
  46. data/lib/citypay_api_client/configuration.rb +252 -0
  47. data/lib/citypay_api_client/models/account_create.rb +249 -0
  48. data/lib/citypay_api_client/models/account_status.rb +207 -0
  49. data/lib/citypay_api_client/models/acknowledgement.rb +285 -0
  50. data/lib/citypay_api_client/models/airline_advice.rb +551 -0
  51. data/lib/citypay_api_client/models/airline_segment.rb +408 -0
  52. data/lib/citypay_api_client/models/api_key.rb +53 -0
  53. data/lib/citypay_api_client/models/auth_reference.rb +400 -0
  54. data/lib/citypay_api_client/models/auth_references.rb +208 -0
  55. data/lib/citypay_api_client/models/auth_request.rb +631 -0
  56. data/lib/citypay_api_client/models/auth_response.rb +563 -0
  57. data/lib/citypay_api_client/models/authen_required.rb +227 -0
  58. data/lib/citypay_api_client/models/c_res_auth_request.rb +207 -0
  59. data/lib/citypay_api_client/models/capture_request.rb +285 -0
  60. data/lib/citypay_api_client/models/card.rb +425 -0
  61. data/lib/citypay_api_client/models/card_holder_account.rb +315 -0
  62. data/lib/citypay_api_client/models/card_status.rb +217 -0
  63. data/lib/citypay_api_client/models/charge_request.rb +453 -0
  64. data/lib/citypay_api_client/models/contact_details.rb +456 -0
  65. data/lib/citypay_api_client/models/decision.rb +224 -0
  66. data/lib/citypay_api_client/models/error.rb +285 -0
  67. data/lib/citypay_api_client/models/external_mpi.rb +307 -0
  68. data/lib/citypay_api_client/models/list_merchants_response.rb +252 -0
  69. data/lib/citypay_api_client/models/mcc6012.rb +237 -0
  70. data/lib/citypay_api_client/models/merchant.rb +247 -0
  71. data/lib/citypay_api_client/models/pa_res_auth_request.rb +227 -0
  72. data/lib/citypay_api_client/models/ping.rb +231 -0
  73. data/lib/citypay_api_client/models/register_card.rb +336 -0
  74. data/lib/citypay_api_client/models/request_challenged.rb +247 -0
  75. data/lib/citypay_api_client/models/retrieve_request.rb +256 -0
  76. data/lib/citypay_api_client/models/three_d_secure.rb +247 -0
  77. data/lib/citypay_api_client/models/void_request.rb +266 -0
  78. data/lib/citypay_api_client/version.rb +15 -0
  79. data/spec/api/card_holder_account_api_spec.rb +149 -0
  80. data/spec/api/operational_api_spec.rb +59 -0
  81. data/spec/api/payment_processing_api_spec.rb +107 -0
  82. data/spec/api_client_spec.rb +226 -0
  83. data/spec/configuration_spec.rb +42 -0
  84. data/spec/models/account_create_spec.rb +47 -0
  85. data/spec/models/account_status_spec.rb +41 -0
  86. data/spec/models/acknowledgement_spec.rb +59 -0
  87. data/spec/models/airline_advice_spec.rb +131 -0
  88. data/spec/models/airline_segment_spec.rb +83 -0
  89. data/spec/models/auth_reference_spec.rb +119 -0
  90. data/spec/models/auth_references_spec.rb +41 -0
  91. data/spec/models/auth_request_spec.rb +167 -0
  92. data/spec/models/auth_response_spec.rb +197 -0
  93. data/spec/models/authen_required_spec.rb +53 -0
  94. data/spec/models/c_res_auth_request_spec.rb +41 -0
  95. data/spec/models/capture_request_spec.rb +71 -0
  96. data/spec/models/card_holder_account_spec.rb +83 -0
  97. data/spec/models/card_spec.rb +143 -0
  98. data/spec/models/card_status_spec.rb +47 -0
  99. data/spec/models/charge_request_spec.rb +113 -0
  100. data/spec/models/contact_details_spec.rb +113 -0
  101. data/spec/models/decision_spec.rb +53 -0
  102. data/spec/models/error_spec.rb +59 -0
  103. data/spec/models/external_mpi_spec.rb +65 -0
  104. data/spec/models/list_merchants_response_spec.rb +53 -0
  105. data/spec/models/mcc6012_spec.rb +59 -0
  106. data/spec/models/merchant_spec.rb +65 -0
  107. data/spec/models/pa_res_auth_request_spec.rb +47 -0
  108. data/spec/models/ping_spec.rb +41 -0
  109. data/spec/models/register_card_spec.rb +59 -0
  110. data/spec/models/request_challenged_spec.rb +65 -0
  111. data/spec/models/retrieve_request_spec.rb +53 -0
  112. data/spec/models/three_d_secure_spec.rb +65 -0
  113. data/spec/models/void_request_spec.rb +59 -0
  114. data/spec/spec_helper.rb +111 -0
  115. metadata +252 -0
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #CityPay Payment API
3
+
4
+ # This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security <aside class=\"notice\"> Before we begin a reminder that your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council including: </aside> * Data must be collected using TLS version 1.2 using [strong cryptography](#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive card holder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
5
+
6
+ The version of the OpenAPI document: 6.0.0
7
+ Contact: support@citypay.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CityPayApiClient
16
+ class RetrieveRequest
17
+ # The identifier of the transaction to retrieve. Optional if a transaction number is provided.
18
+ attr_accessor :identifier
19
+
20
+ # The merchant account to retrieve data for.
21
+ attr_accessor :merchantid
22
+
23
+ # The transaction number of a transaction to retrieve. Optional if an identifier is supplied.
24
+ attr_accessor :transno
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'identifier' => :'identifier',
30
+ :'merchantid' => :'merchantid',
31
+ :'transno' => :'transno'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'identifier' => :'String',
39
+ :'merchantid' => :'Integer',
40
+ :'transno' => :'Integer'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::RetrieveRequest` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::RetrieveRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'identifier')
66
+ self.identifier = attributes[:'identifier']
67
+ end
68
+
69
+ if attributes.key?(:'merchantid')
70
+ self.merchantid = attributes[:'merchantid']
71
+ end
72
+
73
+ if attributes.key?(:'transno')
74
+ self.transno = attributes[:'transno']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ if !@identifier.nil? && @identifier.to_s.length > 50
83
+ invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 50.')
84
+ end
85
+
86
+ if !@identifier.nil? && @identifier.to_s.length < 4
87
+ invalid_properties.push('invalid value for "identifier", the character length must be great than or equal to 4.')
88
+ end
89
+
90
+ if @merchantid.nil?
91
+ invalid_properties.push('invalid value for "merchantid", merchantid cannot be nil.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if !@identifier.nil? && @identifier.to_s.length > 50
101
+ return false if !@identifier.nil? && @identifier.to_s.length < 4
102
+ return false if @merchantid.nil?
103
+ true
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] identifier Value to be assigned
108
+ def identifier=(identifier)
109
+ if !identifier.nil? && identifier.to_s.length > 50
110
+ fail ArgumentError, 'invalid value for "identifier", the character length must be smaller than or equal to 50.'
111
+ end
112
+
113
+ if !identifier.nil? && identifier.to_s.length < 4
114
+ fail ArgumentError, 'invalid value for "identifier", the character length must be great than or equal to 4.'
115
+ end
116
+
117
+ @identifier = identifier
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ identifier == o.identifier &&
126
+ merchantid == o.merchantid &&
127
+ transno == o.transno
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [identifier, merchantid, transno].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ new.build_from_hash(attributes)
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ self.class.openapi_types.each_pair do |key, type|
155
+ if type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :DateTime
176
+ DateTime.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :Boolean
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :Object
192
+ # generic object (usually a Hash), return directly
193
+ value
194
+ when /\AArray<(?<inner_type>.+)>\z/
195
+ inner_type = Regexp.last_match[:inner_type]
196
+ value.map { |v| _deserialize(inner_type, v) }
197
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
+ k_type = Regexp.last_match[:k_type]
199
+ v_type = Regexp.last_match[:v_type]
200
+ {}.tap do |hash|
201
+ value.each do |k, v|
202
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
+ end
204
+ end
205
+ else # model
206
+ CityPayApiClient.const_get(type).build_from_hash(value)
207
+ end
208
+ end
209
+
210
+ # Returns the string representation of the object
211
+ # @return [String] String presentation of the object
212
+ def to_s
213
+ to_hash.to_s
214
+ end
215
+
216
+ # to_body is an alias to to_hash (backward compatibility)
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_body
219
+ to_hash
220
+ end
221
+
222
+ # Returns the object in the form of hash
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_hash
225
+ hash = {}
226
+ self.class.attribute_map.each_pair do |attr, param|
227
+ value = self.send(attr)
228
+ if value.nil?
229
+ is_nullable = self.class.openapi_nullable.include?(attr)
230
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
231
+ end
232
+
233
+ hash[param] = _to_hash(value)
234
+ end
235
+ hash
236
+ end
237
+
238
+ # Outputs non-array value in the form of hash
239
+ # For object, use to_hash. Otherwise, just return the value
240
+ # @param [Object] value Any valid value
241
+ # @return [Hash] Returns the value in the form of hash
242
+ def _to_hash(value)
243
+ if value.is_a?(Array)
244
+ value.compact.map { |v| _to_hash(v) }
245
+ elsif value.is_a?(Hash)
246
+ {}.tap do |hash|
247
+ value.each { |k, v| hash[k] = _to_hash(v) }
248
+ end
249
+ elsif value.respond_to? :to_hash
250
+ value.to_hash
251
+ else
252
+ value
253
+ end
254
+ end
255
+ end
256
+ end
@@ -0,0 +1,247 @@
1
+ =begin
2
+ #CityPay Payment API
3
+
4
+ # This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security <aside class=\"notice\"> Before we begin a reminder that your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council including: </aside> * Data must be collected using TLS version 1.2 using [strong cryptography](#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive card holder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
5
+
6
+ The version of the OpenAPI document: 6.0.0
7
+ Contact: support@citypay.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CityPayApiClient
16
+ class ThreeDSecure
17
+ # The content of the HTTP accept header as sent to the merchant from the cardholder's user agent. This value will be validated by the ACS when the card holder authenticates themselves to verify that no intermediary is performing this action. Required for 3DSv1.
18
+ attr_accessor :accept_headers
19
+
20
+ # Where a merchant is configured for 3DSv2, setting this option will attempt to downgrade the transaction to 3DSv1.
21
+ attr_accessor :downgrade1
22
+
23
+ # A controller URL for 3D-Secure processing that any response from an authentication request or challenge request should be sent to. The controller should forward on the response from the URL back via this API for subsequent processing. Required if 3DSv1 or 3DSv2 is required.
24
+ attr_accessor :merchant_termurl
25
+
26
+ # A policy value which determines whether ThreeDSecure is enforced or bypassed. Note that this will only work for e-commerce transactions and accounts that have 3DSecure enabled and fully registered with Visa, MasterCard or American Express. It is useful when transactions may be wanted to bypass processing rules. Note that this may affect the liability shift of transactions and may occur a higher fee with the acquiring bank. Values are `0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions will be enabled for 3DS processing `2` to bypass. Transactions that are bypassed will switch off 3DS processing.
27
+ attr_accessor :tds_policy
28
+
29
+ # The content of the HTTP user-agent header as sent to the merchant from the cardholder's user agent. This value will be validated by the ACS when the card holder authenticates themselves to verify that no intermediary is performing this action. Required for 3DSv1.
30
+ attr_accessor :user_agent
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'accept_headers' => :'accept_headers',
36
+ :'downgrade1' => :'downgrade1',
37
+ :'merchant_termurl' => :'merchant_termurl',
38
+ :'tds_policy' => :'tds_policy',
39
+ :'user_agent' => :'user_agent'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'accept_headers' => :'String',
47
+ :'downgrade1' => :'Boolean',
48
+ :'merchant_termurl' => :'String',
49
+ :'tds_policy' => :'String',
50
+ :'user_agent' => :'String'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::ThreeDSecure` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::ThreeDSecure`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'accept_headers')
76
+ self.accept_headers = attributes[:'accept_headers']
77
+ end
78
+
79
+ if attributes.key?(:'downgrade1')
80
+ self.downgrade1 = attributes[:'downgrade1']
81
+ end
82
+
83
+ if attributes.key?(:'merchant_termurl')
84
+ self.merchant_termurl = attributes[:'merchant_termurl']
85
+ end
86
+
87
+ if attributes.key?(:'tds_policy')
88
+ self.tds_policy = attributes[:'tds_policy']
89
+ end
90
+
91
+ if attributes.key?(:'user_agent')
92
+ self.user_agent = attributes[:'user_agent']
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = Array.new
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ accept_headers == o.accept_headers &&
115
+ downgrade1 == o.downgrade1 &&
116
+ merchant_termurl == o.merchant_termurl &&
117
+ tds_policy == o.tds_policy &&
118
+ user_agent == o.user_agent
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [accept_headers, downgrade1, merchant_termurl, tds_policy, user_agent].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ new.build_from_hash(attributes)
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
150
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
151
+ end
152
+ elsif !attributes[self.class.attribute_map[key]].nil?
153
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :DateTime
167
+ DateTime.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ CityPayApiClient.const_get(type).build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+ end
247
+ end