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,445 @@
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
+
17
+ class TransactionErrorResponse
18
+ # The schema type returned in the response.
19
+ attr_accessor :response_type
20
+
21
+ # Echoes back the value in the Request header
22
+ attr_accessor :client_request_id
23
+
24
+ # Echoes back the value in the Request header
25
+ attr_accessor :api_trace_id
26
+
27
+ # The Response Transaction ID
28
+ attr_accessor :ipg_transaction_id
29
+
30
+ # Client Order ID if supplied by client, otherwise the Order ID
31
+ attr_accessor :order_id
32
+
33
+ attr_accessor :transaction_type
34
+
35
+ # The processor approval code for compliance.
36
+ attr_accessor :authorization_code
37
+
38
+ # The processor address validation response for compliance.
39
+ attr_accessor :avs_response
40
+
41
+ # The processor card verification validation response for compliance.
42
+ attr_accessor :security_code_response
43
+
44
+ # Card brand of the payment instrument
45
+ attr_accessor :brand
46
+
47
+ # Country of the card issuer
48
+ attr_accessor :country
49
+
50
+ # The terminal that is processing the transaction
51
+ attr_accessor :terminal_id
52
+
53
+ # The unique client Transaction ID from the Request header, if supplied
54
+ attr_accessor :client_transaction_id
55
+
56
+ # The transaction time in seconds since Epoch
57
+ attr_accessor :transaction_time
58
+
59
+ attr_accessor :approved_amount
60
+
61
+ # The status of the transaction. APPROVED/WAITING are returned by the endpoints. VALIDATION_FAILED/DECLINED are errors. See ErrorResponse object for details.
62
+ attr_accessor :transaction_status
63
+
64
+ # The state of the transaction.
65
+ attr_accessor :transaction_state
66
+
67
+ attr_accessor :authentication_redirect
68
+
69
+ # The transaction id received from schemes for the initial transaction, returned for the transactions marked as \"FIRST\"
70
+ attr_accessor :scheme_transaction_id
71
+
72
+ attr_accessor :processor
73
+
74
+ attr_accessor :error
75
+
76
+ class EnumAttributeValidator
77
+ attr_reader :datatype
78
+ attr_reader :allowable_values
79
+
80
+ def initialize(datatype, allowable_values)
81
+ @allowable_values = allowable_values.map do |value|
82
+ case datatype.to_s
83
+ when /Integer/i
84
+ value.to_i
85
+ when /Float/i
86
+ value.to_f
87
+ else
88
+ value
89
+ end
90
+ end
91
+ end
92
+
93
+ def valid?(value)
94
+ !value || allowable_values.include?(value)
95
+ end
96
+ end
97
+
98
+ # Attribute mapping from ruby-style variable name to JSON key.
99
+ def self.attribute_map
100
+ {
101
+ :'response_type' => :'responseType',
102
+ :'client_request_id' => :'clientRequestId',
103
+ :'api_trace_id' => :'apiTraceId',
104
+ :'ipg_transaction_id' => :'ipgTransactionId',
105
+ :'order_id' => :'orderId',
106
+ :'transaction_type' => :'transactionType',
107
+ :'authorization_code' => :'authorizationCode',
108
+ :'avs_response' => :'avsResponse',
109
+ :'security_code_response' => :'securityCodeResponse',
110
+ :'brand' => :'brand',
111
+ :'country' => :'country',
112
+ :'terminal_id' => :'terminalId',
113
+ :'client_transaction_id' => :'clientTransactionId',
114
+ :'transaction_time' => :'transactionTime',
115
+ :'approved_amount' => :'approvedAmount',
116
+ :'transaction_status' => :'transactionStatus',
117
+ :'transaction_state' => :'transactionState',
118
+ :'authentication_redirect' => :'authenticationRedirect',
119
+ :'scheme_transaction_id' => :'schemeTransactionId',
120
+ :'processor' => :'processor',
121
+ :'error' => :'error'
122
+ }
123
+ end
124
+
125
+ # Attribute type mapping.
126
+ def self.swagger_types
127
+ {
128
+ :'response_type' => :'ResponseType',
129
+ :'client_request_id' => :'String',
130
+ :'api_trace_id' => :'String',
131
+ :'ipg_transaction_id' => :'String',
132
+ :'order_id' => :'String',
133
+ :'transaction_type' => :'TransactionType',
134
+ :'authorization_code' => :'String',
135
+ :'avs_response' => :'String',
136
+ :'security_code_response' => :'String',
137
+ :'brand' => :'String',
138
+ :'country' => :'String',
139
+ :'terminal_id' => :'String',
140
+ :'client_transaction_id' => :'String',
141
+ :'transaction_time' => :'Integer',
142
+ :'approved_amount' => :'Amount',
143
+ :'transaction_status' => :'String',
144
+ :'transaction_state' => :'String',
145
+ :'authentication_redirect' => :'TransactionResponseAuthenticationRedirect',
146
+ :'scheme_transaction_id' => :'String',
147
+ :'processor' => :'ProcessorData',
148
+ :'error' => :'Error'
149
+ }
150
+ end
151
+
152
+ # Initializes the object
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ def initialize(attributes = {})
155
+ return unless attributes.is_a?(Hash)
156
+
157
+ # convert string to symbol for hash key
158
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
159
+
160
+ if attributes.has_key?(:'responseType')
161
+ self.response_type = attributes[:'responseType']
162
+ end
163
+
164
+ if attributes.has_key?(:'clientRequestId')
165
+ self.client_request_id = attributes[:'clientRequestId']
166
+ end
167
+
168
+ if attributes.has_key?(:'apiTraceId')
169
+ self.api_trace_id = attributes[:'apiTraceId']
170
+ end
171
+
172
+ if attributes.has_key?(:'ipgTransactionId')
173
+ self.ipg_transaction_id = attributes[:'ipgTransactionId']
174
+ end
175
+
176
+ if attributes.has_key?(:'orderId')
177
+ self.order_id = attributes[:'orderId']
178
+ end
179
+
180
+ if attributes.has_key?(:'transactionType')
181
+ self.transaction_type = attributes[:'transactionType']
182
+ end
183
+
184
+ if attributes.has_key?(:'authorizationCode')
185
+ self.authorization_code = attributes[:'authorizationCode']
186
+ end
187
+
188
+ if attributes.has_key?(:'avsResponse')
189
+ self.avs_response = attributes[:'avsResponse']
190
+ end
191
+
192
+ if attributes.has_key?(:'securityCodeResponse')
193
+ self.security_code_response = attributes[:'securityCodeResponse']
194
+ end
195
+
196
+ if attributes.has_key?(:'brand')
197
+ self.brand = attributes[:'brand']
198
+ end
199
+
200
+ if attributes.has_key?(:'country')
201
+ self.country = attributes[:'country']
202
+ end
203
+
204
+ if attributes.has_key?(:'terminalId')
205
+ self.terminal_id = attributes[:'terminalId']
206
+ end
207
+
208
+ if attributes.has_key?(:'clientTransactionId')
209
+ self.client_transaction_id = attributes[:'clientTransactionId']
210
+ end
211
+
212
+ if attributes.has_key?(:'transactionTime')
213
+ self.transaction_time = attributes[:'transactionTime']
214
+ end
215
+
216
+ if attributes.has_key?(:'approvedAmount')
217
+ self.approved_amount = attributes[:'approvedAmount']
218
+ end
219
+
220
+ if attributes.has_key?(:'transactionStatus')
221
+ self.transaction_status = attributes[:'transactionStatus']
222
+ end
223
+
224
+ if attributes.has_key?(:'transactionState')
225
+ self.transaction_state = attributes[:'transactionState']
226
+ end
227
+
228
+ if attributes.has_key?(:'authenticationRedirect')
229
+ self.authentication_redirect = attributes[:'authenticationRedirect']
230
+ end
231
+
232
+ if attributes.has_key?(:'schemeTransactionId')
233
+ self.scheme_transaction_id = attributes[:'schemeTransactionId']
234
+ end
235
+
236
+ if attributes.has_key?(:'processor')
237
+ self.processor = attributes[:'processor']
238
+ end
239
+
240
+ if attributes.has_key?(:'error')
241
+ self.error = attributes[:'error']
242
+ end
243
+
244
+ end
245
+
246
+ # Show invalid properties with the reasons. Usually used together with valid?
247
+ # @return Array for valid properties with the reasons
248
+ def list_invalid_properties
249
+ invalid_properties = Array.new
250
+ if !@scheme_transaction_id.nil? && @scheme_transaction_id.to_s.length > 40
251
+ invalid_properties.push("invalid value for 'scheme_transaction_id', the character length must be smaller than or equal to 40.")
252
+ end
253
+
254
+ return invalid_properties
255
+ end
256
+
257
+ # Check to see if the all the properties in the model are valid
258
+ # @return true if the model is valid
259
+ def valid?
260
+ transaction_status_validator = EnumAttributeValidator.new('String', ["APPROVED", "WAITING", "VALIDATION_FAILED", "DECLINED"])
261
+ return false unless transaction_status_validator.valid?(@transaction_status)
262
+ transaction_state_validator = EnumAttributeValidator.new('String', ["AUTHORIZED", "CAPTURED", "COMPLETED_GET", "DECLINED", "CHECKED", "INITIALIZED", "PENDING_AUTHORIZATION", "PENDING_AUTOVOID", "PENDING_CAPTURE", "PENDING_CREDIT", "PENDING_GIROPAY_INIT", "PENDING_IDEAL_INIT", "PENDING_INIT", "PENDING_READY", "PENDING_RETURN", "PENDING_SETTLEMENT", "PENDING_SOFORT_INIT", "PENDING_VOID", "READY", "SETTLED", "VOIDED", "WAITING", "WAITING_AUTHENTICATION", "WAITING_3D_SECURE", "WAITING_CLICK_AND_BUY", "WAITING_GIROPAY", "WAITING_IDEAL", "WAITING_KLARNA", "WAITING_PAYPAL", "WAITING_PAYPAL_EVENT", "WAITING_PPRO_LONG_WAITING", "WAITING_SOFORT", "WAITING_T_PAY", "WAITING_ALIPAY_PAYSECURE"])
263
+ return false unless transaction_state_validator.valid?(@transaction_state)
264
+ return false if !@scheme_transaction_id.nil? && @scheme_transaction_id.to_s.length > 40
265
+ return true
266
+ end
267
+
268
+ # Custom attribute writer method checking allowed values (enum).
269
+ # @param [Object] transaction_status Object to be assigned
270
+ def transaction_status=(transaction_status)
271
+ validator = EnumAttributeValidator.new('String', ["APPROVED", "WAITING", "VALIDATION_FAILED", "DECLINED"])
272
+ unless validator.valid?(transaction_status)
273
+ fail ArgumentError, "invalid value for 'transaction_status', must be one of #{validator.allowable_values}."
274
+ end
275
+ @transaction_status = transaction_status
276
+ end
277
+
278
+ # Custom attribute writer method checking allowed values (enum).
279
+ # @param [Object] transaction_state Object to be assigned
280
+ def transaction_state=(transaction_state)
281
+ validator = EnumAttributeValidator.new('String', ["AUTHORIZED", "CAPTURED", "COMPLETED_GET", "DECLINED", "CHECKED", "INITIALIZED", "PENDING_AUTHORIZATION", "PENDING_AUTOVOID", "PENDING_CAPTURE", "PENDING_CREDIT", "PENDING_GIROPAY_INIT", "PENDING_IDEAL_INIT", "PENDING_INIT", "PENDING_READY", "PENDING_RETURN", "PENDING_SETTLEMENT", "PENDING_SOFORT_INIT", "PENDING_VOID", "READY", "SETTLED", "VOIDED", "WAITING", "WAITING_AUTHENTICATION", "WAITING_3D_SECURE", "WAITING_CLICK_AND_BUY", "WAITING_GIROPAY", "WAITING_IDEAL", "WAITING_KLARNA", "WAITING_PAYPAL", "WAITING_PAYPAL_EVENT", "WAITING_PPRO_LONG_WAITING", "WAITING_SOFORT", "WAITING_T_PAY", "WAITING_ALIPAY_PAYSECURE"])
282
+ unless validator.valid?(transaction_state)
283
+ fail ArgumentError, "invalid value for 'transaction_state', must be one of #{validator.allowable_values}."
284
+ end
285
+ @transaction_state = transaction_state
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] scheme_transaction_id Value to be assigned
290
+ def scheme_transaction_id=(scheme_transaction_id)
291
+
292
+ if !scheme_transaction_id.nil? && scheme_transaction_id.to_s.length > 40
293
+ fail ArgumentError, "invalid value for 'scheme_transaction_id', the character length must be smaller than or equal to 40."
294
+ end
295
+
296
+ @scheme_transaction_id = scheme_transaction_id
297
+ end
298
+
299
+ # Checks equality by comparing each attribute.
300
+ # @param [Object] Object to be compared
301
+ def ==(o)
302
+ return true if self.equal?(o)
303
+ self.class == o.class &&
304
+ response_type == o.response_type &&
305
+ client_request_id == o.client_request_id &&
306
+ api_trace_id == o.api_trace_id &&
307
+ ipg_transaction_id == o.ipg_transaction_id &&
308
+ order_id == o.order_id &&
309
+ transaction_type == o.transaction_type &&
310
+ authorization_code == o.authorization_code &&
311
+ avs_response == o.avs_response &&
312
+ security_code_response == o.security_code_response &&
313
+ brand == o.brand &&
314
+ country == o.country &&
315
+ terminal_id == o.terminal_id &&
316
+ client_transaction_id == o.client_transaction_id &&
317
+ transaction_time == o.transaction_time &&
318
+ approved_amount == o.approved_amount &&
319
+ transaction_status == o.transaction_status &&
320
+ transaction_state == o.transaction_state &&
321
+ authentication_redirect == o.authentication_redirect &&
322
+ scheme_transaction_id == o.scheme_transaction_id &&
323
+ processor == o.processor &&
324
+ error == o.error
325
+ end
326
+
327
+ # @see the `==` method
328
+ # @param [Object] Object to be compared
329
+ def eql?(o)
330
+ self == o
331
+ end
332
+
333
+ # Calculates hash code according to all attributes.
334
+ # @return [Fixnum] Hash code
335
+ def hash
336
+ [response_type, client_request_id, api_trace_id, ipg_transaction_id, order_id, transaction_type, authorization_code, avs_response, security_code_response, brand, country, terminal_id, client_transaction_id, transaction_time, approved_amount, transaction_status, transaction_state, authentication_redirect, scheme_transaction_id, processor, error].hash
337
+ end
338
+
339
+ # Builds the object from hash
340
+ # @param [Hash] attributes Model attributes in the form of hash
341
+ # @return [Object] Returns the model itself
342
+ def build_from_hash(attributes)
343
+ return nil unless attributes.is_a?(Hash)
344
+ self.class.swagger_types.each_pair do |key, type|
345
+ if type =~ /\AArray<(.*)>/i
346
+ # check to ensure the input is an array given that the the attribute
347
+ # is documented as an array but the input is not
348
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
349
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
350
+ end
351
+ elsif !attributes[self.class.attribute_map[key]].nil?
352
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
353
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
354
+ end
355
+
356
+ self
357
+ end
358
+
359
+ # Deserializes the data based on type
360
+ # @param string type Data type
361
+ # @param string value Value to be deserialized
362
+ # @return [Object] Deserialized data
363
+ def _deserialize(type, value)
364
+ case type.to_sym
365
+ when :DateTime
366
+ DateTime.parse(value)
367
+ when :Date
368
+ Date.parse(value)
369
+ when :String
370
+ value.to_s
371
+ when :Integer
372
+ value.to_i
373
+ when :Float
374
+ value.to_f
375
+ when :BOOLEAN
376
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
377
+ true
378
+ else
379
+ false
380
+ end
381
+ when :Object
382
+ # generic object (usually a Hash), return directly
383
+ value
384
+ when /\AArray<(?<inner_type>.+)>\z/
385
+ inner_type = Regexp.last_match[:inner_type]
386
+ value.map { |v| _deserialize(inner_type, v) }
387
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
388
+ k_type = Regexp.last_match[:k_type]
389
+ v_type = Regexp.last_match[:v_type]
390
+ {}.tap do |hash|
391
+ value.each do |k, v|
392
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
393
+ end
394
+ end
395
+ else # model
396
+ temp_model = SwaggerClient.const_get(type).new
397
+ temp_model.build_from_hash(value)
398
+ end
399
+ end
400
+
401
+ # Returns the string representation of the object
402
+ # @return [String] String presentation of the object
403
+ def to_s
404
+ to_hash.to_s
405
+ end
406
+
407
+ # to_body is an alias to to_hash (backward compatibility)
408
+ # @return [Hash] Returns the object in the form of hash
409
+ def to_body
410
+ to_hash
411
+ end
412
+
413
+ # Returns the object in the form of hash
414
+ # @return [Hash] Returns the object in the form of hash
415
+ def to_hash
416
+ hash = {}
417
+ self.class.attribute_map.each_pair do |attr, param|
418
+ value = self.send(attr)
419
+ next if value.nil?
420
+ hash[param] = _to_hash(value)
421
+ end
422
+ hash
423
+ end
424
+
425
+ # Outputs non-array value in the form of hash
426
+ # For object, use to_hash. Otherwise, just return the value
427
+ # @param [Object] value Any valid value
428
+ # @return [Hash] Returns the value in the form of hash
429
+ def _to_hash(value)
430
+ if value.is_a?(Array)
431
+ value.compact.map{ |v| _to_hash(v) }
432
+ elsif value.is_a?(Hash)
433
+ {}.tap do |hash|
434
+ value.each { |k, v| hash[k] = _to_hash(v) }
435
+ end
436
+ elsif value.respond_to? :to_hash
437
+ value.to_hash
438
+ else
439
+ value
440
+ end
441
+ end
442
+
443
+ end
444
+
445
+ end
@@ -0,0 +1,436 @@
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
+ # This is the common object for primary and secondary payment request responses
17
+ class TransactionResponse
18
+ # The schema type returned in the response.
19
+ attr_accessor :response_type
20
+
21
+ # Echoes back the value in the Request header
22
+ attr_accessor :client_request_id
23
+
24
+ # Echoes back the value in the Request header
25
+ attr_accessor :api_trace_id
26
+
27
+ # The Response Transaction ID
28
+ attr_accessor :ipg_transaction_id
29
+
30
+ # Client Order ID if supplied by client, otherwise the Order ID
31
+ attr_accessor :order_id
32
+
33
+ attr_accessor :transaction_type
34
+
35
+ # The processor approval code for compliance.
36
+ attr_accessor :authorization_code
37
+
38
+ # The processor address validation response for compliance.
39
+ attr_accessor :avs_response
40
+
41
+ # The processor card verification validation response for compliance.
42
+ attr_accessor :security_code_response
43
+
44
+ # Card brand of the payment instrument
45
+ attr_accessor :brand
46
+
47
+ # Country of the card issuer
48
+ attr_accessor :country
49
+
50
+ # The terminal that is processing the transaction
51
+ attr_accessor :terminal_id
52
+
53
+ # The unique client Transaction ID from the Request header, if supplied
54
+ attr_accessor :client_transaction_id
55
+
56
+ # The transaction time in seconds since Epoch
57
+ attr_accessor :transaction_time
58
+
59
+ attr_accessor :approved_amount
60
+
61
+ # The status of the transaction. APPROVED/WAITING are returned by the endpoints. VALIDATION_FAILED/DECLINED are errors. See ErrorResponse object for details.
62
+ attr_accessor :transaction_status
63
+
64
+ # The state of the transaction.
65
+ attr_accessor :transaction_state
66
+
67
+ attr_accessor :authentication_redirect
68
+
69
+ # The transaction id received from schemes for the initial transaction, returned for the transactions marked as \"FIRST\"
70
+ attr_accessor :scheme_transaction_id
71
+
72
+ attr_accessor :processor
73
+
74
+ class EnumAttributeValidator
75
+ attr_reader :datatype
76
+ attr_reader :allowable_values
77
+
78
+ def initialize(datatype, allowable_values)
79
+ @allowable_values = allowable_values.map do |value|
80
+ case datatype.to_s
81
+ when /Integer/i
82
+ value.to_i
83
+ when /Float/i
84
+ value.to_f
85
+ else
86
+ value
87
+ end
88
+ end
89
+ end
90
+
91
+ def valid?(value)
92
+ !value || allowable_values.include?(value)
93
+ end
94
+ end
95
+
96
+ # Attribute mapping from ruby-style variable name to JSON key.
97
+ def self.attribute_map
98
+ {
99
+ :'response_type' => :'responseType',
100
+ :'client_request_id' => :'clientRequestId',
101
+ :'api_trace_id' => :'apiTraceId',
102
+ :'ipg_transaction_id' => :'ipgTransactionId',
103
+ :'order_id' => :'orderId',
104
+ :'transaction_type' => :'transactionType',
105
+ :'authorization_code' => :'authorizationCode',
106
+ :'avs_response' => :'avsResponse',
107
+ :'security_code_response' => :'securityCodeResponse',
108
+ :'brand' => :'brand',
109
+ :'country' => :'country',
110
+ :'terminal_id' => :'terminalId',
111
+ :'client_transaction_id' => :'clientTransactionId',
112
+ :'transaction_time' => :'transactionTime',
113
+ :'approved_amount' => :'approvedAmount',
114
+ :'transaction_status' => :'transactionStatus',
115
+ :'transaction_state' => :'transactionState',
116
+ :'authentication_redirect' => :'authenticationRedirect',
117
+ :'scheme_transaction_id' => :'schemeTransactionId',
118
+ :'processor' => :'processor'
119
+ }
120
+ end
121
+
122
+ # Attribute type mapping.
123
+ def self.swagger_types
124
+ {
125
+ :'response_type' => :'ResponseType',
126
+ :'client_request_id' => :'String',
127
+ :'api_trace_id' => :'String',
128
+ :'ipg_transaction_id' => :'String',
129
+ :'order_id' => :'String',
130
+ :'transaction_type' => :'TransactionType',
131
+ :'authorization_code' => :'String',
132
+ :'avs_response' => :'String',
133
+ :'security_code_response' => :'String',
134
+ :'brand' => :'String',
135
+ :'country' => :'String',
136
+ :'terminal_id' => :'String',
137
+ :'client_transaction_id' => :'String',
138
+ :'transaction_time' => :'Integer',
139
+ :'approved_amount' => :'Amount',
140
+ :'transaction_status' => :'String',
141
+ :'transaction_state' => :'String',
142
+ :'authentication_redirect' => :'TransactionResponseAuthenticationRedirect',
143
+ :'scheme_transaction_id' => :'String',
144
+ :'processor' => :'ProcessorData'
145
+ }
146
+ end
147
+
148
+ # Initializes the object
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ def initialize(attributes = {})
151
+ return unless attributes.is_a?(Hash)
152
+
153
+ # convert string to symbol for hash key
154
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
155
+
156
+ if attributes.has_key?(:'responseType')
157
+ self.response_type = attributes[:'responseType']
158
+ end
159
+
160
+ if attributes.has_key?(:'clientRequestId')
161
+ self.client_request_id = attributes[:'clientRequestId']
162
+ end
163
+
164
+ if attributes.has_key?(:'apiTraceId')
165
+ self.api_trace_id = attributes[:'apiTraceId']
166
+ end
167
+
168
+ if attributes.has_key?(:'ipgTransactionId')
169
+ self.ipg_transaction_id = attributes[:'ipgTransactionId']
170
+ end
171
+
172
+ if attributes.has_key?(:'orderId')
173
+ self.order_id = attributes[:'orderId']
174
+ end
175
+
176
+ if attributes.has_key?(:'transactionType')
177
+ self.transaction_type = attributes[:'transactionType']
178
+ end
179
+
180
+ if attributes.has_key?(:'authorizationCode')
181
+ self.authorization_code = attributes[:'authorizationCode']
182
+ end
183
+
184
+ if attributes.has_key?(:'avsResponse')
185
+ self.avs_response = attributes[:'avsResponse']
186
+ end
187
+
188
+ if attributes.has_key?(:'securityCodeResponse')
189
+ self.security_code_response = attributes[:'securityCodeResponse']
190
+ end
191
+
192
+ if attributes.has_key?(:'brand')
193
+ self.brand = attributes[:'brand']
194
+ end
195
+
196
+ if attributes.has_key?(:'country')
197
+ self.country = attributes[:'country']
198
+ end
199
+
200
+ if attributes.has_key?(:'terminalId')
201
+ self.terminal_id = attributes[:'terminalId']
202
+ end
203
+
204
+ if attributes.has_key?(:'clientTransactionId')
205
+ self.client_transaction_id = attributes[:'clientTransactionId']
206
+ end
207
+
208
+ if attributes.has_key?(:'transactionTime')
209
+ self.transaction_time = attributes[:'transactionTime']
210
+ end
211
+
212
+ if attributes.has_key?(:'approvedAmount')
213
+ self.approved_amount = attributes[:'approvedAmount']
214
+ end
215
+
216
+ if attributes.has_key?(:'transactionStatus')
217
+ self.transaction_status = attributes[:'transactionStatus']
218
+ end
219
+
220
+ if attributes.has_key?(:'transactionState')
221
+ self.transaction_state = attributes[:'transactionState']
222
+ end
223
+
224
+ if attributes.has_key?(:'authenticationRedirect')
225
+ self.authentication_redirect = attributes[:'authenticationRedirect']
226
+ end
227
+
228
+ if attributes.has_key?(:'schemeTransactionId')
229
+ self.scheme_transaction_id = attributes[:'schemeTransactionId']
230
+ end
231
+
232
+ if attributes.has_key?(:'processor')
233
+ self.processor = attributes[:'processor']
234
+ end
235
+
236
+ end
237
+
238
+ # Show invalid properties with the reasons. Usually used together with valid?
239
+ # @return Array for valid properties with the reasons
240
+ def list_invalid_properties
241
+ invalid_properties = Array.new
242
+ if !@scheme_transaction_id.nil? && @scheme_transaction_id.to_s.length > 40
243
+ invalid_properties.push("invalid value for 'scheme_transaction_id', the character length must be smaller than or equal to 40.")
244
+ end
245
+
246
+ return invalid_properties
247
+ end
248
+
249
+ # Check to see if the all the properties in the model are valid
250
+ # @return true if the model is valid
251
+ def valid?
252
+ transaction_status_validator = EnumAttributeValidator.new('String', ["APPROVED", "WAITING", "VALIDATION_FAILED", "DECLINED"])
253
+ return false unless transaction_status_validator.valid?(@transaction_status)
254
+ transaction_state_validator = EnumAttributeValidator.new('String', ["AUTHORIZED", "CAPTURED", "COMPLETED_GET", "DECLINED", "CHECKED", "INITIALIZED", "PENDING_AUTHORIZATION", "PENDING_AUTOVOID", "PENDING_CAPTURE", "PENDING_CREDIT", "PENDING_GIROPAY_INIT", "PENDING_IDEAL_INIT", "PENDING_INIT", "PENDING_READY", "PENDING_RETURN", "PENDING_SETTLEMENT", "PENDING_SOFORT_INIT", "PENDING_VOID", "READY", "SETTLED", "VOIDED", "WAITING", "WAITING_AUTHENTICATION", "WAITING_3D_SECURE", "WAITING_CLICK_AND_BUY", "WAITING_GIROPAY", "WAITING_IDEAL", "WAITING_KLARNA", "WAITING_PAYPAL", "WAITING_PAYPAL_EVENT", "WAITING_PPRO_LONG_WAITING", "WAITING_SOFORT", "WAITING_T_PAY", "WAITING_ALIPAY_PAYSECURE"])
255
+ return false unless transaction_state_validator.valid?(@transaction_state)
256
+ return false if !@scheme_transaction_id.nil? && @scheme_transaction_id.to_s.length > 40
257
+ return true
258
+ end
259
+
260
+ # Custom attribute writer method checking allowed values (enum).
261
+ # @param [Object] transaction_status Object to be assigned
262
+ def transaction_status=(transaction_status)
263
+ validator = EnumAttributeValidator.new('String', ["APPROVED", "WAITING", "VALIDATION_FAILED", "DECLINED"])
264
+ unless validator.valid?(transaction_status)
265
+ fail ArgumentError, "invalid value for 'transaction_status', must be one of #{validator.allowable_values}."
266
+ end
267
+ @transaction_status = transaction_status
268
+ end
269
+
270
+ # Custom attribute writer method checking allowed values (enum).
271
+ # @param [Object] transaction_state Object to be assigned
272
+ def transaction_state=(transaction_state)
273
+ validator = EnumAttributeValidator.new('String', ["AUTHORIZED", "CAPTURED", "COMPLETED_GET", "DECLINED", "CHECKED", "INITIALIZED", "PENDING_AUTHORIZATION", "PENDING_AUTOVOID", "PENDING_CAPTURE", "PENDING_CREDIT", "PENDING_GIROPAY_INIT", "PENDING_IDEAL_INIT", "PENDING_INIT", "PENDING_READY", "PENDING_RETURN", "PENDING_SETTLEMENT", "PENDING_SOFORT_INIT", "PENDING_VOID", "READY", "SETTLED", "VOIDED", "WAITING", "WAITING_AUTHENTICATION", "WAITING_3D_SECURE", "WAITING_CLICK_AND_BUY", "WAITING_GIROPAY", "WAITING_IDEAL", "WAITING_KLARNA", "WAITING_PAYPAL", "WAITING_PAYPAL_EVENT", "WAITING_PPRO_LONG_WAITING", "WAITING_SOFORT", "WAITING_T_PAY", "WAITING_ALIPAY_PAYSECURE"])
274
+ unless validator.valid?(transaction_state)
275
+ fail ArgumentError, "invalid value for 'transaction_state', must be one of #{validator.allowable_values}."
276
+ end
277
+ @transaction_state = transaction_state
278
+ end
279
+
280
+ # Custom attribute writer method with validation
281
+ # @param [Object] scheme_transaction_id Value to be assigned
282
+ def scheme_transaction_id=(scheme_transaction_id)
283
+
284
+ if !scheme_transaction_id.nil? && scheme_transaction_id.to_s.length > 40
285
+ fail ArgumentError, "invalid value for 'scheme_transaction_id', the character length must be smaller than or equal to 40."
286
+ end
287
+
288
+ @scheme_transaction_id = scheme_transaction_id
289
+ end
290
+
291
+ # Checks equality by comparing each attribute.
292
+ # @param [Object] Object to be compared
293
+ def ==(o)
294
+ return true if self.equal?(o)
295
+ self.class == o.class &&
296
+ response_type == o.response_type &&
297
+ client_request_id == o.client_request_id &&
298
+ api_trace_id == o.api_trace_id &&
299
+ ipg_transaction_id == o.ipg_transaction_id &&
300
+ order_id == o.order_id &&
301
+ transaction_type == o.transaction_type &&
302
+ authorization_code == o.authorization_code &&
303
+ avs_response == o.avs_response &&
304
+ security_code_response == o.security_code_response &&
305
+ brand == o.brand &&
306
+ country == o.country &&
307
+ terminal_id == o.terminal_id &&
308
+ client_transaction_id == o.client_transaction_id &&
309
+ transaction_time == o.transaction_time &&
310
+ approved_amount == o.approved_amount &&
311
+ transaction_status == o.transaction_status &&
312
+ transaction_state == o.transaction_state &&
313
+ authentication_redirect == o.authentication_redirect &&
314
+ scheme_transaction_id == o.scheme_transaction_id &&
315
+ processor == o.processor
316
+ end
317
+
318
+ # @see the `==` method
319
+ # @param [Object] Object to be compared
320
+ def eql?(o)
321
+ self == o
322
+ end
323
+
324
+ # Calculates hash code according to all attributes.
325
+ # @return [Fixnum] Hash code
326
+ def hash
327
+ [response_type, client_request_id, api_trace_id, ipg_transaction_id, order_id, transaction_type, authorization_code, avs_response, security_code_response, brand, country, terminal_id, client_transaction_id, transaction_time, approved_amount, transaction_status, transaction_state, authentication_redirect, scheme_transaction_id, processor].hash
328
+ end
329
+
330
+ # Builds the object from hash
331
+ # @param [Hash] attributes Model attributes in the form of hash
332
+ # @return [Object] Returns the model itself
333
+ def build_from_hash(attributes)
334
+ return nil unless attributes.is_a?(Hash)
335
+ self.class.swagger_types.each_pair do |key, type|
336
+ if type =~ /\AArray<(.*)>/i
337
+ # check to ensure the input is an array given that the the attribute
338
+ # is documented as an array but the input is not
339
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
340
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
341
+ end
342
+ elsif !attributes[self.class.attribute_map[key]].nil?
343
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
344
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
345
+ end
346
+
347
+ self
348
+ end
349
+
350
+ # Deserializes the data based on type
351
+ # @param string type Data type
352
+ # @param string value Value to be deserialized
353
+ # @return [Object] Deserialized data
354
+ def _deserialize(type, value)
355
+ case type.to_sym
356
+ when :DateTime
357
+ DateTime.parse(value)
358
+ when :Date
359
+ Date.parse(value)
360
+ when :String
361
+ value.to_s
362
+ when :Integer
363
+ value.to_i
364
+ when :Float
365
+ value.to_f
366
+ when :BOOLEAN
367
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
368
+ true
369
+ else
370
+ false
371
+ end
372
+ when :Object
373
+ # generic object (usually a Hash), return directly
374
+ value
375
+ when /\AArray<(?<inner_type>.+)>\z/
376
+ inner_type = Regexp.last_match[:inner_type]
377
+ value.map { |v| _deserialize(inner_type, v) }
378
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
379
+ k_type = Regexp.last_match[:k_type]
380
+ v_type = Regexp.last_match[:v_type]
381
+ {}.tap do |hash|
382
+ value.each do |k, v|
383
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
384
+ end
385
+ end
386
+ else # model
387
+ temp_model = SwaggerClient.const_get(type).new
388
+ temp_model.build_from_hash(value)
389
+ end
390
+ end
391
+
392
+ # Returns the string representation of the object
393
+ # @return [String] String presentation of the object
394
+ def to_s
395
+ to_hash.to_s
396
+ end
397
+
398
+ # to_body is an alias to to_hash (backward compatibility)
399
+ # @return [Hash] Returns the object in the form of hash
400
+ def to_body
401
+ to_hash
402
+ end
403
+
404
+ # Returns the object in the form of hash
405
+ # @return [Hash] Returns the object in the form of hash
406
+ def to_hash
407
+ hash = {}
408
+ self.class.attribute_map.each_pair do |attr, param|
409
+ value = self.send(attr)
410
+ next if value.nil?
411
+ hash[param] = _to_hash(value)
412
+ end
413
+ hash
414
+ end
415
+
416
+ # Outputs non-array value in the form of hash
417
+ # For object, use to_hash. Otherwise, just return the value
418
+ # @param [Object] value Any valid value
419
+ # @return [Hash] Returns the value in the form of hash
420
+ def _to_hash(value)
421
+ if value.is_a?(Array)
422
+ value.compact.map{ |v| _to_hash(v) }
423
+ elsif value.is_a?(Hash)
424
+ {}.tap do |hash|
425
+ value.each { |k, v| hash[k] = _to_hash(v) }
426
+ end
427
+ elsif value.respond_to? :to_hash
428
+ value.to_hash
429
+ else
430
+ value
431
+ end
432
+ end
433
+
434
+ end
435
+
436
+ end