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,425 @@
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 Card
17
+ # Defines whether the card is a commercial card.
18
+ attr_accessor :bin_commercial
19
+
20
+ # Defines whether the card is a corporate business card.
21
+ attr_accessor :bin_corporate
22
+
23
+ # The determined country where the card was issued.
24
+ attr_accessor :bin_country_issued
25
+
26
+ # Defines whether the card is a credit card.
27
+ attr_accessor :bin_credit
28
+
29
+ # The default currency determined for the card.
30
+ attr_accessor :bin_currency
31
+
32
+ # Defines whether the card is a debit card.
33
+ attr_accessor :bin_debit
34
+
35
+ # A description of the bin on the card to identify what type of product the card is.
36
+ attr_accessor :bin_description
37
+
38
+ # Defines whether the card is regulated within the EU.
39
+ attr_accessor :bin_eu
40
+
41
+ # The id of the card that is returned. Should be used for referencing the card when perform any changes.
42
+ attr_accessor :card_id
43
+
44
+ # The status of the card such, valid values are - ACTIVE the card is active for processing - INACTIVE the card is not active for processing - EXPIRED for cards that have passed their expiry date.
45
+ attr_accessor :card_status
46
+
47
+ # Determines if the card is the default card for the account and should be regarded as the first option to be used for processing.
48
+ attr_accessor :default
49
+
50
+ # The expiry month of the card.
51
+ attr_accessor :expmonth
52
+
53
+ # The expiry year of the card.
54
+ attr_accessor :expyear
55
+
56
+ # A label which identifies this card.
57
+ attr_accessor :label
58
+
59
+ # A label which also provides the expiry date of the card.
60
+ attr_accessor :label2
61
+
62
+ # The last 4 digits of the card to aid in identification.
63
+ attr_accessor :last4digits
64
+
65
+ # The scheme that issued the card.
66
+ attr_accessor :scheme
67
+
68
+ # A token that can be used to process against the card.
69
+ attr_accessor :token
70
+
71
+ # Attribute mapping from ruby-style variable name to JSON key.
72
+ def self.attribute_map
73
+ {
74
+ :'bin_commercial' => :'bin_commercial',
75
+ :'bin_corporate' => :'bin_corporate',
76
+ :'bin_country_issued' => :'bin_country_issued',
77
+ :'bin_credit' => :'bin_credit',
78
+ :'bin_currency' => :'bin_currency',
79
+ :'bin_debit' => :'bin_debit',
80
+ :'bin_description' => :'bin_description',
81
+ :'bin_eu' => :'bin_eu',
82
+ :'card_id' => :'card_id',
83
+ :'card_status' => :'card_status',
84
+ :'default' => :'default',
85
+ :'expmonth' => :'expmonth',
86
+ :'expyear' => :'expyear',
87
+ :'label' => :'label',
88
+ :'label2' => :'label2',
89
+ :'last4digits' => :'last4digits',
90
+ :'scheme' => :'scheme',
91
+ :'token' => :'token'
92
+ }
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'bin_commercial' => :'Boolean',
99
+ :'bin_corporate' => :'Boolean',
100
+ :'bin_country_issued' => :'String',
101
+ :'bin_credit' => :'Boolean',
102
+ :'bin_currency' => :'String',
103
+ :'bin_debit' => :'Boolean',
104
+ :'bin_description' => :'String',
105
+ :'bin_eu' => :'Boolean',
106
+ :'card_id' => :'String',
107
+ :'card_status' => :'String',
108
+ :'default' => :'Boolean',
109
+ :'expmonth' => :'Integer',
110
+ :'expyear' => :'Integer',
111
+ :'label' => :'String',
112
+ :'label2' => :'String',
113
+ :'last4digits' => :'String',
114
+ :'scheme' => :'String',
115
+ :'token' => :'String'
116
+ }
117
+ end
118
+
119
+ # List of attributes with nullable: true
120
+ def self.openapi_nullable
121
+ Set.new([
122
+ ])
123
+ end
124
+
125
+ # Initializes the object
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ def initialize(attributes = {})
128
+ if (!attributes.is_a?(Hash))
129
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::Card` initialize method"
130
+ end
131
+
132
+ # check to see if the attribute exists and convert string to symbol for hash key
133
+ attributes = attributes.each_with_object({}) { |(k, v), h|
134
+ if (!self.class.attribute_map.key?(k.to_sym))
135
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::Card`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
136
+ end
137
+ h[k.to_sym] = v
138
+ }
139
+
140
+ if attributes.key?(:'bin_commercial')
141
+ self.bin_commercial = attributes[:'bin_commercial']
142
+ end
143
+
144
+ if attributes.key?(:'bin_corporate')
145
+ self.bin_corporate = attributes[:'bin_corporate']
146
+ end
147
+
148
+ if attributes.key?(:'bin_country_issued')
149
+ self.bin_country_issued = attributes[:'bin_country_issued']
150
+ end
151
+
152
+ if attributes.key?(:'bin_credit')
153
+ self.bin_credit = attributes[:'bin_credit']
154
+ end
155
+
156
+ if attributes.key?(:'bin_currency')
157
+ self.bin_currency = attributes[:'bin_currency']
158
+ end
159
+
160
+ if attributes.key?(:'bin_debit')
161
+ self.bin_debit = attributes[:'bin_debit']
162
+ end
163
+
164
+ if attributes.key?(:'bin_description')
165
+ self.bin_description = attributes[:'bin_description']
166
+ end
167
+
168
+ if attributes.key?(:'bin_eu')
169
+ self.bin_eu = attributes[:'bin_eu']
170
+ end
171
+
172
+ if attributes.key?(:'card_id')
173
+ self.card_id = attributes[:'card_id']
174
+ end
175
+
176
+ if attributes.key?(:'card_status')
177
+ self.card_status = attributes[:'card_status']
178
+ end
179
+
180
+ if attributes.key?(:'default')
181
+ self.default = attributes[:'default']
182
+ end
183
+
184
+ if attributes.key?(:'expmonth')
185
+ self.expmonth = attributes[:'expmonth']
186
+ end
187
+
188
+ if attributes.key?(:'expyear')
189
+ self.expyear = attributes[:'expyear']
190
+ end
191
+
192
+ if attributes.key?(:'label')
193
+ self.label = attributes[:'label']
194
+ end
195
+
196
+ if attributes.key?(:'label2')
197
+ self.label2 = attributes[:'label2']
198
+ end
199
+
200
+ if attributes.key?(:'last4digits')
201
+ self.last4digits = attributes[:'last4digits']
202
+ end
203
+
204
+ if attributes.key?(:'scheme')
205
+ self.scheme = attributes[:'scheme']
206
+ end
207
+
208
+ if attributes.key?(:'token')
209
+ self.token = attributes[:'token']
210
+ end
211
+ end
212
+
213
+ # Show invalid properties with the reasons. Usually used together with valid?
214
+ # @return Array for valid properties with the reasons
215
+ def list_invalid_properties
216
+ invalid_properties = Array.new
217
+ if !@expmonth.nil? && @expmonth > 12
218
+ invalid_properties.push('invalid value for "expmonth", must be smaller than or equal to 12.')
219
+ end
220
+
221
+ if !@expmonth.nil? && @expmonth < 1
222
+ invalid_properties.push('invalid value for "expmonth", must be greater than or equal to 1.')
223
+ end
224
+
225
+ if !@expyear.nil? && @expyear > 2100
226
+ invalid_properties.push('invalid value for "expyear", must be smaller than or equal to 2100.')
227
+ end
228
+
229
+ if !@expyear.nil? && @expyear < 2000
230
+ invalid_properties.push('invalid value for "expyear", must be greater than or equal to 2000.')
231
+ end
232
+
233
+ invalid_properties
234
+ end
235
+
236
+ # Check to see if the all the properties in the model are valid
237
+ # @return true if the model is valid
238
+ def valid?
239
+ return false if !@expmonth.nil? && @expmonth > 12
240
+ return false if !@expmonth.nil? && @expmonth < 1
241
+ return false if !@expyear.nil? && @expyear > 2100
242
+ return false if !@expyear.nil? && @expyear < 2000
243
+ true
244
+ end
245
+
246
+ # Custom attribute writer method with validation
247
+ # @param [Object] expmonth Value to be assigned
248
+ def expmonth=(expmonth)
249
+ if !expmonth.nil? && expmonth > 12
250
+ fail ArgumentError, 'invalid value for "expmonth", must be smaller than or equal to 12.'
251
+ end
252
+
253
+ if !expmonth.nil? && expmonth < 1
254
+ fail ArgumentError, 'invalid value for "expmonth", must be greater than or equal to 1.'
255
+ end
256
+
257
+ @expmonth = expmonth
258
+ end
259
+
260
+ # Custom attribute writer method with validation
261
+ # @param [Object] expyear Value to be assigned
262
+ def expyear=(expyear)
263
+ if !expyear.nil? && expyear > 2100
264
+ fail ArgumentError, 'invalid value for "expyear", must be smaller than or equal to 2100.'
265
+ end
266
+
267
+ if !expyear.nil? && expyear < 2000
268
+ fail ArgumentError, 'invalid value for "expyear", must be greater than or equal to 2000.'
269
+ end
270
+
271
+ @expyear = expyear
272
+ end
273
+
274
+ # Checks equality by comparing each attribute.
275
+ # @param [Object] Object to be compared
276
+ def ==(o)
277
+ return true if self.equal?(o)
278
+ self.class == o.class &&
279
+ bin_commercial == o.bin_commercial &&
280
+ bin_corporate == o.bin_corporate &&
281
+ bin_country_issued == o.bin_country_issued &&
282
+ bin_credit == o.bin_credit &&
283
+ bin_currency == o.bin_currency &&
284
+ bin_debit == o.bin_debit &&
285
+ bin_description == o.bin_description &&
286
+ bin_eu == o.bin_eu &&
287
+ card_id == o.card_id &&
288
+ card_status == o.card_status &&
289
+ default == o.default &&
290
+ expmonth == o.expmonth &&
291
+ expyear == o.expyear &&
292
+ label == o.label &&
293
+ label2 == o.label2 &&
294
+ last4digits == o.last4digits &&
295
+ scheme == o.scheme &&
296
+ token == o.token
297
+ end
298
+
299
+ # @see the `==` method
300
+ # @param [Object] Object to be compared
301
+ def eql?(o)
302
+ self == o
303
+ end
304
+
305
+ # Calculates hash code according to all attributes.
306
+ # @return [Integer] Hash code
307
+ def hash
308
+ [bin_commercial, bin_corporate, bin_country_issued, bin_credit, bin_currency, bin_debit, bin_description, bin_eu, card_id, card_status, default, expmonth, expyear, label, label2, last4digits, scheme, token].hash
309
+ end
310
+
311
+ # Builds the object from hash
312
+ # @param [Hash] attributes Model attributes in the form of hash
313
+ # @return [Object] Returns the model itself
314
+ def self.build_from_hash(attributes)
315
+ new.build_from_hash(attributes)
316
+ end
317
+
318
+ # Builds the object from hash
319
+ # @param [Hash] attributes Model attributes in the form of hash
320
+ # @return [Object] Returns the model itself
321
+ def build_from_hash(attributes)
322
+ return nil unless attributes.is_a?(Hash)
323
+ self.class.openapi_types.each_pair do |key, type|
324
+ if type =~ /\AArray<(.*)>/i
325
+ # check to ensure the input is an array given that the attribute
326
+ # is documented as an array but the input is not
327
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
328
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
329
+ end
330
+ elsif !attributes[self.class.attribute_map[key]].nil?
331
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
332
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
333
+ end
334
+
335
+ self
336
+ end
337
+
338
+ # Deserializes the data based on type
339
+ # @param string type Data type
340
+ # @param string value Value to be deserialized
341
+ # @return [Object] Deserialized data
342
+ def _deserialize(type, value)
343
+ case type.to_sym
344
+ when :DateTime
345
+ DateTime.parse(value)
346
+ when :Date
347
+ Date.parse(value)
348
+ when :String
349
+ value.to_s
350
+ when :Integer
351
+ value.to_i
352
+ when :Float
353
+ value.to_f
354
+ when :Boolean
355
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
356
+ true
357
+ else
358
+ false
359
+ end
360
+ when :Object
361
+ # generic object (usually a Hash), return directly
362
+ value
363
+ when /\AArray<(?<inner_type>.+)>\z/
364
+ inner_type = Regexp.last_match[:inner_type]
365
+ value.map { |v| _deserialize(inner_type, v) }
366
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
367
+ k_type = Regexp.last_match[:k_type]
368
+ v_type = Regexp.last_match[:v_type]
369
+ {}.tap do |hash|
370
+ value.each do |k, v|
371
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
372
+ end
373
+ end
374
+ else # model
375
+ CityPayApiClient.const_get(type).build_from_hash(value)
376
+ end
377
+ end
378
+
379
+ # Returns the string representation of the object
380
+ # @return [String] String presentation of the object
381
+ def to_s
382
+ to_hash.to_s
383
+ end
384
+
385
+ # to_body is an alias to to_hash (backward compatibility)
386
+ # @return [Hash] Returns the object in the form of hash
387
+ def to_body
388
+ to_hash
389
+ end
390
+
391
+ # Returns the object in the form of hash
392
+ # @return [Hash] Returns the object in the form of hash
393
+ def to_hash
394
+ hash = {}
395
+ self.class.attribute_map.each_pair do |attr, param|
396
+ value = self.send(attr)
397
+ if value.nil?
398
+ is_nullable = self.class.openapi_nullable.include?(attr)
399
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
400
+ end
401
+
402
+ hash[param] = _to_hash(value)
403
+ end
404
+ hash
405
+ end
406
+
407
+ # Outputs non-array value in the form of hash
408
+ # For object, use to_hash. Otherwise, just return the value
409
+ # @param [Object] value Any valid value
410
+ # @return [Hash] Returns the value in the form of hash
411
+ def _to_hash(value)
412
+ if value.is_a?(Array)
413
+ value.compact.map { |v| _to_hash(v) }
414
+ elsif value.is_a?(Hash)
415
+ {}.tap do |hash|
416
+ value.each { |k, v| hash[k] = _to_hash(v) }
417
+ end
418
+ elsif value.respond_to? :to_hash
419
+ value.to_hash
420
+ else
421
+ value
422
+ end
423
+ end
424
+ end
425
+ end
@@ -0,0 +1,315 @@
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 CardHolderAccount
17
+ # The account id of the card holder account provided by the merchant which uniquely identifies the account.
18
+ attr_accessor :account_id
19
+
20
+ attr_accessor :cards
21
+
22
+ attr_accessor :contact
23
+
24
+ # The date and time the account was created.
25
+ attr_accessor :date_created
26
+
27
+ # The id of the default card.
28
+ attr_accessor :default_card_id
29
+
30
+ # The index in the array of the default card.
31
+ attr_accessor :default_card_index
32
+
33
+ # Defines the status of the account for processing valid values are - ACTIVE for active accounts that are able to process - DISABLED for accounts that are currently disabled for processing.
34
+ attr_accessor :status
35
+
36
+ # A unique id of the card holder account which uniquely identifies the stored account. This value is not searchable.
37
+ attr_accessor :unique_id
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'account_id' => :'account_id',
43
+ :'cards' => :'cards',
44
+ :'contact' => :'contact',
45
+ :'date_created' => :'date_created',
46
+ :'default_card_id' => :'default_card_id',
47
+ :'default_card_index' => :'default_card_index',
48
+ :'status' => :'status',
49
+ :'unique_id' => :'unique_id'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'account_id' => :'String',
57
+ :'cards' => :'Array<Card>',
58
+ :'contact' => :'ContactDetails',
59
+ :'date_created' => :'DateTime',
60
+ :'default_card_id' => :'String',
61
+ :'default_card_index' => :'String',
62
+ :'status' => :'String',
63
+ :'unique_id' => :'String'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::CardHolderAccount` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::CardHolderAccount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'account_id')
89
+ self.account_id = attributes[:'account_id']
90
+ end
91
+
92
+ if attributes.key?(:'cards')
93
+ if (value = attributes[:'cards']).is_a?(Array)
94
+ self.cards = value
95
+ end
96
+ end
97
+
98
+ if attributes.key?(:'contact')
99
+ self.contact = attributes[:'contact']
100
+ end
101
+
102
+ if attributes.key?(:'date_created')
103
+ self.date_created = attributes[:'date_created']
104
+ end
105
+
106
+ if attributes.key?(:'default_card_id')
107
+ self.default_card_id = attributes[:'default_card_id']
108
+ end
109
+
110
+ if attributes.key?(:'default_card_index')
111
+ self.default_card_index = attributes[:'default_card_index']
112
+ end
113
+
114
+ if attributes.key?(:'status')
115
+ self.status = attributes[:'status']
116
+ end
117
+
118
+ if attributes.key?(:'unique_id')
119
+ self.unique_id = attributes[:'unique_id']
120
+ end
121
+ end
122
+
123
+ # Show invalid properties with the reasons. Usually used together with valid?
124
+ # @return Array for valid properties with the reasons
125
+ def list_invalid_properties
126
+ invalid_properties = Array.new
127
+ if @account_id.nil?
128
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
129
+ end
130
+
131
+ if @account_id.to_s.length > 50
132
+ invalid_properties.push('invalid value for "account_id", the character length must be smaller than or equal to 50.')
133
+ end
134
+
135
+ if @account_id.to_s.length < 5
136
+ invalid_properties.push('invalid value for "account_id", the character length must be great than or equal to 5.')
137
+ end
138
+
139
+ if @contact.nil?
140
+ invalid_properties.push('invalid value for "contact", contact cannot be nil.')
141
+ end
142
+
143
+ invalid_properties
144
+ end
145
+
146
+ # Check to see if the all the properties in the model are valid
147
+ # @return true if the model is valid
148
+ def valid?
149
+ return false if @account_id.nil?
150
+ return false if @account_id.to_s.length > 50
151
+ return false if @account_id.to_s.length < 5
152
+ return false if @contact.nil?
153
+ true
154
+ end
155
+
156
+ # Custom attribute writer method with validation
157
+ # @param [Object] account_id Value to be assigned
158
+ def account_id=(account_id)
159
+ if account_id.nil?
160
+ fail ArgumentError, 'account_id cannot be nil'
161
+ end
162
+
163
+ if account_id.to_s.length > 50
164
+ fail ArgumentError, 'invalid value for "account_id", the character length must be smaller than or equal to 50.'
165
+ end
166
+
167
+ if account_id.to_s.length < 5
168
+ fail ArgumentError, 'invalid value for "account_id", the character length must be great than or equal to 5.'
169
+ end
170
+
171
+ @account_id = account_id
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ account_id == o.account_id &&
180
+ cards == o.cards &&
181
+ contact == o.contact &&
182
+ date_created == o.date_created &&
183
+ default_card_id == o.default_card_id &&
184
+ default_card_index == o.default_card_index &&
185
+ status == o.status &&
186
+ unique_id == o.unique_id
187
+ end
188
+
189
+ # @see the `==` method
190
+ # @param [Object] Object to be compared
191
+ def eql?(o)
192
+ self == o
193
+ end
194
+
195
+ # Calculates hash code according to all attributes.
196
+ # @return [Integer] Hash code
197
+ def hash
198
+ [account_id, cards, contact, date_created, default_card_id, default_card_index, status, unique_id].hash
199
+ end
200
+
201
+ # Builds the object from hash
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @return [Object] Returns the model itself
204
+ def self.build_from_hash(attributes)
205
+ new.build_from_hash(attributes)
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def build_from_hash(attributes)
212
+ return nil unless attributes.is_a?(Hash)
213
+ self.class.openapi_types.each_pair do |key, type|
214
+ if type =~ /\AArray<(.*)>/i
215
+ # check to ensure the input is an array given that the attribute
216
+ # is documented as an array but the input is not
217
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
218
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
219
+ end
220
+ elsif !attributes[self.class.attribute_map[key]].nil?
221
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
222
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
223
+ end
224
+
225
+ self
226
+ end
227
+
228
+ # Deserializes the data based on type
229
+ # @param string type Data type
230
+ # @param string value Value to be deserialized
231
+ # @return [Object] Deserialized data
232
+ def _deserialize(type, value)
233
+ case type.to_sym
234
+ when :DateTime
235
+ DateTime.parse(value)
236
+ when :Date
237
+ Date.parse(value)
238
+ when :String
239
+ value.to_s
240
+ when :Integer
241
+ value.to_i
242
+ when :Float
243
+ value.to_f
244
+ when :Boolean
245
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
246
+ true
247
+ else
248
+ false
249
+ end
250
+ when :Object
251
+ # generic object (usually a Hash), return directly
252
+ value
253
+ when /\AArray<(?<inner_type>.+)>\z/
254
+ inner_type = Regexp.last_match[:inner_type]
255
+ value.map { |v| _deserialize(inner_type, v) }
256
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
257
+ k_type = Regexp.last_match[:k_type]
258
+ v_type = Regexp.last_match[:v_type]
259
+ {}.tap do |hash|
260
+ value.each do |k, v|
261
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
262
+ end
263
+ end
264
+ else # model
265
+ CityPayApiClient.const_get(type).build_from_hash(value)
266
+ end
267
+ end
268
+
269
+ # Returns the string representation of the object
270
+ # @return [String] String presentation of the object
271
+ def to_s
272
+ to_hash.to_s
273
+ end
274
+
275
+ # to_body is an alias to to_hash (backward compatibility)
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_body
278
+ to_hash
279
+ end
280
+
281
+ # Returns the object in the form of hash
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_hash
284
+ hash = {}
285
+ self.class.attribute_map.each_pair do |attr, param|
286
+ value = self.send(attr)
287
+ if value.nil?
288
+ is_nullable = self.class.openapi_nullable.include?(attr)
289
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
290
+ end
291
+
292
+ hash[param] = _to_hash(value)
293
+ end
294
+ hash
295
+ end
296
+
297
+ # Outputs non-array value in the form of hash
298
+ # For object, use to_hash. Otherwise, just return the value
299
+ # @param [Object] value Any valid value
300
+ # @return [Hash] Returns the value in the form of hash
301
+ def _to_hash(value)
302
+ if value.is_a?(Array)
303
+ value.compact.map { |v| _to_hash(v) }
304
+ elsif value.is_a?(Hash)
305
+ {}.tap do |hash|
306
+ value.each { |k, v| hash[k] = _to_hash(v) }
307
+ end
308
+ elsif value.respond_to? :to_hash
309
+ value.to_hash
310
+ else
311
+ value
312
+ end
313
+ end
314
+ end
315
+ end