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,285 @@
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 Acknowledgement
17
+ # A response code providing a result of the process.
18
+ attr_accessor :code
19
+
20
+ # A context id of the process used for referencing transactions through support.
21
+ attr_accessor :context
22
+
23
+ # An identifier if presented in the original request.
24
+ attr_accessor :identifier
25
+
26
+ # A response message providing a description of the result of the process.
27
+ attr_accessor :message
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'code' => :'code',
33
+ :'context' => :'context',
34
+ :'identifier' => :'identifier',
35
+ :'message' => :'message'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'code' => :'String',
43
+ :'context' => :'String',
44
+ :'identifier' => :'String',
45
+ :'message' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::Acknowledgement` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::Acknowledgement`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'code')
71
+ self.code = attributes[:'code']
72
+ end
73
+
74
+ if attributes.key?(:'context')
75
+ self.context = attributes[:'context']
76
+ end
77
+
78
+ if attributes.key?(:'identifier')
79
+ self.identifier = attributes[:'identifier']
80
+ end
81
+
82
+ if attributes.key?(:'message')
83
+ self.message = attributes[:'message']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ if !@code.nil? && @code.to_s.length > 4
92
+ invalid_properties.push('invalid value for "code", the character length must be smaller than or equal to 4.')
93
+ end
94
+
95
+ if !@code.nil? && @code.to_s.length < 3
96
+ invalid_properties.push('invalid value for "code", the character length must be great than or equal to 3.')
97
+ end
98
+
99
+ if !@identifier.nil? && @identifier.to_s.length > 50
100
+ invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 50.')
101
+ end
102
+
103
+ if !@identifier.nil? && @identifier.to_s.length < 4
104
+ invalid_properties.push('invalid value for "identifier", the character length must be great than or equal to 4.')
105
+ end
106
+
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ return false if !@code.nil? && @code.to_s.length > 4
114
+ return false if !@code.nil? && @code.to_s.length < 3
115
+ return false if !@identifier.nil? && @identifier.to_s.length > 50
116
+ return false if !@identifier.nil? && @identifier.to_s.length < 4
117
+ true
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] code Value to be assigned
122
+ def code=(code)
123
+ if !code.nil? && code.to_s.length > 4
124
+ fail ArgumentError, 'invalid value for "code", the character length must be smaller than or equal to 4.'
125
+ end
126
+
127
+ if !code.nil? && code.to_s.length < 3
128
+ fail ArgumentError, 'invalid value for "code", the character length must be great than or equal to 3.'
129
+ end
130
+
131
+ @code = code
132
+ end
133
+
134
+ # Custom attribute writer method with validation
135
+ # @param [Object] identifier Value to be assigned
136
+ def identifier=(identifier)
137
+ if !identifier.nil? && identifier.to_s.length > 50
138
+ fail ArgumentError, 'invalid value for "identifier", the character length must be smaller than or equal to 50.'
139
+ end
140
+
141
+ if !identifier.nil? && identifier.to_s.length < 4
142
+ fail ArgumentError, 'invalid value for "identifier", the character length must be great than or equal to 4.'
143
+ end
144
+
145
+ @identifier = identifier
146
+ end
147
+
148
+ # Checks equality by comparing each attribute.
149
+ # @param [Object] Object to be compared
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ code == o.code &&
154
+ context == o.context &&
155
+ identifier == o.identifier &&
156
+ message == o.message
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Integer] Hash code
167
+ def hash
168
+ [code, context, identifier, message].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def self.build_from_hash(attributes)
175
+ new.build_from_hash(attributes)
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ self.class.openapi_types.each_pair do |key, type|
184
+ if type =~ /\AArray<(.*)>/i
185
+ # check to ensure the input is an array given that the attribute
186
+ # is documented as an array but the input is not
187
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
188
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
189
+ end
190
+ elsif !attributes[self.class.attribute_map[key]].nil?
191
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
192
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
193
+ end
194
+
195
+ self
196
+ end
197
+
198
+ # Deserializes the data based on type
199
+ # @param string type Data type
200
+ # @param string value Value to be deserialized
201
+ # @return [Object] Deserialized data
202
+ def _deserialize(type, value)
203
+ case type.to_sym
204
+ when :DateTime
205
+ DateTime.parse(value)
206
+ when :Date
207
+ Date.parse(value)
208
+ when :String
209
+ value.to_s
210
+ when :Integer
211
+ value.to_i
212
+ when :Float
213
+ value.to_f
214
+ when :Boolean
215
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
216
+ true
217
+ else
218
+ false
219
+ end
220
+ when :Object
221
+ # generic object (usually a Hash), return directly
222
+ value
223
+ when /\AArray<(?<inner_type>.+)>\z/
224
+ inner_type = Regexp.last_match[:inner_type]
225
+ value.map { |v| _deserialize(inner_type, v) }
226
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
227
+ k_type = Regexp.last_match[:k_type]
228
+ v_type = Regexp.last_match[:v_type]
229
+ {}.tap do |hash|
230
+ value.each do |k, v|
231
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
232
+ end
233
+ end
234
+ else # model
235
+ CityPayApiClient.const_get(type).build_from_hash(value)
236
+ end
237
+ end
238
+
239
+ # Returns the string representation of the object
240
+ # @return [String] String presentation of the object
241
+ def to_s
242
+ to_hash.to_s
243
+ end
244
+
245
+ # to_body is an alias to to_hash (backward compatibility)
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_body
248
+ to_hash
249
+ end
250
+
251
+ # Returns the object in the form of hash
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_hash
254
+ hash = {}
255
+ self.class.attribute_map.each_pair do |attr, param|
256
+ value = self.send(attr)
257
+ if value.nil?
258
+ is_nullable = self.class.openapi_nullable.include?(attr)
259
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
260
+ end
261
+
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ # Outputs non-array value in the form of hash
268
+ # For object, use to_hash. Otherwise, just return the value
269
+ # @param [Object] value Any valid value
270
+ # @return [Hash] Returns the value in the form of hash
271
+ def _to_hash(value)
272
+ if value.is_a?(Array)
273
+ value.compact.map { |v| _to_hash(v) }
274
+ elsif value.is_a?(Hash)
275
+ {}.tap do |hash|
276
+ value.each { |k, v| hash[k] = _to_hash(v) }
277
+ end
278
+ elsif value.respond_to? :to_hash
279
+ value.to_hash
280
+ else
281
+ value
282
+ end
283
+ end
284
+ end
285
+ end
@@ -0,0 +1,551 @@
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 AirlineAdvice
17
+ # The name of the airline carrier that generated the tickets for airline travel.
18
+ attr_accessor :carrier_name
19
+
20
+ # true if a conjunction ticket (with additional coupons) was issued for an itinerary with more than four segments. Defaults to false.
21
+ attr_accessor :conjunction_ticket_indicator
22
+
23
+ # The Electronic Ticket Indicator, a code that indicates if an electronic ticket was issued. Defaults to true.
24
+ attr_accessor :eticket_indicator
25
+
26
+ # A value that indicates the number of air travel segments included on this ticket. Valid entries include the numerals “0” through “4”. Required only if the transaction type is TKT or EXC.
27
+ attr_accessor :no_air_segments
28
+
29
+ # The number of people in the party.
30
+ attr_accessor :number_in_party
31
+
32
+ # Required if transaction type is EXC.
33
+ attr_accessor :original_ticket_no
34
+
35
+ # The name of the passenger when the traveller is not the card member that purchased the ticket. Required only if the transaction type is TKT or EXC.
36
+ attr_accessor :passenger_name
37
+
38
+ attr_accessor :segment1
39
+
40
+ attr_accessor :segment2
41
+
42
+ attr_accessor :segment3
43
+
44
+ attr_accessor :segment4
45
+
46
+ # The name of the city town or village where the transaction took place.
47
+ attr_accessor :ticket_issue_city
48
+
49
+ # The date the ticket was issued in ISO Date format (yyyy-MM-dd).
50
+ attr_accessor :ticket_issue_date
51
+
52
+ # The name of the agency generating the ticket.
53
+ attr_accessor :ticket_issue_name
54
+
55
+ # This must be a valid ticket number, i.e. numeric (the first 3 digits must represent the valid IATA plate carrier code). The final check digit should be validated prior to submission. On credit charges, this field should contain the number of the original ticket, and not of a replacement.
56
+ attr_accessor :ticket_no
57
+
58
+ # This field contains the Transaction Type code assigned to this transaction. Valid codes include: - `TKT` = Ticket Purchase - `REF` = Refund - `EXC` = Exchange Ticket - `MSC` = Miscellaneous (non-Ticket Purchase- and non-Exchange Ticket-related transactions only).
59
+ attr_accessor :transaction_type
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'carrier_name' => :'carrier_name',
65
+ :'conjunction_ticket_indicator' => :'conjunction_ticket_indicator',
66
+ :'eticket_indicator' => :'eticket_indicator',
67
+ :'no_air_segments' => :'no_air_segments',
68
+ :'number_in_party' => :'number_in_party',
69
+ :'original_ticket_no' => :'original_ticket_no',
70
+ :'passenger_name' => :'passenger_name',
71
+ :'segment1' => :'segment1',
72
+ :'segment2' => :'segment2',
73
+ :'segment3' => :'segment3',
74
+ :'segment4' => :'segment4',
75
+ :'ticket_issue_city' => :'ticket_issue_city',
76
+ :'ticket_issue_date' => :'ticket_issue_date',
77
+ :'ticket_issue_name' => :'ticket_issue_name',
78
+ :'ticket_no' => :'ticket_no',
79
+ :'transaction_type' => :'transaction_type'
80
+ }
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :'carrier_name' => :'String',
87
+ :'conjunction_ticket_indicator' => :'Boolean',
88
+ :'eticket_indicator' => :'Boolean',
89
+ :'no_air_segments' => :'Integer',
90
+ :'number_in_party' => :'Integer',
91
+ :'original_ticket_no' => :'String',
92
+ :'passenger_name' => :'String',
93
+ :'segment1' => :'AirlineSegment',
94
+ :'segment2' => :'AirlineSegment',
95
+ :'segment3' => :'AirlineSegment',
96
+ :'segment4' => :'AirlineSegment',
97
+ :'ticket_issue_city' => :'String',
98
+ :'ticket_issue_date' => :'Date',
99
+ :'ticket_issue_name' => :'String',
100
+ :'ticket_no' => :'String',
101
+ :'transaction_type' => :'String'
102
+ }
103
+ end
104
+
105
+ # List of attributes with nullable: true
106
+ def self.openapi_nullable
107
+ Set.new([
108
+ ])
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::AirlineAdvice` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ attributes = attributes.each_with_object({}) { |(k, v), h|
120
+ if (!self.class.attribute_map.key?(k.to_sym))
121
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::AirlineAdvice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
122
+ end
123
+ h[k.to_sym] = v
124
+ }
125
+
126
+ if attributes.key?(:'carrier_name')
127
+ self.carrier_name = attributes[:'carrier_name']
128
+ end
129
+
130
+ if attributes.key?(:'conjunction_ticket_indicator')
131
+ self.conjunction_ticket_indicator = attributes[:'conjunction_ticket_indicator']
132
+ end
133
+
134
+ if attributes.key?(:'eticket_indicator')
135
+ self.eticket_indicator = attributes[:'eticket_indicator']
136
+ end
137
+
138
+ if attributes.key?(:'no_air_segments')
139
+ self.no_air_segments = attributes[:'no_air_segments']
140
+ end
141
+
142
+ if attributes.key?(:'number_in_party')
143
+ self.number_in_party = attributes[:'number_in_party']
144
+ end
145
+
146
+ if attributes.key?(:'original_ticket_no')
147
+ self.original_ticket_no = attributes[:'original_ticket_no']
148
+ end
149
+
150
+ if attributes.key?(:'passenger_name')
151
+ self.passenger_name = attributes[:'passenger_name']
152
+ end
153
+
154
+ if attributes.key?(:'segment1')
155
+ self.segment1 = attributes[:'segment1']
156
+ end
157
+
158
+ if attributes.key?(:'segment2')
159
+ self.segment2 = attributes[:'segment2']
160
+ end
161
+
162
+ if attributes.key?(:'segment3')
163
+ self.segment3 = attributes[:'segment3']
164
+ end
165
+
166
+ if attributes.key?(:'segment4')
167
+ self.segment4 = attributes[:'segment4']
168
+ end
169
+
170
+ if attributes.key?(:'ticket_issue_city')
171
+ self.ticket_issue_city = attributes[:'ticket_issue_city']
172
+ end
173
+
174
+ if attributes.key?(:'ticket_issue_date')
175
+ self.ticket_issue_date = attributes[:'ticket_issue_date']
176
+ end
177
+
178
+ if attributes.key?(:'ticket_issue_name')
179
+ self.ticket_issue_name = attributes[:'ticket_issue_name']
180
+ end
181
+
182
+ if attributes.key?(:'ticket_no')
183
+ self.ticket_no = attributes[:'ticket_no']
184
+ end
185
+
186
+ if attributes.key?(:'transaction_type')
187
+ self.transaction_type = attributes[:'transaction_type']
188
+ end
189
+ end
190
+
191
+ # Show invalid properties with the reasons. Usually used together with valid?
192
+ # @return Array for valid properties with the reasons
193
+ def list_invalid_properties
194
+ invalid_properties = Array.new
195
+ if @carrier_name.nil?
196
+ invalid_properties.push('invalid value for "carrier_name", carrier_name cannot be nil.')
197
+ end
198
+
199
+ if @carrier_name.to_s.length > 25
200
+ invalid_properties.push('invalid value for "carrier_name", the character length must be smaller than or equal to 25.')
201
+ end
202
+
203
+ if !@no_air_segments.nil? && @no_air_segments > 4
204
+ invalid_properties.push('invalid value for "no_air_segments", must be smaller than or equal to 4.')
205
+ end
206
+
207
+ if !@no_air_segments.nil? && @no_air_segments < 0
208
+ invalid_properties.push('invalid value for "no_air_segments", must be greater than or equal to 0.')
209
+ end
210
+
211
+ if @number_in_party.nil?
212
+ invalid_properties.push('invalid value for "number_in_party", number_in_party cannot be nil.')
213
+ end
214
+
215
+ if !@original_ticket_no.nil? && @original_ticket_no.to_s.length > 14
216
+ invalid_properties.push('invalid value for "original_ticket_no", the character length must be smaller than or equal to 14.')
217
+ end
218
+
219
+ if !@passenger_name.nil? && @passenger_name.to_s.length > 25
220
+ invalid_properties.push('invalid value for "passenger_name", the character length must be smaller than or equal to 25.')
221
+ end
222
+
223
+ if @segment1.nil?
224
+ invalid_properties.push('invalid value for "segment1", segment1 cannot be nil.')
225
+ end
226
+
227
+ if @ticket_issue_city.nil?
228
+ invalid_properties.push('invalid value for "ticket_issue_city", ticket_issue_city cannot be nil.')
229
+ end
230
+
231
+ if @ticket_issue_city.to_s.length > 18
232
+ invalid_properties.push('invalid value for "ticket_issue_city", the character length must be smaller than or equal to 18.')
233
+ end
234
+
235
+ if @ticket_issue_date.nil?
236
+ invalid_properties.push('invalid value for "ticket_issue_date", ticket_issue_date cannot be nil.')
237
+ end
238
+
239
+ if @ticket_issue_name.nil?
240
+ invalid_properties.push('invalid value for "ticket_issue_name", ticket_issue_name cannot be nil.')
241
+ end
242
+
243
+ if @ticket_issue_name.to_s.length > 26
244
+ invalid_properties.push('invalid value for "ticket_issue_name", the character length must be smaller than or equal to 26.')
245
+ end
246
+
247
+ if @ticket_no.nil?
248
+ invalid_properties.push('invalid value for "ticket_no", ticket_no cannot be nil.')
249
+ end
250
+
251
+ if @ticket_no.to_s.length > 14
252
+ invalid_properties.push('invalid value for "ticket_no", the character length must be smaller than or equal to 14.')
253
+ end
254
+
255
+ if @transaction_type.nil?
256
+ invalid_properties.push('invalid value for "transaction_type", transaction_type cannot be nil.')
257
+ end
258
+
259
+ if @transaction_type.to_s.length > 3
260
+ invalid_properties.push('invalid value for "transaction_type", the character length must be smaller than or equal to 3.')
261
+ end
262
+
263
+ if @transaction_type.to_s.length < 3
264
+ invalid_properties.push('invalid value for "transaction_type", the character length must be great than or equal to 3.')
265
+ end
266
+
267
+ invalid_properties
268
+ end
269
+
270
+ # Check to see if the all the properties in the model are valid
271
+ # @return true if the model is valid
272
+ def valid?
273
+ return false if @carrier_name.nil?
274
+ return false if @carrier_name.to_s.length > 25
275
+ return false if !@no_air_segments.nil? && @no_air_segments > 4
276
+ return false if !@no_air_segments.nil? && @no_air_segments < 0
277
+ return false if @number_in_party.nil?
278
+ return false if !@original_ticket_no.nil? && @original_ticket_no.to_s.length > 14
279
+ return false if !@passenger_name.nil? && @passenger_name.to_s.length > 25
280
+ return false if @segment1.nil?
281
+ return false if @ticket_issue_city.nil?
282
+ return false if @ticket_issue_city.to_s.length > 18
283
+ return false if @ticket_issue_date.nil?
284
+ return false if @ticket_issue_name.nil?
285
+ return false if @ticket_issue_name.to_s.length > 26
286
+ return false if @ticket_no.nil?
287
+ return false if @ticket_no.to_s.length > 14
288
+ return false if @transaction_type.nil?
289
+ return false if @transaction_type.to_s.length > 3
290
+ return false if @transaction_type.to_s.length < 3
291
+ true
292
+ end
293
+
294
+ # Custom attribute writer method with validation
295
+ # @param [Object] carrier_name Value to be assigned
296
+ def carrier_name=(carrier_name)
297
+ if carrier_name.nil?
298
+ fail ArgumentError, 'carrier_name cannot be nil'
299
+ end
300
+
301
+ if carrier_name.to_s.length > 25
302
+ fail ArgumentError, 'invalid value for "carrier_name", the character length must be smaller than or equal to 25.'
303
+ end
304
+
305
+ @carrier_name = carrier_name
306
+ end
307
+
308
+ # Custom attribute writer method with validation
309
+ # @param [Object] no_air_segments Value to be assigned
310
+ def no_air_segments=(no_air_segments)
311
+ if !no_air_segments.nil? && no_air_segments > 4
312
+ fail ArgumentError, 'invalid value for "no_air_segments", must be smaller than or equal to 4.'
313
+ end
314
+
315
+ if !no_air_segments.nil? && no_air_segments < 0
316
+ fail ArgumentError, 'invalid value for "no_air_segments", must be greater than or equal to 0.'
317
+ end
318
+
319
+ @no_air_segments = no_air_segments
320
+ end
321
+
322
+ # Custom attribute writer method with validation
323
+ # @param [Object] original_ticket_no Value to be assigned
324
+ def original_ticket_no=(original_ticket_no)
325
+ if !original_ticket_no.nil? && original_ticket_no.to_s.length > 14
326
+ fail ArgumentError, 'invalid value for "original_ticket_no", the character length must be smaller than or equal to 14.'
327
+ end
328
+
329
+ @original_ticket_no = original_ticket_no
330
+ end
331
+
332
+ # Custom attribute writer method with validation
333
+ # @param [Object] passenger_name Value to be assigned
334
+ def passenger_name=(passenger_name)
335
+ if !passenger_name.nil? && passenger_name.to_s.length > 25
336
+ fail ArgumentError, 'invalid value for "passenger_name", the character length must be smaller than or equal to 25.'
337
+ end
338
+
339
+ @passenger_name = passenger_name
340
+ end
341
+
342
+ # Custom attribute writer method with validation
343
+ # @param [Object] ticket_issue_city Value to be assigned
344
+ def ticket_issue_city=(ticket_issue_city)
345
+ if ticket_issue_city.nil?
346
+ fail ArgumentError, 'ticket_issue_city cannot be nil'
347
+ end
348
+
349
+ if ticket_issue_city.to_s.length > 18
350
+ fail ArgumentError, 'invalid value for "ticket_issue_city", the character length must be smaller than or equal to 18.'
351
+ end
352
+
353
+ @ticket_issue_city = ticket_issue_city
354
+ end
355
+
356
+ # Custom attribute writer method with validation
357
+ # @param [Object] ticket_issue_name Value to be assigned
358
+ def ticket_issue_name=(ticket_issue_name)
359
+ if ticket_issue_name.nil?
360
+ fail ArgumentError, 'ticket_issue_name cannot be nil'
361
+ end
362
+
363
+ if ticket_issue_name.to_s.length > 26
364
+ fail ArgumentError, 'invalid value for "ticket_issue_name", the character length must be smaller than or equal to 26.'
365
+ end
366
+
367
+ @ticket_issue_name = ticket_issue_name
368
+ end
369
+
370
+ # Custom attribute writer method with validation
371
+ # @param [Object] ticket_no Value to be assigned
372
+ def ticket_no=(ticket_no)
373
+ if ticket_no.nil?
374
+ fail ArgumentError, 'ticket_no cannot be nil'
375
+ end
376
+
377
+ if ticket_no.to_s.length > 14
378
+ fail ArgumentError, 'invalid value for "ticket_no", the character length must be smaller than or equal to 14.'
379
+ end
380
+
381
+ @ticket_no = ticket_no
382
+ end
383
+
384
+ # Custom attribute writer method with validation
385
+ # @param [Object] transaction_type Value to be assigned
386
+ def transaction_type=(transaction_type)
387
+ if transaction_type.nil?
388
+ fail ArgumentError, 'transaction_type cannot be nil'
389
+ end
390
+
391
+ if transaction_type.to_s.length > 3
392
+ fail ArgumentError, 'invalid value for "transaction_type", the character length must be smaller than or equal to 3.'
393
+ end
394
+
395
+ if transaction_type.to_s.length < 3
396
+ fail ArgumentError, 'invalid value for "transaction_type", the character length must be great than or equal to 3.'
397
+ end
398
+
399
+ @transaction_type = transaction_type
400
+ end
401
+
402
+ # Checks equality by comparing each attribute.
403
+ # @param [Object] Object to be compared
404
+ def ==(o)
405
+ return true if self.equal?(o)
406
+ self.class == o.class &&
407
+ carrier_name == o.carrier_name &&
408
+ conjunction_ticket_indicator == o.conjunction_ticket_indicator &&
409
+ eticket_indicator == o.eticket_indicator &&
410
+ no_air_segments == o.no_air_segments &&
411
+ number_in_party == o.number_in_party &&
412
+ original_ticket_no == o.original_ticket_no &&
413
+ passenger_name == o.passenger_name &&
414
+ segment1 == o.segment1 &&
415
+ segment2 == o.segment2 &&
416
+ segment3 == o.segment3 &&
417
+ segment4 == o.segment4 &&
418
+ ticket_issue_city == o.ticket_issue_city &&
419
+ ticket_issue_date == o.ticket_issue_date &&
420
+ ticket_issue_name == o.ticket_issue_name &&
421
+ ticket_no == o.ticket_no &&
422
+ transaction_type == o.transaction_type
423
+ end
424
+
425
+ # @see the `==` method
426
+ # @param [Object] Object to be compared
427
+ def eql?(o)
428
+ self == o
429
+ end
430
+
431
+ # Calculates hash code according to all attributes.
432
+ # @return [Integer] Hash code
433
+ def hash
434
+ [carrier_name, conjunction_ticket_indicator, eticket_indicator, no_air_segments, number_in_party, original_ticket_no, passenger_name, segment1, segment2, segment3, segment4, ticket_issue_city, ticket_issue_date, ticket_issue_name, ticket_no, transaction_type].hash
435
+ end
436
+
437
+ # Builds the object from hash
438
+ # @param [Hash] attributes Model attributes in the form of hash
439
+ # @return [Object] Returns the model itself
440
+ def self.build_from_hash(attributes)
441
+ new.build_from_hash(attributes)
442
+ end
443
+
444
+ # Builds the object from hash
445
+ # @param [Hash] attributes Model attributes in the form of hash
446
+ # @return [Object] Returns the model itself
447
+ def build_from_hash(attributes)
448
+ return nil unless attributes.is_a?(Hash)
449
+ self.class.openapi_types.each_pair do |key, type|
450
+ if type =~ /\AArray<(.*)>/i
451
+ # check to ensure the input is an array given that the attribute
452
+ # is documented as an array but the input is not
453
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
454
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
455
+ end
456
+ elsif !attributes[self.class.attribute_map[key]].nil?
457
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
458
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
459
+ end
460
+
461
+ self
462
+ end
463
+
464
+ # Deserializes the data based on type
465
+ # @param string type Data type
466
+ # @param string value Value to be deserialized
467
+ # @return [Object] Deserialized data
468
+ def _deserialize(type, value)
469
+ case type.to_sym
470
+ when :DateTime
471
+ DateTime.parse(value)
472
+ when :Date
473
+ Date.parse(value)
474
+ when :String
475
+ value.to_s
476
+ when :Integer
477
+ value.to_i
478
+ when :Float
479
+ value.to_f
480
+ when :Boolean
481
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
482
+ true
483
+ else
484
+ false
485
+ end
486
+ when :Object
487
+ # generic object (usually a Hash), return directly
488
+ value
489
+ when /\AArray<(?<inner_type>.+)>\z/
490
+ inner_type = Regexp.last_match[:inner_type]
491
+ value.map { |v| _deserialize(inner_type, v) }
492
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
493
+ k_type = Regexp.last_match[:k_type]
494
+ v_type = Regexp.last_match[:v_type]
495
+ {}.tap do |hash|
496
+ value.each do |k, v|
497
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
498
+ end
499
+ end
500
+ else # model
501
+ CityPayApiClient.const_get(type).build_from_hash(value)
502
+ end
503
+ end
504
+
505
+ # Returns the string representation of the object
506
+ # @return [String] String presentation of the object
507
+ def to_s
508
+ to_hash.to_s
509
+ end
510
+
511
+ # to_body is an alias to to_hash (backward compatibility)
512
+ # @return [Hash] Returns the object in the form of hash
513
+ def to_body
514
+ to_hash
515
+ end
516
+
517
+ # Returns the object in the form of hash
518
+ # @return [Hash] Returns the object in the form of hash
519
+ def to_hash
520
+ hash = {}
521
+ self.class.attribute_map.each_pair do |attr, param|
522
+ value = self.send(attr)
523
+ if value.nil?
524
+ is_nullable = self.class.openapi_nullable.include?(attr)
525
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
526
+ end
527
+
528
+ hash[param] = _to_hash(value)
529
+ end
530
+ hash
531
+ end
532
+
533
+ # Outputs non-array value in the form of hash
534
+ # For object, use to_hash. Otherwise, just return the value
535
+ # @param [Object] value Any valid value
536
+ # @return [Hash] Returns the value in the form of hash
537
+ def _to_hash(value)
538
+ if value.is_a?(Array)
539
+ value.compact.map { |v| _to_hash(v) }
540
+ elsif value.is_a?(Hash)
541
+ {}.tap do |hash|
542
+ value.each { |k, v| hash[k] = _to_hash(v) }
543
+ end
544
+ elsif value.respond_to? :to_hash
545
+ value.to_hash
546
+ else
547
+ value
548
+ end
549
+ end
550
+ end
551
+ end