first_data_gateway 1.0.1

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 (176) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +123 -0
  4. data/Rakefile +8 -0
  5. data/docs/AccessTokenResponse.md +11 -0
  6. data/docs/Address.md +14 -0
  7. data/docs/Airline.md +21 -0
  8. data/docs/AirlineAncillaryServiceCategory.md +8 -0
  9. data/docs/AirlineTravelRoute.md +16 -0
  10. data/docs/Amount.md +10 -0
  11. data/docs/AmountComponents.md +14 -0
  12. data/docs/AuthenticationApi.md +68 -0
  13. data/docs/AuthenticationResponseVerification.md +10 -0
  14. data/docs/BasketItem.md +11 -0
  15. data/docs/Billing.md +13 -0
  16. data/docs/CarRental.md +15 -0
  17. data/docs/CarRentalExtraCharges.md +8 -0
  18. data/docs/CardVerificationsTransaction.md +9 -0
  19. data/docs/ClientLocale.md +9 -0
  20. data/docs/Contact.md +11 -0
  21. data/docs/Error.md +10 -0
  22. data/docs/ErrorDetails.md +9 -0
  23. data/docs/ErrorResponse.md +11 -0
  24. data/docs/Expiration.md +9 -0
  25. data/docs/Frequency.md +9 -0
  26. data/docs/IndustrySpecificExtensions.md +10 -0
  27. data/docs/InstallmentOptions.md +10 -0
  28. data/docs/Lodging.md +12 -0
  29. data/docs/LodgingExtraCharges.md +8 -0
  30. data/docs/Order.md +10 -0
  31. data/docs/OrderApi.md +148 -0
  32. data/docs/PayPal.md +8 -0
  33. data/docs/PaymentApi.md +345 -0
  34. data/docs/PaymentCard.md +15 -0
  35. data/docs/PaymentCardAuthenticationRequest.md +8 -0
  36. data/docs/PaymentCardAuthenticationResult.md +12 -0
  37. data/docs/PaymentMethod.md +11 -0
  38. data/docs/PaymentSchedulesRequest.md +21 -0
  39. data/docs/PaymentSchedulesResponse.md +11 -0
  40. data/docs/PaymentUrlRequest.md +11 -0
  41. data/docs/PaymentUrlResponse.md +13 -0
  42. data/docs/PrimaryTransaction.md +18 -0
  43. data/docs/PrimaryTransactionAdditionalDetails.md +14 -0
  44. data/docs/ProcessorData.md +10 -0
  45. data/docs/ResponseType.md +7 -0
  46. data/docs/SecondaryTransaction.md +9 -0
  47. data/docs/Sepa.md +12 -0
  48. data/docs/SepaMandate.md +11 -0
  49. data/docs/Shipping.md +10 -0
  50. data/docs/SplitShipment.md +9 -0
  51. data/docs/StoredCredential.md +11 -0
  52. data/docs/TransactionErrorResponse.md +28 -0
  53. data/docs/TransactionResponse.md +27 -0
  54. data/docs/TransactionResponseAuthenticationRedirect.md +10 -0
  55. data/docs/TransactionResponseAuthenticationRedirectParams.md +10 -0
  56. data/docs/TransactionType.md +7 -0
  57. data/first_data_gateway.gemspec +45 -0
  58. data/git_push.sh +55 -0
  59. data/lib/simple/client_context.rb +15 -0
  60. data/lib/simple/gateway.rb +155 -0
  61. data/lib/simple/merchant_credentials.rb +10 -0
  62. data/lib/simple/signature.rb +52 -0
  63. data/lib/simple_client.rb +4 -0
  64. data/lib/swagger_client.rb +91 -0
  65. data/lib/swagger_client/api/authentication_api.rb +111 -0
  66. data/lib/swagger_client/api/order_api.rb +229 -0
  67. data/lib/swagger_client/api/payment_api.rb +517 -0
  68. data/lib/swagger_client/api_client.rb +390 -0
  69. data/lib/swagger_client/api_error.rb +38 -0
  70. data/lib/swagger_client/configuration.rb +202 -0
  71. data/lib/swagger_client/models/access_token_response.rb +252 -0
  72. data/lib/swagger_client/models/address.rb +361 -0
  73. data/lib/swagger_client/models/airline.rb +487 -0
  74. data/lib/swagger_client/models/airline_ancillary_service_category.rb +221 -0
  75. data/lib/swagger_client/models/airline_travel_route.rb +406 -0
  76. data/lib/swagger_client/models/amount.rb +217 -0
  77. data/lib/swagger_client/models/amount_components.rb +242 -0
  78. data/lib/swagger_client/models/authentication_response_verification.rb +239 -0
  79. data/lib/swagger_client/models/basket_item.rb +218 -0
  80. data/lib/swagger_client/models/billing.rb +282 -0
  81. data/lib/swagger_client/models/car_rental.rb +317 -0
  82. data/lib/swagger_client/models/car_rental_extra_charges.rb +221 -0
  83. data/lib/swagger_client/models/card_verifications_transaction.rb +203 -0
  84. data/lib/swagger_client/models/client_locale.rb +209 -0
  85. data/lib/swagger_client/models/contact.rb +279 -0
  86. data/lib/swagger_client/models/error.rb +211 -0
  87. data/lib/swagger_client/models/error_details.rb +199 -0
  88. data/lib/swagger_client/models/error_response.rb +218 -0
  89. data/lib/swagger_client/models/expiration.rb +207 -0
  90. data/lib/swagger_client/models/frequency.rb +270 -0
  91. data/lib/swagger_client/models/industry_specific_extensions.rb +206 -0
  92. data/lib/swagger_client/models/installment_options.rb +259 -0
  93. data/lib/swagger_client/models/lodging.rb +245 -0
  94. data/lib/swagger_client/models/lodging_extra_charges.rb +221 -0
  95. data/lib/swagger_client/models/order.rb +206 -0
  96. data/lib/swagger_client/models/pay_pal.rb +213 -0
  97. data/lib/swagger_client/models/payment_card.rb +294 -0
  98. data/lib/swagger_client/models/payment_card_authentication_request.rb +222 -0
  99. data/lib/swagger_client/models/payment_card_authentication_result.rb +336 -0
  100. data/lib/swagger_client/models/payment_method.rb +254 -0
  101. data/lib/swagger_client/models/payment_schedules_request.rb +398 -0
  102. data/lib/swagger_client/models/payment_schedules_response.rb +267 -0
  103. data/lib/swagger_client/models/payment_url_request.rb +232 -0
  104. data/lib/swagger_client/models/payment_url_response.rb +286 -0
  105. data/lib/swagger_client/models/primary_transaction.rb +298 -0
  106. data/lib/swagger_client/models/primary_transaction_additional_details.rb +244 -0
  107. data/lib/swagger_client/models/processor_data.rb +216 -0
  108. data/lib/swagger_client/models/response_type.rb +37 -0
  109. data/lib/swagger_client/models/secondary_transaction.rb +197 -0
  110. data/lib/swagger_client/models/sepa.rb +321 -0
  111. data/lib/swagger_client/models/sepa_mandate.rb +321 -0
  112. data/lib/swagger_client/models/shipping.rb +222 -0
  113. data/lib/swagger_client/models/split_shipment.rb +201 -0
  114. data/lib/swagger_client/models/stored_credential.rb +290 -0
  115. data/lib/swagger_client/models/transaction_error_response.rb +445 -0
  116. data/lib/swagger_client/models/transaction_response.rb +436 -0
  117. data/lib/swagger_client/models/transaction_response_authentication_redirect.rb +239 -0
  118. data/lib/swagger_client/models/transaction_response_authentication_redirect_params.rb +206 -0
  119. data/lib/swagger_client/models/transaction_type.rb +36 -0
  120. data/lib/swagger_client/version.rb +15 -0
  121. data/spec/api/authentication_api_spec.rb +51 -0
  122. data/spec/api/order_api_spec.rb +73 -0
  123. data/spec/api/payment_api_spec.rb +126 -0
  124. data/spec/api_client_spec.rb +226 -0
  125. data/spec/configuration_spec.rb +42 -0
  126. data/spec/models/access_token_response_spec.rb +64 -0
  127. data/spec/models/address_spec.rb +78 -0
  128. data/spec/models/airline_ancillary_service_category_spec.rb +46 -0
  129. data/spec/models/airline_spec.rb +124 -0
  130. data/spec/models/airline_travel_route_spec.rb +94 -0
  131. data/spec/models/amount_components_spec.rb +78 -0
  132. data/spec/models/amount_spec.rb +54 -0
  133. data/spec/models/authentication_response_verification_spec.rb +58 -0
  134. data/spec/models/basket_item_spec.rb +60 -0
  135. data/spec/models/billing_spec.rb +76 -0
  136. data/spec/models/car_rental_extra_charges_spec.rb +46 -0
  137. data/spec/models/car_rental_spec.rb +84 -0
  138. data/spec/models/card_verifications_transaction_spec.rb +48 -0
  139. data/spec/models/client_locale_spec.rb +48 -0
  140. data/spec/models/contact_spec.rb +60 -0
  141. data/spec/models/error_details_spec.rb +48 -0
  142. data/spec/models/error_response_spec.rb +60 -0
  143. data/spec/models/error_spec.rb +54 -0
  144. data/spec/models/expiration_spec.rb +48 -0
  145. data/spec/models/frequency_spec.rb +52 -0
  146. data/spec/models/industry_specific_extensions_spec.rb +54 -0
  147. data/spec/models/installment_options_spec.rb +54 -0
  148. data/spec/models/lodging_extra_charges_spec.rb +46 -0
  149. data/spec/models/lodging_spec.rb +66 -0
  150. data/spec/models/order_spec.rb +54 -0
  151. data/spec/models/pay_pal_spec.rb +42 -0
  152. data/spec/models/payment_card_authentication_request_spec.rb +46 -0
  153. data/spec/models/payment_card_authentication_result_spec.rb +78 -0
  154. data/spec/models/payment_card_spec.rb +88 -0
  155. data/spec/models/payment_method_spec.rb +64 -0
  156. data/spec/models/payment_schedules_request_spec.rb +124 -0
  157. data/spec/models/payment_schedules_response_spec.rb +64 -0
  158. data/spec/models/payment_url_request_spec.rb +60 -0
  159. data/spec/models/payment_url_response_spec.rb +76 -0
  160. data/spec/models/primary_transaction_additional_details_spec.rb +78 -0
  161. data/spec/models/primary_transaction_spec.rb +102 -0
  162. data/spec/models/processor_data_spec.rb +54 -0
  163. data/spec/models/response_type_spec.rb +36 -0
  164. data/spec/models/secondary_transaction_spec.rb +48 -0
  165. data/spec/models/sepa_mandate_spec.rb +64 -0
  166. data/spec/models/sepa_spec.rb +66 -0
  167. data/spec/models/shipping_spec.rb +54 -0
  168. data/spec/models/split_shipment_spec.rb +48 -0
  169. data/spec/models/stored_credential_spec.rb +68 -0
  170. data/spec/models/transaction_error_response_spec.rb +170 -0
  171. data/spec/models/transaction_response_authentication_redirect_params_spec.rb +54 -0
  172. data/spec/models/transaction_response_authentication_redirect_spec.rb +58 -0
  173. data/spec/models/transaction_response_spec.rb +164 -0
  174. data/spec/models/transaction_type_spec.rb +36 -0
  175. data/spec/spec_helper.rb +111 -0
  176. metadata +457 -0
