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,563 @@
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 AuthResponse
17
+ # The amount of the transaction processed.
18
+ attr_accessor :amount
19
+
20
+ # A reference number provided by the acquirer for a transaction it can be used to cross reference transactions with an Acquirers reporting panel.
21
+ attr_accessor :atrn
22
+
23
+ # Additional Transaction Security Data used for ecommerce transactions to decipher security capabilities and attempts against a transaction.
24
+ attr_accessor :atsd
25
+
26
+ # The authorisation code as returned by the card issuer or acquiring bank when a transaction has successfully been authorised. Authorisation codes contain alphanumeric values. Whilst the code confirms authorisation it should not be used to determine whether a transaction was successfully processed. For instance an auth code may be returned when a transaction has been subsequently declined due to a CSC mismatch.
27
+ attr_accessor :authcode
28
+
29
+ # The result of any authentication using 3d_secure authorisation against ecommerce transactions. Values are | Value | Description | |-------|-------------| | Y | Authentication Successful. The Cardholder's password was successfully validated. | | N | Authentication Failed. Customer failed or cancelled authentication, transaction denied. | | A | Attempts Processing Performed Authentication could not be completed but a proof of authentication attempt (CAVV) was generated | | U | Authentication Could Not Be Performed Authentication could not be completed, due to technical or other problem |
30
+ attr_accessor :authen_result
31
+
32
+ # A boolean definition that indicates that the transaction was authorised. It will return false if the transaction was declined, rejected or cancelled due to CSC matching failures. Attention should be referenced to the AuthResult and Response code for accurate determination of the result.
33
+ attr_accessor :authorised
34
+
35
+ # The AVS result codes determine the result of checking the AVS values within the Address Verification fraud system. If a transaction is declined due to the AVS code not matching, this value can help determine the reason for the decline. | Code | Description | |------|------------| | Y | Address and 5 digit post code match | | M | Street address and Postal codes match for international transaction | | U | No AVS data available from issuer auth system | | A | Addres matches, post code does not | | I | Address information verified for international transaction | | Z | 5 digit post code matches, Address does not | | W | 9 digit post code matches, Address does not | | X | Postcode and address match | | B | Postal code not verified due to incompatible formats | | P | Postal codes match. Street address not verified due to to incompatible formats | | E | AVS Error | | C | Street address and Postal code not verified due to incompatible formats | | D | Street address and postal codes match | | | No information | | N | Neither postcode nor address match | | R | Retry, System unavailble or Timed Out | | S | AVS Service not supported by issuer or processor | | G | Issuer does not participate in AVS |
36
+ attr_accessor :avs_result
37
+
38
+ # Determines whether the bin range was found to be a commercial or business card.
39
+ attr_accessor :bin_commercial
40
+
41
+ # Determines whether the bin range was found to be a debit card. If false the card was considered as a credit card.
42
+ attr_accessor :bin_debit
43
+
44
+ # A description of the bin range found for the card.
45
+ attr_accessor :bin_description
46
+
47
+ # The cardholder authentication verification value which can be returned for verification purposes of the authenticated transaction for dispute realisation.
48
+ attr_accessor :cavv
49
+
50
+ # The context which processed the transaction, can be used for support purposes to trace transactions.
51
+ attr_accessor :context
52
+
53
+ # The CSC rseult codes determine the result of checking the provided CSC value within the Card Security Code fraud system. If a transaction is declined due to the CSC code not matching, this value can help determine the reason for the decline. | Code | Description | |------|------------| | | No information | | M | Card verification data matches | | N | Card verification data was checked but did not match | | P | Card verification was not processed | | S | The card verification data should be on the card but the merchant indicates that it is not | | U | The card issuer is not certified |
54
+ attr_accessor :csc_result
55
+
56
+ # The currency the transaction was processed in. This is an `ISO4217` alpha currency value.
57
+ attr_accessor :currency
58
+
59
+ # The UTC date time of the transaction in ISO data time format.
60
+ attr_accessor :datetime
61
+
62
+ # An Electronic Commerce Indicator (ECI) used to identify the result of authentication using 3DSecure.
63
+ attr_accessor :eci
64
+
65
+ # The identifier provided within the request.
66
+ attr_accessor :identifier
67
+
68
+ # Used to identify that a tranasction was processed on a live authorisation platform.
69
+ attr_accessor :live
70
+
71
+ # A masked value of the card number used for processing displaying limited values that can be used on a receipt.
72
+ attr_accessor :maskedpan
73
+
74
+ # The merchant id that processed this transaction.
75
+ attr_accessor :merchantid
76
+
77
+ # An integer result that indicates the outcome of the transaction. The Code value below maps to the result value | Code | Abbrev | Description | |------|-------|-------------| | 0 | Declined | Declined | | 1 | Accepted | Accepted | | 2 | Rejected | Rejected | | 3 | Not Attempted | Not Attempted | | 4 | Referred | Referred | | 5 | PinRetry | Perform PIN Retry | | 6 | ForSigVer | Force Signature Verification | | 7 | Hold | Hold | | 8 | SecErr | Security Error | | 9 | CallAcq | Call Acquirer | | 10 | DNH | Do Not Honour | | 11 | RtnCrd | Retain Card | | 12 | ExprdCrd | Expired Card | | 13 | InvldCrd | Invalid Card No | | 14 | PinExcd | Pin Tries Exceeded | | 15 | PinInvld | Pin Invalid | | 16 | AuthReq | Authentication Required | | 17 | AuthenFail | Authentication Failed | | 18 | Verified | Card Verified | | 19 | Cancelled | Cancelled | | 20 | Un | Unknown |
78
+ attr_accessor :result
79
+
80
+ # The result code as defined in the Response Codes Reference for example 000 is an accepted live transaction whilst 001 is an accepted test transaction. Result codes identify the source of success and failure. Codes may start with an alpha character i.e. C001 indicating a type of error such as a card validation error.
81
+ attr_accessor :result_code
82
+
83
+ # The message regarding the result which provides further narrative to the result code.
84
+ attr_accessor :result_message
85
+
86
+ # A name of the card scheme of the transaction that processed the transaction such as Visa or MasterCard.
87
+ attr_accessor :scheme
88
+
89
+ # A SHA256 digest value of the transaction used to validate the response data The digest is calculated by concatenating * authcode * amount * response_code * merchant_id * trans_no * identifier * licence_key - which is not provided in the response.
90
+ attr_accessor :sha256
91
+
92
+ # Used to identify the status of a transaction. The status is used to track a transaction through its life cycle. | Id | Description | |----|-------------| | O | Transaction is open for settlement | | A | Transaction is assigned for settlement and can no longer be voided | | S | Transaction has been settled | | D | Transaction has been declined | | R | Transaction has been rejected | | P | Transaction has been authorised only and awaiting a capture. Used in pre-auth situations | | C | Transaction has been cancelled | | E | Transaction has expired | | I | Transaction has been initialised but no action was able to be carried out | | H | Transaction is awaiting authorisation | | . | Transaction is on hold | | V | Transaction has been verified |
93
+ attr_accessor :trans_status
94
+
95
+ # The resulting transaction number, ordered incrementally from 1 for every merchant_id. The value will default to less than 1 for transactions that do not have a transaction number issued.
96
+ attr_accessor :transno
97
+
98
+ # Attribute mapping from ruby-style variable name to JSON key.
99
+ def self.attribute_map
100
+ {
101
+ :'amount' => :'amount',
102
+ :'atrn' => :'atrn',
103
+ :'atsd' => :'atsd',
104
+ :'authcode' => :'authcode',
105
+ :'authen_result' => :'authen_result',
106
+ :'authorised' => :'authorised',
107
+ :'avs_result' => :'avs_result',
108
+ :'bin_commercial' => :'bin_commercial',
109
+ :'bin_debit' => :'bin_debit',
110
+ :'bin_description' => :'bin_description',
111
+ :'cavv' => :'cavv',
112
+ :'context' => :'context',
113
+ :'csc_result' => :'csc_result',
114
+ :'currency' => :'currency',
115
+ :'datetime' => :'datetime',
116
+ :'eci' => :'eci',
117
+ :'identifier' => :'identifier',
118
+ :'live' => :'live',
119
+ :'maskedpan' => :'maskedpan',
120
+ :'merchantid' => :'merchantid',
121
+ :'result' => :'result',
122
+ :'result_code' => :'result_code',
123
+ :'result_message' => :'result_message',
124
+ :'scheme' => :'scheme',
125
+ :'sha256' => :'sha256',
126
+ :'trans_status' => :'trans_status',
127
+ :'transno' => :'transno'
128
+ }
129
+ end
130
+
131
+ # Attribute type mapping.
132
+ def self.openapi_types
133
+ {
134
+ :'amount' => :'Integer',
135
+ :'atrn' => :'String',
136
+ :'atsd' => :'String',
137
+ :'authcode' => :'String',
138
+ :'authen_result' => :'String',
139
+ :'authorised' => :'Boolean',
140
+ :'avs_result' => :'String',
141
+ :'bin_commercial' => :'Boolean',
142
+ :'bin_debit' => :'Boolean',
143
+ :'bin_description' => :'String',
144
+ :'cavv' => :'String',
145
+ :'context' => :'String',
146
+ :'csc_result' => :'String',
147
+ :'currency' => :'String',
148
+ :'datetime' => :'DateTime',
149
+ :'eci' => :'String',
150
+ :'identifier' => :'String',
151
+ :'live' => :'Boolean',
152
+ :'maskedpan' => :'String',
153
+ :'merchantid' => :'Integer',
154
+ :'result' => :'Integer',
155
+ :'result_code' => :'String',
156
+ :'result_message' => :'String',
157
+ :'scheme' => :'String',
158
+ :'sha256' => :'String',
159
+ :'trans_status' => :'String',
160
+ :'transno' => :'Integer'
161
+ }
162
+ end
163
+
164
+ # List of attributes with nullable: true
165
+ def self.openapi_nullable
166
+ Set.new([
167
+ ])
168
+ end
169
+
170
+ # Initializes the object
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ def initialize(attributes = {})
173
+ if (!attributes.is_a?(Hash))
174
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::AuthResponse` initialize method"
175
+ end
176
+
177
+ # check to see if the attribute exists and convert string to symbol for hash key
178
+ attributes = attributes.each_with_object({}) { |(k, v), h|
179
+ if (!self.class.attribute_map.key?(k.to_sym))
180
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::AuthResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
181
+ end
182
+ h[k.to_sym] = v
183
+ }
184
+
185
+ if attributes.key?(:'amount')
186
+ self.amount = attributes[:'amount']
187
+ end
188
+
189
+ if attributes.key?(:'atrn')
190
+ self.atrn = attributes[:'atrn']
191
+ end
192
+
193
+ if attributes.key?(:'atsd')
194
+ self.atsd = attributes[:'atsd']
195
+ end
196
+
197
+ if attributes.key?(:'authcode')
198
+ self.authcode = attributes[:'authcode']
199
+ end
200
+
201
+ if attributes.key?(:'authen_result')
202
+ self.authen_result = attributes[:'authen_result']
203
+ end
204
+
205
+ if attributes.key?(:'authorised')
206
+ self.authorised = attributes[:'authorised']
207
+ end
208
+
209
+ if attributes.key?(:'avs_result')
210
+ self.avs_result = attributes[:'avs_result']
211
+ end
212
+
213
+ if attributes.key?(:'bin_commercial')
214
+ self.bin_commercial = attributes[:'bin_commercial']
215
+ end
216
+
217
+ if attributes.key?(:'bin_debit')
218
+ self.bin_debit = attributes[:'bin_debit']
219
+ end
220
+
221
+ if attributes.key?(:'bin_description')
222
+ self.bin_description = attributes[:'bin_description']
223
+ end
224
+
225
+ if attributes.key?(:'cavv')
226
+ self.cavv = attributes[:'cavv']
227
+ end
228
+
229
+ if attributes.key?(:'context')
230
+ self.context = attributes[:'context']
231
+ end
232
+
233
+ if attributes.key?(:'csc_result')
234
+ self.csc_result = attributes[:'csc_result']
235
+ end
236
+
237
+ if attributes.key?(:'currency')
238
+ self.currency = attributes[:'currency']
239
+ end
240
+
241
+ if attributes.key?(:'datetime')
242
+ self.datetime = attributes[:'datetime']
243
+ end
244
+
245
+ if attributes.key?(:'eci')
246
+ self.eci = attributes[:'eci']
247
+ end
248
+
249
+ if attributes.key?(:'identifier')
250
+ self.identifier = attributes[:'identifier']
251
+ end
252
+
253
+ if attributes.key?(:'live')
254
+ self.live = attributes[:'live']
255
+ end
256
+
257
+ if attributes.key?(:'maskedpan')
258
+ self.maskedpan = attributes[:'maskedpan']
259
+ end
260
+
261
+ if attributes.key?(:'merchantid')
262
+ self.merchantid = attributes[:'merchantid']
263
+ end
264
+
265
+ if attributes.key?(:'result')
266
+ self.result = attributes[:'result']
267
+ end
268
+
269
+ if attributes.key?(:'result_code')
270
+ self.result_code = attributes[:'result_code']
271
+ end
272
+
273
+ if attributes.key?(:'result_message')
274
+ self.result_message = attributes[:'result_message']
275
+ end
276
+
277
+ if attributes.key?(:'scheme')
278
+ self.scheme = attributes[:'scheme']
279
+ end
280
+
281
+ if attributes.key?(:'sha256')
282
+ self.sha256 = attributes[:'sha256']
283
+ end
284
+
285
+ if attributes.key?(:'trans_status')
286
+ self.trans_status = attributes[:'trans_status']
287
+ end
288
+
289
+ if attributes.key?(:'transno')
290
+ self.transno = attributes[:'transno']
291
+ end
292
+ end
293
+
294
+ # Show invalid properties with the reasons. Usually used together with valid?
295
+ # @return Array for valid properties with the reasons
296
+ def list_invalid_properties
297
+ invalid_properties = Array.new
298
+ if !@avs_result.nil? && @avs_result.to_s.length > 1
299
+ invalid_properties.push('invalid value for "avs_result", the character length must be smaller than or equal to 1.')
300
+ end
301
+
302
+ if !@avs_result.nil? && @avs_result.to_s.length < 1
303
+ invalid_properties.push('invalid value for "avs_result", the character length must be great than or equal to 1.')
304
+ end
305
+
306
+ if !@csc_result.nil? && @csc_result.to_s.length > 1
307
+ invalid_properties.push('invalid value for "csc_result", the character length must be smaller than or equal to 1.')
308
+ end
309
+
310
+ if !@csc_result.nil? && @csc_result.to_s.length < 1
311
+ invalid_properties.push('invalid value for "csc_result", the character length must be great than or equal to 1.')
312
+ end
313
+
314
+ if !@currency.nil? && @currency.to_s.length > 3
315
+ invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
316
+ end
317
+
318
+ if !@currency.nil? && @currency.to_s.length < 3
319
+ invalid_properties.push('invalid value for "currency", the character length must be great than or equal to 3.')
320
+ end
321
+
322
+ if !@identifier.nil? && @identifier.to_s.length > 50
323
+ invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 50.')
324
+ end
325
+
326
+ if !@identifier.nil? && @identifier.to_s.length < 4
327
+ invalid_properties.push('invalid value for "identifier", the character length must be great than or equal to 4.')
328
+ end
329
+
330
+ invalid_properties
331
+ end
332
+
333
+ # Check to see if the all the properties in the model are valid
334
+ # @return true if the model is valid
335
+ def valid?
336
+ return false if !@avs_result.nil? && @avs_result.to_s.length > 1
337
+ return false if !@avs_result.nil? && @avs_result.to_s.length < 1
338
+ return false if !@csc_result.nil? && @csc_result.to_s.length > 1
339
+ return false if !@csc_result.nil? && @csc_result.to_s.length < 1
340
+ return false if !@currency.nil? && @currency.to_s.length > 3
341
+ return false if !@currency.nil? && @currency.to_s.length < 3
342
+ return false if !@identifier.nil? && @identifier.to_s.length > 50
343
+ return false if !@identifier.nil? && @identifier.to_s.length < 4
344
+ true
345
+ end
346
+
347
+ # Custom attribute writer method with validation
348
+ # @param [Object] avs_result Value to be assigned
349
+ def avs_result=(avs_result)
350
+ if !avs_result.nil? && avs_result.to_s.length > 1
351
+ fail ArgumentError, 'invalid value for "avs_result", the character length must be smaller than or equal to 1.'
352
+ end
353
+
354
+ if !avs_result.nil? && avs_result.to_s.length < 1
355
+ fail ArgumentError, 'invalid value for "avs_result", the character length must be great than or equal to 1.'
356
+ end
357
+
358
+ @avs_result = avs_result
359
+ end
360
+
361
+ # Custom attribute writer method with validation
362
+ # @param [Object] csc_result Value to be assigned
363
+ def csc_result=(csc_result)
364
+ if !csc_result.nil? && csc_result.to_s.length > 1
365
+ fail ArgumentError, 'invalid value for "csc_result", the character length must be smaller than or equal to 1.'
366
+ end
367
+
368
+ if !csc_result.nil? && csc_result.to_s.length < 1
369
+ fail ArgumentError, 'invalid value for "csc_result", the character length must be great than or equal to 1.'
370
+ end
371
+
372
+ @csc_result = csc_result
373
+ end
374
+
375
+ # Custom attribute writer method with validation
376
+ # @param [Object] currency Value to be assigned
377
+ def currency=(currency)
378
+ if !currency.nil? && currency.to_s.length > 3
379
+ fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.'
380
+ end
381
+
382
+ if !currency.nil? && currency.to_s.length < 3
383
+ fail ArgumentError, 'invalid value for "currency", the character length must be great than or equal to 3.'
384
+ end
385
+
386
+ @currency = currency
387
+ end
388
+
389
+ # Custom attribute writer method with validation
390
+ # @param [Object] identifier Value to be assigned
391
+ def identifier=(identifier)
392
+ if !identifier.nil? && identifier.to_s.length > 50
393
+ fail ArgumentError, 'invalid value for "identifier", the character length must be smaller than or equal to 50.'
394
+ end
395
+
396
+ if !identifier.nil? && identifier.to_s.length < 4
397
+ fail ArgumentError, 'invalid value for "identifier", the character length must be great than or equal to 4.'
398
+ end
399
+
400
+ @identifier = identifier
401
+ end
402
+
403
+ # Checks equality by comparing each attribute.
404
+ # @param [Object] Object to be compared
405
+ def ==(o)
406
+ return true if self.equal?(o)
407
+ self.class == o.class &&
408
+ amount == o.amount &&
409
+ atrn == o.atrn &&
410
+ atsd == o.atsd &&
411
+ authcode == o.authcode &&
412
+ authen_result == o.authen_result &&
413
+ authorised == o.authorised &&
414
+ avs_result == o.avs_result &&
415
+ bin_commercial == o.bin_commercial &&
416
+ bin_debit == o.bin_debit &&
417
+ bin_description == o.bin_description &&
418
+ cavv == o.cavv &&
419
+ context == o.context &&
420
+ csc_result == o.csc_result &&
421
+ currency == o.currency &&
422
+ datetime == o.datetime &&
423
+ eci == o.eci &&
424
+ identifier == o.identifier &&
425
+ live == o.live &&
426
+ maskedpan == o.maskedpan &&
427
+ merchantid == o.merchantid &&
428
+ result == o.result &&
429
+ result_code == o.result_code &&
430
+ result_message == o.result_message &&
431
+ scheme == o.scheme &&
432
+ sha256 == o.sha256 &&
433
+ trans_status == o.trans_status &&
434
+ transno == o.transno
435
+ end
436
+
437
+ # @see the `==` method
438
+ # @param [Object] Object to be compared
439
+ def eql?(o)
440
+ self == o
441
+ end
442
+
443
+ # Calculates hash code according to all attributes.
444
+ # @return [Integer] Hash code
445
+ def hash
446
+ [amount, atrn, atsd, authcode, authen_result, authorised, avs_result, bin_commercial, bin_debit, bin_description, cavv, context, csc_result, currency, datetime, eci, identifier, live, maskedpan, merchantid, result, result_code, result_message, scheme, sha256, trans_status, transno].hash
447
+ end
448
+
449
+ # Builds the object from hash
450
+ # @param [Hash] attributes Model attributes in the form of hash
451
+ # @return [Object] Returns the model itself
452
+ def self.build_from_hash(attributes)
453
+ new.build_from_hash(attributes)
454
+ end
455
+
456
+ # Builds the object from hash
457
+ # @param [Hash] attributes Model attributes in the form of hash
458
+ # @return [Object] Returns the model itself
459
+ def build_from_hash(attributes)
460
+ return nil unless attributes.is_a?(Hash)
461
+ self.class.openapi_types.each_pair do |key, type|
462
+ if type =~ /\AArray<(.*)>/i
463
+ # check to ensure the input is an array given that the attribute
464
+ # is documented as an array but the input is not
465
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
466
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
467
+ end
468
+ elsif !attributes[self.class.attribute_map[key]].nil?
469
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
470
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
471
+ end
472
+
473
+ self
474
+ end
475
+
476
+ # Deserializes the data based on type
477
+ # @param string type Data type
478
+ # @param string value Value to be deserialized
479
+ # @return [Object] Deserialized data
480
+ def _deserialize(type, value)
481
+ case type.to_sym
482
+ when :DateTime
483
+ DateTime.parse(value)
484
+ when :Date
485
+ Date.parse(value)
486
+ when :String
487
+ value.to_s
488
+ when :Integer
489
+ value.to_i
490
+ when :Float
491
+ value.to_f
492
+ when :Boolean
493
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
494
+ true
495
+ else
496
+ false
497
+ end
498
+ when :Object
499
+ # generic object (usually a Hash), return directly
500
+ value
501
+ when /\AArray<(?<inner_type>.+)>\z/
502
+ inner_type = Regexp.last_match[:inner_type]
503
+ value.map { |v| _deserialize(inner_type, v) }
504
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
505
+ k_type = Regexp.last_match[:k_type]
506
+ v_type = Regexp.last_match[:v_type]
507
+ {}.tap do |hash|
508
+ value.each do |k, v|
509
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
510
+ end
511
+ end
512
+ else # model
513
+ CityPayApiClient.const_get(type).build_from_hash(value)
514
+ end
515
+ end
516
+
517
+ # Returns the string representation of the object
518
+ # @return [String] String presentation of the object
519
+ def to_s
520
+ to_hash.to_s
521
+ end
522
+
523
+ # to_body is an alias to to_hash (backward compatibility)
524
+ # @return [Hash] Returns the object in the form of hash
525
+ def to_body
526
+ to_hash
527
+ end
528
+
529
+ # Returns the object in the form of hash
530
+ # @return [Hash] Returns the object in the form of hash
531
+ def to_hash
532
+ hash = {}
533
+ self.class.attribute_map.each_pair do |attr, param|
534
+ value = self.send(attr)
535
+ if value.nil?
536
+ is_nullable = self.class.openapi_nullable.include?(attr)
537
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
538
+ end
539
+
540
+ hash[param] = _to_hash(value)
541
+ end
542
+ hash
543
+ end
544
+
545
+ # Outputs non-array value in the form of hash
546
+ # For object, use to_hash. Otherwise, just return the value
547
+ # @param [Object] value Any valid value
548
+ # @return [Hash] Returns the value in the form of hash
549
+ def _to_hash(value)
550
+ if value.is_a?(Array)
551
+ value.compact.map { |v| _to_hash(v) }
552
+ elsif value.is_a?(Hash)
553
+ {}.tap do |hash|
554
+ value.each { |k, v| hash[k] = _to_hash(v) }
555
+ end
556
+ elsif value.respond_to? :to_hash
557
+ value.to_hash
558
+ else
559
+ value
560
+ end
561
+ end
562
+ end
563
+ end