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,307 @@
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 ExternalMPI
17
+ # The authentication result available from the MPI.
18
+ attr_accessor :authen_result
19
+
20
+ # A value determining the cardholder verification value supplied by the card scheme.
21
+ attr_accessor :cavv
22
+
23
+ # The obtained e-commerce indicator from the MPI.
24
+ attr_accessor :eci
25
+
26
+ # A value determining whether the card holder was enrolled.
27
+ attr_accessor :enrolled
28
+
29
+ # The XID used for processing with the MPI.
30
+ attr_accessor :xid
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'authen_result' => :'authen_result',
36
+ :'cavv' => :'cavv',
37
+ :'eci' => :'eci',
38
+ :'enrolled' => :'enrolled',
39
+ :'xid' => :'xid'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'authen_result' => :'String',
47
+ :'cavv' => :'String',
48
+ :'eci' => :'Integer',
49
+ :'enrolled' => :'String',
50
+ :'xid' => :'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::ExternalMPI` 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::ExternalMPI`. 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?(:'authen_result')
76
+ self.authen_result = attributes[:'authen_result']
77
+ end
78
+
79
+ if attributes.key?(:'cavv')
80
+ self.cavv = attributes[:'cavv']
81
+ end
82
+
83
+ if attributes.key?(:'eci')
84
+ self.eci = attributes[:'eci']
85
+ end
86
+
87
+ if attributes.key?(:'enrolled')
88
+ self.enrolled = attributes[:'enrolled']
89
+ end
90
+
91
+ if attributes.key?(:'xid')
92
+ self.xid = attributes[:'xid']
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
+ if !@authen_result.nil? && @authen_result.to_s.length > 1
101
+ invalid_properties.push('invalid value for "authen_result", the character length must be smaller than or equal to 1.')
102
+ end
103
+
104
+ if !@cavv.nil? && @cavv.to_s.length > 20
105
+ invalid_properties.push('invalid value for "cavv", the character length must be smaller than or equal to 20.')
106
+ end
107
+
108
+ if !@enrolled.nil? && @enrolled.to_s.length > 1
109
+ invalid_properties.push('invalid value for "enrolled", the character length must be smaller than or equal to 1.')
110
+ end
111
+
112
+ if !@xid.nil? && @xid.to_s.length > 20
113
+ invalid_properties.push('invalid value for "xid", the character length must be smaller than or equal to 20.')
114
+ end
115
+
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ return false if !@authen_result.nil? && @authen_result.to_s.length > 1
123
+ return false if !@cavv.nil? && @cavv.to_s.length > 20
124
+ return false if !@enrolled.nil? && @enrolled.to_s.length > 1
125
+ return false if !@xid.nil? && @xid.to_s.length > 20
126
+ true
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] authen_result Value to be assigned
131
+ def authen_result=(authen_result)
132
+ if !authen_result.nil? && authen_result.to_s.length > 1
133
+ fail ArgumentError, 'invalid value for "authen_result", the character length must be smaller than or equal to 1.'
134
+ end
135
+
136
+ @authen_result = authen_result
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] cavv Value to be assigned
141
+ def cavv=(cavv)
142
+ if !cavv.nil? && cavv.to_s.length > 20
143
+ fail ArgumentError, 'invalid value for "cavv", the character length must be smaller than or equal to 20.'
144
+ end
145
+
146
+ @cavv = cavv
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] enrolled Value to be assigned
151
+ def enrolled=(enrolled)
152
+ if !enrolled.nil? && enrolled.to_s.length > 1
153
+ fail ArgumentError, 'invalid value for "enrolled", the character length must be smaller than or equal to 1.'
154
+ end
155
+
156
+ @enrolled = enrolled
157
+ end
158
+
159
+ # Custom attribute writer method with validation
160
+ # @param [Object] xid Value to be assigned
161
+ def xid=(xid)
162
+ if !xid.nil? && xid.to_s.length > 20
163
+ fail ArgumentError, 'invalid value for "xid", the character length must be smaller than or equal to 20.'
164
+ end
165
+
166
+ @xid = xid
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ authen_result == o.authen_result &&
175
+ cavv == o.cavv &&
176
+ eci == o.eci &&
177
+ enrolled == o.enrolled &&
178
+ xid == o.xid
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Integer] Hash code
189
+ def hash
190
+ [authen_result, cavv, eci, enrolled, xid].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def self.build_from_hash(attributes)
197
+ new.build_from_hash(attributes)
198
+ end
199
+
200
+ # Builds the object from hash
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ # @return [Object] Returns the model itself
203
+ def build_from_hash(attributes)
204
+ return nil unless attributes.is_a?(Hash)
205
+ self.class.openapi_types.each_pair do |key, type|
206
+ if type =~ /\AArray<(.*)>/i
207
+ # check to ensure the input is an array given that the attribute
208
+ # is documented as an array but the input is not
209
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
210
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
211
+ end
212
+ elsif !attributes[self.class.attribute_map[key]].nil?
213
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
214
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
215
+ end
216
+
217
+ self
218
+ end
219
+
220
+ # Deserializes the data based on type
221
+ # @param string type Data type
222
+ # @param string value Value to be deserialized
223
+ # @return [Object] Deserialized data
224
+ def _deserialize(type, value)
225
+ case type.to_sym
226
+ when :DateTime
227
+ DateTime.parse(value)
228
+ when :Date
229
+ Date.parse(value)
230
+ when :String
231
+ value.to_s
232
+ when :Integer
233
+ value.to_i
234
+ when :Float
235
+ value.to_f
236
+ when :Boolean
237
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
238
+ true
239
+ else
240
+ false
241
+ end
242
+ when :Object
243
+ # generic object (usually a Hash), return directly
244
+ value
245
+ when /\AArray<(?<inner_type>.+)>\z/
246
+ inner_type = Regexp.last_match[:inner_type]
247
+ value.map { |v| _deserialize(inner_type, v) }
248
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
249
+ k_type = Regexp.last_match[:k_type]
250
+ v_type = Regexp.last_match[:v_type]
251
+ {}.tap do |hash|
252
+ value.each do |k, v|
253
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
254
+ end
255
+ end
256
+ else # model
257
+ CityPayApiClient.const_get(type).build_from_hash(value)
258
+ end
259
+ end
260
+
261
+ # Returns the string representation of the object
262
+ # @return [String] String presentation of the object
263
+ def to_s
264
+ to_hash.to_s
265
+ end
266
+
267
+ # to_body is an alias to to_hash (backward compatibility)
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_body
270
+ to_hash
271
+ end
272
+
273
+ # Returns the object in the form of hash
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_hash
276
+ hash = {}
277
+ self.class.attribute_map.each_pair do |attr, param|
278
+ value = self.send(attr)
279
+ if value.nil?
280
+ is_nullable = self.class.openapi_nullable.include?(attr)
281
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
282
+ end
283
+
284
+ hash[param] = _to_hash(value)
285
+ end
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map { |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to? :to_hash
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+ end
307
+ end
@@ -0,0 +1,252 @@
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 ListMerchantsResponse
17
+ # The client name that was requested.
18
+ attr_accessor :client_name
19
+
20
+ # The client id requested.
21
+ attr_accessor :clientid
22
+
23
+ attr_accessor :merchants
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'client_name' => :'client_name',
29
+ :'clientid' => :'clientid',
30
+ :'merchants' => :'merchants'
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'client_name' => :'String',
38
+ :'clientid' => :'String',
39
+ :'merchants' => :'Array<Merchant>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::ListMerchantsResponse` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::ListMerchantsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'client_name')
65
+ self.client_name = attributes[:'client_name']
66
+ end
67
+
68
+ if attributes.key?(:'clientid')
69
+ self.clientid = attributes[:'clientid']
70
+ end
71
+
72
+ if attributes.key?(:'merchants')
73
+ if (value = attributes[:'merchants']).is_a?(Array)
74
+ self.merchants = value
75
+ end
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ if !@clientid.nil? && @clientid.to_s.length > 10
84
+ invalid_properties.push('invalid value for "clientid", the character length must be smaller than or equal to 10.')
85
+ end
86
+
87
+ if !@clientid.nil? && @clientid.to_s.length < 3
88
+ invalid_properties.push('invalid value for "clientid", the character length must be great than or equal to 3.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if !@clientid.nil? && @clientid.to_s.length > 10
98
+ return false if !@clientid.nil? && @clientid.to_s.length < 3
99
+ true
100
+ end
101
+
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] clientid Value to be assigned
104
+ def clientid=(clientid)
105
+ if !clientid.nil? && clientid.to_s.length > 10
106
+ fail ArgumentError, 'invalid value for "clientid", the character length must be smaller than or equal to 10.'
107
+ end
108
+
109
+ if !clientid.nil? && clientid.to_s.length < 3
110
+ fail ArgumentError, 'invalid value for "clientid", the character length must be great than or equal to 3.'
111
+ end
112
+
113
+ @clientid = clientid
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ client_name == o.client_name &&
122
+ clientid == o.clientid &&
123
+ merchants == o.merchants
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Integer] Hash code
134
+ def hash
135
+ [client_name, clientid, merchants].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def self.build_from_hash(attributes)
142
+ new.build_from_hash(attributes)
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ self.class.openapi_types.each_pair do |key, type|
151
+ if type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :DateTime
172
+ DateTime.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ CityPayApiClient.const_get(type).build_from_hash(value)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Outputs non-array value in the form of hash
235
+ # For object, use to_hash. Otherwise, just return the value
236
+ # @param [Object] value Any valid value
237
+ # @return [Hash] Returns the value in the form of hash
238
+ def _to_hash(value)
239
+ if value.is_a?(Array)
240
+ value.compact.map { |v| _to_hash(v) }
241
+ elsif value.is_a?(Hash)
242
+ {}.tap do |hash|
243
+ value.each { |k, v| hash[k] = _to_hash(v) }
244
+ end
245
+ elsif value.respond_to? :to_hash
246
+ value.to_hash
247
+ else
248
+ value
249
+ end
250
+ end
251
+ end
252
+ end