@@ -0,0 +1,398 @@
1
+ =begin
2
+ #Payment Gateway API Specification
3
+
4
+ #Payment Gateway API for payment processing.
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SwaggerClient
16
+ # Request to create a gateway scheduler.
17
+ class PaymentSchedulesRequest
18
+ # Store ID number.
19
+ attr_accessor :store_id
20
+
21
+ # Order ID used to create recurring payment from existing transaction.
22
+ attr_accessor :reference_order_id
23
+
24
+ # Date of mandate signature.
25
+ attr_accessor :start_date
26
+
27
+ # Number of times the recurring payment will process.
28
+ attr_accessor :number_of_payments
29
+
30
+ # Number of failures that can be encountered before re-tries cease.
31
+ attr_accessor :maximum_failures
32
+
33
+ # Invoice number.
34
+ attr_accessor :invoice_number
35
+
36
+ # Purchase order number.
37
+ attr_accessor :po_number
38
+
39
+ # The source of the transaction. The possible values are ECI (if the order was received via email or Internet), MOTO (mail order / telephone order) and RETAIL (face to face).
40
+ attr_accessor :transaction_origin
41
+
42
+ # Dynamic merchant name for the cardholder‘s statement.
43
+ attr_accessor :dynamic_merchant_name
44
+
45
+ attr_accessor :frequency
46
+
47
+ attr_accessor :payment_method
48
+
49
+ attr_accessor :amount
50
+
51
+ attr_accessor :client_locale
52
+
53
+ # Client Order ID if supplied by client.
54
+ attr_accessor :order_id
55
+
56
+ class EnumAttributeValidator
57
+ attr_reader :datatype
58
+ attr_reader :allowable_values
59
+
60
+ def initialize(datatype, allowable_values)
61
+ @allowable_values = allowable_values.map do |value|
62
+ case datatype.to_s
63
+ when /Integer/i
64
+ value.to_i
65
+ when /Float/i
66
+ value.to_f
67
+ else
68
+ value
69
+ end
70
+ end
71
+ end
72
+
73
+ def valid?(value)
74
+ !value || allowable_values.include?(value)
75
+ end
76
+ end
77
+
78
+ # Attribute mapping from ruby-style variable name to JSON key.
79
+ def self.attribute_map
80
+ {
81
+ :'store_id' => :'storeId',
82
+ :'reference_order_id' => :'referenceOrderId',
83
+ :'start_date' => :'startDate',
84
+ :'number_of_payments' => :'numberOfPayments',
85
+ :'maximum_failures' => :'maximumFailures',
86
+ :'invoice_number' => :'invoiceNumber',
87
+ :'po_number' => :'poNumber',
88
+ :'transaction_origin' => :'transactionOrigin',
89
+ :'dynamic_merchant_name' => :'dynamicMerchantName',
90
+ :'frequency' => :'frequency',
91
+ :'payment_method' => :'paymentMethod',
92
+ :'amount' => :'amount',
93
+ :'client_locale' => :'clientLocale',
94
+ :'order_id' => :'orderId'
95
+ }
96
+ end
97
+
98
+ # Attribute type mapping.
99
+ def self.swagger_types
100
+ {
101
+ :'store_id' => :'String',
102
+ :'reference_order_id' => :'String',
103
+ :'start_date' => :'Date',
104
+ :'number_of_payments' => :'Integer',
105
+ :'maximum_failures' => :'Integer',
106
+ :'invoice_number' => :'String',
107
+ :'po_number' => :'String',
108
+ :'transaction_origin' => :'String',
109
+ :'dynamic_merchant_name' => :'String',
110
+ :'frequency' => :'Frequency',
111
+ :'payment_method' => :'PaymentMethod',
112
+ :'amount' => :'Amount',
113
+ :'client_locale' => :'ClientLocale',
114
+ :'order_id' => :'String'
115
+ }
116
+ end
117
+
118
+ # Initializes the object
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ def initialize(attributes = {})
121
+ return unless attributes.is_a?(Hash)
122
+
123
+ # convert string to symbol for hash key
124
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
125
+
126
+ if attributes.has_key?(:'storeId')
127
+ self.store_id = attributes[:'storeId']
128
+ end
129
+
130
+ if attributes.has_key?(:'referenceOrderId')
131
+ self.reference_order_id = attributes[:'referenceOrderId']
132
+ end
133
+
134
+ if attributes.has_key?(:'startDate')
135
+ self.start_date = attributes[:'startDate']
136
+ end
137
+
138
+ if attributes.has_key?(:'numberOfPayments')
139
+ self.number_of_payments = attributes[:'numberOfPayments']
140
+ end
141
+
142
+ if attributes.has_key?(:'maximumFailures')
143
+ self.maximum_failures = attributes[:'maximumFailures']
144
+ end
145
+
146
+ if attributes.has_key?(:'invoiceNumber')
147
+ self.invoice_number = attributes[:'invoiceNumber']
148
+ end
149
+
150
+ if attributes.has_key?(:'poNumber')
151
+ self.po_number = attributes[:'poNumber']
152
+ end
153
+
154
+ if attributes.has_key?(:'transactionOrigin')
155
+ self.transaction_origin = attributes[:'transactionOrigin']
156
+ end
157
+
158
+ if attributes.has_key?(:'dynamicMerchantName')
159
+ self.dynamic_merchant_name = attributes[:'dynamicMerchantName']
160
+ end
161
+
162
+ if attributes.has_key?(:'frequency')
163
+ self.frequency = attributes[:'frequency']
164
+ end
165
+
166
+ if attributes.has_key?(:'paymentMethod')
167
+ self.payment_method = attributes[:'paymentMethod']
168
+ end
169
+
170
+ if attributes.has_key?(:'amount')
171
+ self.amount = attributes[:'amount']
172
+ end
173
+
174
+ if attributes.has_key?(:'clientLocale')
175
+ self.client_locale = attributes[:'clientLocale']
176
+ end
177
+
178
+ if attributes.has_key?(:'orderId')
179
+ self.order_id = attributes[:'orderId']
180
+ end
181
+
182
+ end
183
+
184
+ # Show invalid properties with the reasons. Usually used together with valid?
185
+ # @return Array for valid properties with the reasons
186
+ def list_invalid_properties
187
+ invalid_properties = Array.new
188
+ if !@number_of_payments.nil? && @number_of_payments > 999
189
+ invalid_properties.push("invalid value for 'number_of_payments', must be smaller than or equal to 999.")
190
+ end
191
+
192
+ if !@number_of_payments.nil? && @number_of_payments < 1
193
+ invalid_properties.push("invalid value for 'number_of_payments', must be greater than or equal to 1.")
194
+ end
195
+
196
+ if !@maximum_failures.nil? && @maximum_failures > 999
197
+ invalid_properties.push("invalid value for 'maximum_failures', must be smaller than or equal to 999.")
198
+ end
199
+
200
+ if !@maximum_failures.nil? && @maximum_failures < 1
201
+ invalid_properties.push("invalid value for 'maximum_failures', must be greater than or equal to 1.")
202
+ end
203
+
204
+ return invalid_properties
205
+ end
206
+
207
+ # Check to see if the all the properties in the model are valid
208
+ # @return true if the model is valid
209
+ def valid?
210
+ return false if !@number_of_payments.nil? && @number_of_payments > 999
211
+ return false if !@number_of_payments.nil? && @number_of_payments < 1
212
+ return false if !@maximum_failures.nil? && @maximum_failures > 999
213
+ return false if !@maximum_failures.nil? && @maximum_failures < 1
214
+ transaction_origin_validator = EnumAttributeValidator.new('String', ["ECI", "MOTO", "RETAIL"])
215
+ return false unless transaction_origin_validator.valid?(@transaction_origin)
216
+ return true
217
+ end
218
+
219
+ # Custom attribute writer method with validation
220
+ # @param [Object] number_of_payments Value to be assigned
221
+ def number_of_payments=(number_of_payments)
222
+
223
+ if !number_of_payments.nil? && number_of_payments > 999
224
+ fail ArgumentError, "invalid value for 'number_of_payments', must be smaller than or equal to 999."
225
+ end
226
+
227
+ if !number_of_payments.nil? && number_of_payments < 1
228
+ fail ArgumentError, "invalid value for 'number_of_payments', must be greater than or equal to 1."
229
+ end
230
+
231
+ @number_of_payments = number_of_payments
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] maximum_failures Value to be assigned
236
+ def maximum_failures=(maximum_failures)
237
+
238
+ if !maximum_failures.nil? && maximum_failures > 999
239
+ fail ArgumentError, "invalid value for 'maximum_failures', must be smaller than or equal to 999."
240
+ end
241
+
242
+ if !maximum_failures.nil? && maximum_failures < 1
243
+ fail ArgumentError, "invalid value for 'maximum_failures', must be greater than or equal to 1."
244
+ end
245
+
246
+ @maximum_failures = maximum_failures
247
+ end
248
+
249
+ # Custom attribute writer method checking allowed values (enum).
250
+ # @param [Object] transaction_origin Object to be assigned
251
+ def transaction_origin=(transaction_origin)
252
+ validator = EnumAttributeValidator.new('String', ["ECI", "MOTO", "RETAIL"])
253
+ unless validator.valid?(transaction_origin)
254
+ fail ArgumentError, "invalid value for 'transaction_origin', must be one of #{validator.allowable_values}."
255
+ end
256
+ @transaction_origin = transaction_origin
257
+ end
258
+
259
+ # Checks equality by comparing each attribute.
260
+ # @param [Object] Object to be compared
261
+ def ==(o)
262
+ return true if self.equal?(o)
263
+ self.class == o.class &&
264
+ store_id == o.store_id &&
265
+ reference_order_id == o.reference_order_id &&
266
+ start_date == o.start_date &&
267
+ number_of_payments == o.number_of_payments &&
268
+ maximum_failures == o.maximum_failures &&
269
+ invoice_number == o.invoice_number &&
270
+ po_number == o.po_number &&
271
+ transaction_origin == o.transaction_origin &&
272
+ dynamic_merchant_name == o.dynamic_merchant_name &&
273
+ frequency == o.frequency &&
274
+ payment_method == o.payment_method &&
275
+ amount == o.amount &&
276
+ client_locale == o.client_locale &&
277
+ order_id == o.order_id
278
+ end
279
+
280
+ # @see the `==` method
281
+ # @param [Object] Object to be compared
282
+ def eql?(o)
283
+ self == o
284
+ end
285
+
286
+ # Calculates hash code according to all attributes.
287
+ # @return [Fixnum] Hash code
288
+ def hash
289
+ [store_id, reference_order_id, start_date, number_of_payments, maximum_failures, invoice_number, po_number, transaction_origin, dynamic_merchant_name, frequency, payment_method, amount, client_locale, order_id].hash
290
+ end
291
+
292
+ # Builds the object from hash
293
+ # @param [Hash] attributes Model attributes in the form of hash
294
+ # @return [Object] Returns the model itself
295
+ def build_from_hash(attributes)
296
+ return nil unless attributes.is_a?(Hash)
297
+ self.class.swagger_types.each_pair do |key, type|
298
+ if type =~ /\AArray<(.*)>/i
299
+ # check to ensure the input is an array given that the the attribute
300
+ # is documented as an array but the input is not
301
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
302
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
303
+ end
304
+ elsif !attributes[self.class.attribute_map[key]].nil?
305
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
306
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
307
+ end
308
+
309
+ self
310
+ end
311
+
312
+ # Deserializes the data based on type
313
+ # @param string type Data type
314
+ # @param string value Value to be deserialized
315
+ # @return [Object] Deserialized data
316
+ def _deserialize(type, value)
317
+ case type.to_sym
318
+ when :DateTime
319
+ DateTime.parse(value)
320
+ when :Date
321
+ Date.parse(value)
322
+ when :String
323
+ value.to_s
324
+ when :Integer
325
+ value.to_i
326
+ when :Float
327
+ value.to_f
328
+ when :BOOLEAN
329
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
330
+ true
331
+ else
332
+ false
333
+ end
334
+ when :Object
335
+ # generic object (usually a Hash), return directly
336
+ value
337
+ when /\AArray<(?<inner_type>.+)>\z/
338
+ inner_type = Regexp.last_match[:inner_type]
339
+ value.map { |v| _deserialize(inner_type, v) }
340
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
341
+ k_type = Regexp.last_match[:k_type]
342
+ v_type = Regexp.last_match[:v_type]
343
+ {}.tap do |hash|
344
+ value.each do |k, v|
345
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
346
+ end
347
+ end
348
+ else # model
349
+ temp_model = SwaggerClient.const_get(type).new
350
+ temp_model.build_from_hash(value)
351
+ end
352
+ end
353
+
354
+ # Returns the string representation of the object
355
+ # @return [String] String presentation of the object
356
+ def to_s
357
+ to_hash.to_s
358
+ end
359
+
360
+ # to_body is an alias to to_hash (backward compatibility)
361
+ # @return [Hash] Returns the object in the form of hash
362
+ def to_body
363
+ to_hash
364
+ end
365
+
366
+ # Returns the object in the form of hash
367
+ # @return [Hash] Returns the object in the form of hash
368
+ def to_hash
369
+ hash = {}
370
+ self.class.attribute_map.each_pair do |attr, param|
371
+ value = self.send(attr)
372
+ next if value.nil?
373
+ hash[param] = _to_hash(value)
374
+ end
375
+ hash
376
+ end
377
+
378
+ # Outputs non-array value in the form of hash
379
+ # For object, use to_hash. Otherwise, just return the value
380
+ # @param [Object] value Any valid value
381
+ # @return [Hash] Returns the value in the form of hash
382
+ def _to_hash(value)
383
+ if value.is_a?(Array)
384
+ value.compact.map{ |v| _to_hash(v) }
385
+ elsif value.is_a?(Hash)
386
+ {}.tap do |hash|
387
+ value.each { |k, v| hash[k] = _to_hash(v) }
388
+ end
389
+ elsif value.respond_to? :to_hash
390
+ value.to_hash
391
+ else
392
+ value
393
+ end
394
+ end
395
+
396
+ end
397
+
398
+ end
@@ -0,0 +1,267 @@
1
+ =begin
2
+ #Payment Gateway API Specification
3
+
4
+ #Payment Gateway API for payment processing.
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SwaggerClient
16
+ # Response from the gateway scheduler creation call.
17
+ class PaymentSchedulesResponse
18
+ # Echoes back the value in the Request header for tracking.
19
+ attr_accessor :client_request_id
20
+
21
+ # Request identifier in API, can be used to request logs from the support.
22
+ attr_accessor :api_trace_id
23
+
24
+ # Result of requested operation. If it's anything other than 'SUCCESS', please refer to 400s HTTP error codes or decline. See Error object for details.
25
+ attr_accessor :transaction_status
26
+
27
+ # Client Order ID if supplied by client, otherwise the Order ID.
28
+ attr_accessor :order_id
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'client_request_id' => :'clientRequestId',
56
+ :'api_trace_id' => :'apiTraceId',
57
+ :'transaction_status' => :'transactionStatus',
58
+ :'order_id' => :'orderId'
59
+ }
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.swagger_types
64
+ {
65
+ :'client_request_id' => :'String',
66
+ :'api_trace_id' => :'String',
67
+ :'transaction_status' => :'String',
68
+ :'order_id' => :'String'
69
+ }
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ return unless attributes.is_a?(Hash)
76
+
77
+ # convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
79
+
80
+ if attributes.has_key?(:'clientRequestId')
81
+ self.client_request_id = attributes[:'clientRequestId']
82
+ end
83
+
84
+ if attributes.has_key?(:'apiTraceId')
85
+ self.api_trace_id = attributes[:'apiTraceId']
86
+ end
87
+
88
+ if attributes.has_key?(:'transactionStatus')
89
+ self.transaction_status = attributes[:'transactionStatus']
90
+ end
91
+
92
+ if attributes.has_key?(:'orderId')
93
+ self.order_id = attributes[:'orderId']
94
+ end
95
+
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ if @client_request_id.nil?
103
+ invalid_properties.push("invalid value for 'client_request_id', client_request_id cannot be nil.")
104
+ end
105
+
106
+ if @api_trace_id.nil?
107
+ invalid_properties.push("invalid value for 'api_trace_id', api_trace_id cannot be nil.")
108
+ end
109
+
110
+ if @transaction_status.nil?
111
+ invalid_properties.push("invalid value for 'transaction_status', transaction_status cannot be nil.")
112
+ end
113
+
114
+ return invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ return false if @client_request_id.nil?
121
+ return false if @api_trace_id.nil?
122
+ return false if @transaction_status.nil?
123
+ transaction_status_validator = EnumAttributeValidator.new('String', ["SUCCESS", "VALIDATION_FAILED", "PROCESSING_FAILED", "FAILURE"])
124
+ return false unless transaction_status_validator.valid?(@transaction_status)
125
+ return true
126
+ end
127
+
128
+ # Custom attribute writer method checking allowed values (enum).
129
+ # @param [Object] transaction_status Object to be assigned
130
+ def transaction_status=(transaction_status)
131
+ validator = EnumAttributeValidator.new('String', ["SUCCESS", "VALIDATION_FAILED", "PROCESSING_FAILED", "FAILURE"])
132
+ unless validator.valid?(transaction_status)
133
+ fail ArgumentError, "invalid value for 'transaction_status', must be one of #{validator.allowable_values}."
134
+ end
135
+ @transaction_status = transaction_status
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ client_request_id == o.client_request_id &&
144
+ api_trace_id == o.api_trace_id &&
145
+ transaction_status == o.transaction_status &&
146
+ order_id == o.order_id
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Fixnum] Hash code
157
+ def hash
158
+ [client_request_id, api_trace_id, transaction_status, order_id].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ self.class.swagger_types.each_pair do |key, type|
167
+ if type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
171
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
172
+ end
173
+ elsif !attributes[self.class.attribute_map[key]].nil?
174
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
175
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
176
+ end
177
+
178
+ self
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param string type Data type
183
+ # @param string value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def _deserialize(type, value)
186
+ case type.to_sym
187
+ when :DateTime
188
+ DateTime.parse(value)
189
+ when :Date
190
+ Date.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :BOOLEAN
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ temp_model = SwaggerClient.const_get(type).new
219
+ temp_model.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ next if value.nil?
242
+ hash[param] = _to_hash(value)
243
+ end
244
+ hash
245
+ end
246
+
247
+ # Outputs non-array value in the form of hash
248
+ # For object, use to_hash. Otherwise, just return the value
249
+ # @param [Object] value Any valid value
250
+ # @return [Hash] Returns the value in the form of hash
251
+ def _to_hash(value)
252
+ if value.is_a?(Array)
253
+ value.compact.map{ |v| _to_hash(v) }
254
+ elsif value.is_a?(Hash)
255
+ {}.tap do |hash|
256
+ value.each { |k, v| hash[k] = _to_hash(v) }
257
+ end
258
+ elsif value.respond_to? :to_hash
259
+ value.to_hash
260
+ else
261
+ value
262
+ end
263
+ end
264
+
265
+ end
266
+
267
+ end