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.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +123 -0
- data/Rakefile +8 -0
- data/docs/AccessTokenResponse.md +11 -0
- data/docs/Address.md +14 -0
- data/docs/Airline.md +21 -0
- data/docs/AirlineAncillaryServiceCategory.md +8 -0
- data/docs/AirlineTravelRoute.md +16 -0
- data/docs/Amount.md +10 -0
- data/docs/AmountComponents.md +14 -0
- data/docs/AuthenticationApi.md +68 -0
- data/docs/AuthenticationResponseVerification.md +10 -0
- data/docs/BasketItem.md +11 -0
- data/docs/Billing.md +13 -0
- data/docs/CarRental.md +15 -0
- data/docs/CarRentalExtraCharges.md +8 -0
- data/docs/CardVerificationsTransaction.md +9 -0
- data/docs/ClientLocale.md +9 -0
- data/docs/Contact.md +11 -0
- data/docs/Error.md +10 -0
- data/docs/ErrorDetails.md +9 -0
- data/docs/ErrorResponse.md +11 -0
- data/docs/Expiration.md +9 -0
- data/docs/Frequency.md +9 -0
- data/docs/IndustrySpecificExtensions.md +10 -0
- data/docs/InstallmentOptions.md +10 -0
- data/docs/Lodging.md +12 -0
- data/docs/LodgingExtraCharges.md +8 -0
- data/docs/Order.md +10 -0
- data/docs/OrderApi.md +148 -0
- data/docs/PayPal.md +8 -0
- data/docs/PaymentApi.md +345 -0
- data/docs/PaymentCard.md +15 -0
- data/docs/PaymentCardAuthenticationRequest.md +8 -0
- data/docs/PaymentCardAuthenticationResult.md +12 -0
- data/docs/PaymentMethod.md +11 -0
- data/docs/PaymentSchedulesRequest.md +21 -0
- data/docs/PaymentSchedulesResponse.md +11 -0
- data/docs/PaymentUrlRequest.md +11 -0
- data/docs/PaymentUrlResponse.md +13 -0
- data/docs/PrimaryTransaction.md +18 -0
- data/docs/PrimaryTransactionAdditionalDetails.md +14 -0
- data/docs/ProcessorData.md +10 -0
- data/docs/ResponseType.md +7 -0
- data/docs/SecondaryTransaction.md +9 -0
- data/docs/Sepa.md +12 -0
- data/docs/SepaMandate.md +11 -0
- data/docs/Shipping.md +10 -0
- data/docs/SplitShipment.md +9 -0
- data/docs/StoredCredential.md +11 -0
- data/docs/TransactionErrorResponse.md +28 -0
- data/docs/TransactionResponse.md +27 -0
- data/docs/TransactionResponseAuthenticationRedirect.md +10 -0
- data/docs/TransactionResponseAuthenticationRedirectParams.md +10 -0
- data/docs/TransactionType.md +7 -0
- data/first_data_gateway.gemspec +45 -0
- data/git_push.sh +55 -0
- data/lib/simple/client_context.rb +15 -0
- data/lib/simple/gateway.rb +155 -0
- data/lib/simple/merchant_credentials.rb +10 -0
- data/lib/simple/signature.rb +52 -0
- data/lib/simple_client.rb +4 -0
- data/lib/swagger_client.rb +91 -0
- data/lib/swagger_client/api/authentication_api.rb +111 -0
- data/lib/swagger_client/api/order_api.rb +229 -0
- data/lib/swagger_client/api/payment_api.rb +517 -0
- data/lib/swagger_client/api_client.rb +390 -0
- data/lib/swagger_client/api_error.rb +38 -0
- data/lib/swagger_client/configuration.rb +202 -0
- data/lib/swagger_client/models/access_token_response.rb +252 -0
- data/lib/swagger_client/models/address.rb +361 -0
- data/lib/swagger_client/models/airline.rb +487 -0
- data/lib/swagger_client/models/airline_ancillary_service_category.rb +221 -0
- data/lib/swagger_client/models/airline_travel_route.rb +406 -0
- data/lib/swagger_client/models/amount.rb +217 -0
- data/lib/swagger_client/models/amount_components.rb +242 -0
- data/lib/swagger_client/models/authentication_response_verification.rb +239 -0
- data/lib/swagger_client/models/basket_item.rb +218 -0
- data/lib/swagger_client/models/billing.rb +282 -0
- data/lib/swagger_client/models/car_rental.rb +317 -0
- data/lib/swagger_client/models/car_rental_extra_charges.rb +221 -0
- data/lib/swagger_client/models/card_verifications_transaction.rb +203 -0
- data/lib/swagger_client/models/client_locale.rb +209 -0
- data/lib/swagger_client/models/contact.rb +279 -0
- data/lib/swagger_client/models/error.rb +211 -0
- data/lib/swagger_client/models/error_details.rb +199 -0
- data/lib/swagger_client/models/error_response.rb +218 -0
- data/lib/swagger_client/models/expiration.rb +207 -0
- data/lib/swagger_client/models/frequency.rb +270 -0
- data/lib/swagger_client/models/industry_specific_extensions.rb +206 -0
- data/lib/swagger_client/models/installment_options.rb +259 -0
- data/lib/swagger_client/models/lodging.rb +245 -0
- data/lib/swagger_client/models/lodging_extra_charges.rb +221 -0
- data/lib/swagger_client/models/order.rb +206 -0
- data/lib/swagger_client/models/pay_pal.rb +213 -0
- data/lib/swagger_client/models/payment_card.rb +294 -0
- data/lib/swagger_client/models/payment_card_authentication_request.rb +222 -0
- data/lib/swagger_client/models/payment_card_authentication_result.rb +336 -0
- data/lib/swagger_client/models/payment_method.rb +254 -0
- data/lib/swagger_client/models/payment_schedules_request.rb +398 -0
- data/lib/swagger_client/models/payment_schedules_response.rb +267 -0
- data/lib/swagger_client/models/payment_url_request.rb +232 -0
- data/lib/swagger_client/models/payment_url_response.rb +286 -0
- data/lib/swagger_client/models/primary_transaction.rb +298 -0
- data/lib/swagger_client/models/primary_transaction_additional_details.rb +244 -0
- data/lib/swagger_client/models/processor_data.rb +216 -0
- data/lib/swagger_client/models/response_type.rb +37 -0
- data/lib/swagger_client/models/secondary_transaction.rb +197 -0
- data/lib/swagger_client/models/sepa.rb +321 -0
- data/lib/swagger_client/models/sepa_mandate.rb +321 -0
- data/lib/swagger_client/models/shipping.rb +222 -0
- data/lib/swagger_client/models/split_shipment.rb +201 -0
- data/lib/swagger_client/models/stored_credential.rb +290 -0
- data/lib/swagger_client/models/transaction_error_response.rb +445 -0
- data/lib/swagger_client/models/transaction_response.rb +436 -0
- data/lib/swagger_client/models/transaction_response_authentication_redirect.rb +239 -0
- data/lib/swagger_client/models/transaction_response_authentication_redirect_params.rb +206 -0
- data/lib/swagger_client/models/transaction_type.rb +36 -0
- data/lib/swagger_client/version.rb +15 -0
- data/spec/api/authentication_api_spec.rb +51 -0
- data/spec/api/order_api_spec.rb +73 -0
- data/spec/api/payment_api_spec.rb +126 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/access_token_response_spec.rb +64 -0
- data/spec/models/address_spec.rb +78 -0
- data/spec/models/airline_ancillary_service_category_spec.rb +46 -0
- data/spec/models/airline_spec.rb +124 -0
- data/spec/models/airline_travel_route_spec.rb +94 -0
- data/spec/models/amount_components_spec.rb +78 -0
- data/spec/models/amount_spec.rb +54 -0
- data/spec/models/authentication_response_verification_spec.rb +58 -0
- data/spec/models/basket_item_spec.rb +60 -0
- data/spec/models/billing_spec.rb +76 -0
- data/spec/models/car_rental_extra_charges_spec.rb +46 -0
- data/spec/models/car_rental_spec.rb +84 -0
- data/spec/models/card_verifications_transaction_spec.rb +48 -0
- data/spec/models/client_locale_spec.rb +48 -0
- data/spec/models/contact_spec.rb +60 -0
- data/spec/models/error_details_spec.rb +48 -0
- data/spec/models/error_response_spec.rb +60 -0
- data/spec/models/error_spec.rb +54 -0
- data/spec/models/expiration_spec.rb +48 -0
- data/spec/models/frequency_spec.rb +52 -0
- data/spec/models/industry_specific_extensions_spec.rb +54 -0
- data/spec/models/installment_options_spec.rb +54 -0
- data/spec/models/lodging_extra_charges_spec.rb +46 -0
- data/spec/models/lodging_spec.rb +66 -0
- data/spec/models/order_spec.rb +54 -0
- data/spec/models/pay_pal_spec.rb +42 -0
- data/spec/models/payment_card_authentication_request_spec.rb +46 -0
- data/spec/models/payment_card_authentication_result_spec.rb +78 -0
- data/spec/models/payment_card_spec.rb +88 -0
- data/spec/models/payment_method_spec.rb +64 -0
- data/spec/models/payment_schedules_request_spec.rb +124 -0
- data/spec/models/payment_schedules_response_spec.rb +64 -0
- data/spec/models/payment_url_request_spec.rb +60 -0
- data/spec/models/payment_url_response_spec.rb +76 -0
- data/spec/models/primary_transaction_additional_details_spec.rb +78 -0
- data/spec/models/primary_transaction_spec.rb +102 -0
- data/spec/models/processor_data_spec.rb +54 -0
- data/spec/models/response_type_spec.rb +36 -0
- data/spec/models/secondary_transaction_spec.rb +48 -0
- data/spec/models/sepa_mandate_spec.rb +64 -0
- data/spec/models/sepa_spec.rb +66 -0
- data/spec/models/shipping_spec.rb +54 -0
- data/spec/models/split_shipment_spec.rb +48 -0
- data/spec/models/stored_credential_spec.rb +68 -0
- data/spec/models/transaction_error_response_spec.rb +170 -0
- data/spec/models/transaction_response_authentication_redirect_params_spec.rb +54 -0
- data/spec/models/transaction_response_authentication_redirect_spec.rb +58 -0
- data/spec/models/transaction_response_spec.rb +164 -0
- data/spec/models/transaction_type_spec.rb +36 -0
- data/spec/spec_helper.rb +111 -0
- metadata +457 -0
|
@@ -0,0 +1,321 @@
|
|
|
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
|
+
# The payment object for SEPA DD. The iban, billing_address.name and country elements are required for this payment type.
|
|
17
|
+
class Sepa
|
|
18
|
+
# Bank account in IBAN format
|
|
19
|
+
attr_accessor :iban
|
|
20
|
+
|
|
21
|
+
# The name of the payer
|
|
22
|
+
attr_accessor :name
|
|
23
|
+
|
|
24
|
+
# Country of residence of the payer using the ISO 3166 standard (http://en.wikipedia.org/wiki/ISO_3166)
|
|
25
|
+
attr_accessor :country
|
|
26
|
+
|
|
27
|
+
# The email address of the payer
|
|
28
|
+
attr_accessor :email
|
|
29
|
+
|
|
30
|
+
attr_accessor :mandate
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'iban' => :'iban',
|
|
37
|
+
:'name' => :'name',
|
|
38
|
+
:'country' => :'country',
|
|
39
|
+
:'email' => :'email',
|
|
40
|
+
:'mandate' => :'mandate'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Attribute type mapping.
|
|
45
|
+
def self.swagger_types
|
|
46
|
+
{
|
|
47
|
+
:'iban' => :'String',
|
|
48
|
+
:'name' => :'String',
|
|
49
|
+
:'country' => :'String',
|
|
50
|
+
:'email' => :'String',
|
|
51
|
+
:'mandate' => :'SepaMandate'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Initializes the object
|
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
57
|
+
def initialize(attributes = {})
|
|
58
|
+
return unless attributes.is_a?(Hash)
|
|
59
|
+
|
|
60
|
+
# convert string to symbol for hash key
|
|
61
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
|
62
|
+
|
|
63
|
+
if attributes.has_key?(:'iban')
|
|
64
|
+
self.iban = attributes[:'iban']
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
if attributes.has_key?(:'name')
|
|
68
|
+
self.name = attributes[:'name']
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if attributes.has_key?(:'country')
|
|
72
|
+
self.country = attributes[:'country']
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if attributes.has_key?(:'email')
|
|
76
|
+
self.email = attributes[:'email']
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if attributes.has_key?(:'mandate')
|
|
80
|
+
self.mandate = attributes[:'mandate']
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
86
|
+
# @return Array for valid properties with the reasons
|
|
87
|
+
def list_invalid_properties
|
|
88
|
+
invalid_properties = Array.new
|
|
89
|
+
if @iban.nil?
|
|
90
|
+
invalid_properties.push("invalid value for 'iban', iban cannot be nil.")
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if @iban.to_s.length > 34
|
|
94
|
+
invalid_properties.push("invalid value for 'iban', the character length must be smaller than or equal to 34.")
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if @name.nil?
|
|
98
|
+
invalid_properties.push("invalid value for 'name', name cannot be nil.")
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if @name.to_s.length > 96
|
|
102
|
+
invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 96.")
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if @country.nil?
|
|
106
|
+
invalid_properties.push("invalid value for 'country', country cannot be nil.")
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if @country.to_s.length > 3
|
|
110
|
+
invalid_properties.push("invalid value for 'country', the character length must be smaller than or equal to 3.")
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if !@email.nil? && @email.to_s.length > 254
|
|
114
|
+
invalid_properties.push("invalid value for 'email', the character length must be smaller than or equal to 254.")
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if @mandate.nil?
|
|
118
|
+
invalid_properties.push("invalid value for 'mandate', mandate cannot be nil.")
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
return invalid_properties
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Check to see if the all the properties in the model are valid
|
|
125
|
+
# @return true if the model is valid
|
|
126
|
+
def valid?
|
|
127
|
+
return false if @iban.nil?
|
|
128
|
+
return false if @iban.to_s.length > 34
|
|
129
|
+
return false if @name.nil?
|
|
130
|
+
return false if @name.to_s.length > 96
|
|
131
|
+
return false if @country.nil?
|
|
132
|
+
return false if @country.to_s.length > 3
|
|
133
|
+
return false if !@email.nil? && @email.to_s.length > 254
|
|
134
|
+
return false if @mandate.nil?
|
|
135
|
+
return true
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Custom attribute writer method with validation
|
|
139
|
+
# @param [Object] iban Value to be assigned
|
|
140
|
+
def iban=(iban)
|
|
141
|
+
if iban.nil?
|
|
142
|
+
fail ArgumentError, "iban cannot be nil"
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if iban.to_s.length > 34
|
|
146
|
+
fail ArgumentError, "invalid value for 'iban', the character length must be smaller than or equal to 34."
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
@iban = iban
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Custom attribute writer method with validation
|
|
153
|
+
# @param [Object] name Value to be assigned
|
|
154
|
+
def name=(name)
|
|
155
|
+
if name.nil?
|
|
156
|
+
fail ArgumentError, "name cannot be nil"
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if name.to_s.length > 96
|
|
160
|
+
fail ArgumentError, "invalid value for 'name', the character length must be smaller than or equal to 96."
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
@name = name
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Custom attribute writer method with validation
|
|
167
|
+
# @param [Object] country Value to be assigned
|
|
168
|
+
def country=(country)
|
|
169
|
+
if country.nil?
|
|
170
|
+
fail ArgumentError, "country cannot be nil"
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if country.to_s.length > 3
|
|
174
|
+
fail ArgumentError, "invalid value for 'country', the character length must be smaller than or equal to 3."
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
@country = country
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Custom attribute writer method with validation
|
|
181
|
+
# @param [Object] email Value to be assigned
|
|
182
|
+
def email=(email)
|
|
183
|
+
|
|
184
|
+
if !email.nil? && email.to_s.length > 254
|
|
185
|
+
fail ArgumentError, "invalid value for 'email', the character length must be smaller than or equal to 254."
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
@email = email
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Checks equality by comparing each attribute.
|
|
192
|
+
# @param [Object] Object to be compared
|
|
193
|
+
def ==(o)
|
|
194
|
+
return true if self.equal?(o)
|
|
195
|
+
self.class == o.class &&
|
|
196
|
+
iban == o.iban &&
|
|
197
|
+
name == o.name &&
|
|
198
|
+
country == o.country &&
|
|
199
|
+
email == o.email &&
|
|
200
|
+
mandate == o.mandate
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# @see the `==` method
|
|
204
|
+
# @param [Object] Object to be compared
|
|
205
|
+
def eql?(o)
|
|
206
|
+
self == o
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Calculates hash code according to all attributes.
|
|
210
|
+
# @return [Fixnum] Hash code
|
|
211
|
+
def hash
|
|
212
|
+
[iban, name, country, email, mandate].hash
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Builds the object from hash
|
|
216
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
217
|
+
# @return [Object] Returns the model itself
|
|
218
|
+
def build_from_hash(attributes)
|
|
219
|
+
return nil unless attributes.is_a?(Hash)
|
|
220
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
221
|
+
if type =~ /\AArray<(.*)>/i
|
|
222
|
+
# check to ensure the input is an array given that the the attribute
|
|
223
|
+
# is documented as an array but the input is not
|
|
224
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
225
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
226
|
+
end
|
|
227
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
228
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
229
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
self
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Deserializes the data based on type
|
|
236
|
+
# @param string type Data type
|
|
237
|
+
# @param string value Value to be deserialized
|
|
238
|
+
# @return [Object] Deserialized data
|
|
239
|
+
def _deserialize(type, value)
|
|
240
|
+
case type.to_sym
|
|
241
|
+
when :DateTime
|
|
242
|
+
DateTime.parse(value)
|
|
243
|
+
when :Date
|
|
244
|
+
Date.parse(value)
|
|
245
|
+
when :String
|
|
246
|
+
value.to_s
|
|
247
|
+
when :Integer
|
|
248
|
+
value.to_i
|
|
249
|
+
when :Float
|
|
250
|
+
value.to_f
|
|
251
|
+
when :BOOLEAN
|
|
252
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
253
|
+
true
|
|
254
|
+
else
|
|
255
|
+
false
|
|
256
|
+
end
|
|
257
|
+
when :Object
|
|
258
|
+
# generic object (usually a Hash), return directly
|
|
259
|
+
value
|
|
260
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
261
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
262
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
263
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
264
|
+
k_type = Regexp.last_match[:k_type]
|
|
265
|
+
v_type = Regexp.last_match[:v_type]
|
|
266
|
+
{}.tap do |hash|
|
|
267
|
+
value.each do |k, v|
|
|
268
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
else # model
|
|
272
|
+
temp_model = SwaggerClient.const_get(type).new
|
|
273
|
+
temp_model.build_from_hash(value)
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# Returns the string representation of the object
|
|
278
|
+
# @return [String] String presentation of the object
|
|
279
|
+
def to_s
|
|
280
|
+
to_hash.to_s
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
284
|
+
# @return [Hash] Returns the object in the form of hash
|
|
285
|
+
def to_body
|
|
286
|
+
to_hash
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# Returns the object in the form of hash
|
|
290
|
+
# @return [Hash] Returns the object in the form of hash
|
|
291
|
+
def to_hash
|
|
292
|
+
hash = {}
|
|
293
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
294
|
+
value = self.send(attr)
|
|
295
|
+
next if value.nil?
|
|
296
|
+
hash[param] = _to_hash(value)
|
|
297
|
+
end
|
|
298
|
+
hash
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# Outputs non-array value in the form of hash
|
|
302
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
303
|
+
# @param [Object] value Any valid value
|
|
304
|
+
# @return [Hash] Returns the value in the form of hash
|
|
305
|
+
def _to_hash(value)
|
|
306
|
+
if value.is_a?(Array)
|
|
307
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
308
|
+
elsif value.is_a?(Hash)
|
|
309
|
+
{}.tap do |hash|
|
|
310
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
311
|
+
end
|
|
312
|
+
elsif value.respond_to? :to_hash
|
|
313
|
+
value.to_hash
|
|
314
|
+
else
|
|
315
|
+
value
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
end
|
|
@@ -0,0 +1,321 @@
|
|
|
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 SepaMandate
|
|
18
|
+
# Existing mandate reference, managed by merchant. Must match [A-Za-z0-9:?/+(),. -]{1,35} and not start with two slashes (“//”). Also known as the Mandate ID
|
|
19
|
+
attr_accessor :reference
|
|
20
|
+
|
|
21
|
+
# Valid URL pointing to the SEPA mandate (PDF / HTML format recommended)
|
|
22
|
+
attr_accessor :url
|
|
23
|
+
|
|
24
|
+
# Date of mandate signature.
|
|
25
|
+
attr_accessor :signature_date
|
|
26
|
+
|
|
27
|
+
# Sequence type of the direct debit. This defaults to 'SINGLE' if not provided.
|
|
28
|
+
attr_accessor :type
|
|
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
|
+
:'reference' => :'reference',
|
|
56
|
+
:'url' => :'url',
|
|
57
|
+
:'signature_date' => :'signatureDate',
|
|
58
|
+
:'type' => :'type'
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Attribute type mapping.
|
|
63
|
+
def self.swagger_types
|
|
64
|
+
{
|
|
65
|
+
:'reference' => :'String',
|
|
66
|
+
:'url' => :'String',
|
|
67
|
+
:'signature_date' => :'Date',
|
|
68
|
+
:'type' => :'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?(:'reference')
|
|
81
|
+
self.reference = attributes[:'reference']
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if attributes.has_key?(:'url')
|
|
85
|
+
self.url = attributes[:'url']
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if attributes.has_key?(:'signatureDate')
|
|
89
|
+
self.signature_date = attributes[:'signatureDate']
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if attributes.has_key?(:'type')
|
|
93
|
+
self.type = attributes[:'type']
|
|
94
|
+
else
|
|
95
|
+
self.type = "SINGLE"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
101
|
+
# @return Array for valid properties with the reasons
|
|
102
|
+
def list_invalid_properties
|
|
103
|
+
invalid_properties = Array.new
|
|
104
|
+
if @reference.nil?
|
|
105
|
+
invalid_properties.push("invalid value for 'reference', reference cannot be nil.")
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if @reference.to_s.length > 35
|
|
109
|
+
invalid_properties.push("invalid value for 'reference', the character length must be smaller than or equal to 35.")
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if @reference !~ Regexp.new(/[A-Za-z0-9:?\/+(),. -]{1,35}/)
|
|
113
|
+
invalid_properties.push("invalid value for 'reference', must conform to the pattern /[A-Za-z0-9:?\/+(),. -]{1,35}/.")
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if @url.nil?
|
|
117
|
+
invalid_properties.push("invalid value for 'url', url cannot be nil.")
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if @url.to_s.length > 100
|
|
121
|
+
invalid_properties.push("invalid value for 'url', the character length must be smaller than or equal to 100.")
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if @signature_date.nil?
|
|
125
|
+
invalid_properties.push("invalid value for 'signature_date', signature_date cannot be nil.")
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if @type.nil?
|
|
129
|
+
invalid_properties.push("invalid value for 'type', type cannot be nil.")
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
return invalid_properties
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Check to see if the all the properties in the model are valid
|
|
136
|
+
# @return true if the model is valid
|
|
137
|
+
def valid?
|
|
138
|
+
return false if @reference.nil?
|
|
139
|
+
return false if @reference.to_s.length > 35
|
|
140
|
+
return false if @reference !~ Regexp.new(/[A-Za-z0-9:?\/+(),. -]{1,35}/)
|
|
141
|
+
return false if @url.nil?
|
|
142
|
+
return false if @url.to_s.length > 100
|
|
143
|
+
return false if @signature_date.nil?
|
|
144
|
+
return false if @type.nil?
|
|
145
|
+
type_validator = EnumAttributeValidator.new('String', ["SINGLE", "FIRST_COLLECTION", "RECURRING_COLLECTION", "FINAL_COLLECTION"])
|
|
146
|
+
return false unless type_validator.valid?(@type)
|
|
147
|
+
return true
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Custom attribute writer method with validation
|
|
151
|
+
# @param [Object] reference Value to be assigned
|
|
152
|
+
def reference=(reference)
|
|
153
|
+
if reference.nil?
|
|
154
|
+
fail ArgumentError, "reference cannot be nil"
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if reference.to_s.length > 35
|
|
158
|
+
fail ArgumentError, "invalid value for 'reference', the character length must be smaller than or equal to 35."
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if reference !~ Regexp.new(/[A-Za-z0-9:?\/+(),. -]{1,35}/)
|
|
162
|
+
fail ArgumentError, "invalid value for 'reference', must conform to the pattern /[A-Za-z0-9:?\/+(),. -]{1,35}/."
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
@reference = reference
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Custom attribute writer method with validation
|
|
169
|
+
# @param [Object] url Value to be assigned
|
|
170
|
+
def url=(url)
|
|
171
|
+
if url.nil?
|
|
172
|
+
fail ArgumentError, "url cannot be nil"
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
if url.to_s.length > 100
|
|
176
|
+
fail ArgumentError, "invalid value for 'url', the character length must be smaller than or equal to 100."
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
@url = url
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
183
|
+
# @param [Object] type Object to be assigned
|
|
184
|
+
def type=(type)
|
|
185
|
+
validator = EnumAttributeValidator.new('String', ["SINGLE", "FIRST_COLLECTION", "RECURRING_COLLECTION", "FINAL_COLLECTION"])
|
|
186
|
+
unless validator.valid?(type)
|
|
187
|
+
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
|
188
|
+
end
|
|
189
|
+
@type = type
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Checks equality by comparing each attribute.
|
|
193
|
+
# @param [Object] Object to be compared
|
|
194
|
+
def ==(o)
|
|
195
|
+
return true if self.equal?(o)
|
|
196
|
+
self.class == o.class &&
|
|
197
|
+
reference == o.reference &&
|
|
198
|
+
url == o.url &&
|
|
199
|
+
signature_date == o.signature_date &&
|
|
200
|
+
type == o.type
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# @see the `==` method
|
|
204
|
+
# @param [Object] Object to be compared
|
|
205
|
+
def eql?(o)
|
|
206
|
+
self == o
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Calculates hash code according to all attributes.
|
|
210
|
+
# @return [Fixnum] Hash code
|
|
211
|
+
def hash
|
|
212
|
+
[reference, url, signature_date, type].hash
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Builds the object from hash
|
|
216
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
217
|
+
# @return [Object] Returns the model itself
|
|
218
|
+
def build_from_hash(attributes)
|
|
219
|
+
return nil unless attributes.is_a?(Hash)
|
|
220
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
221
|
+
if type =~ /\AArray<(.*)>/i
|
|
222
|
+
# check to ensure the input is an array given that the the attribute
|
|
223
|
+
# is documented as an array but the input is not
|
|
224
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
225
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
226
|
+
end
|
|
227
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
228
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
229
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
self
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Deserializes the data based on type
|
|
236
|
+
# @param string type Data type
|
|
237
|
+
# @param string value Value to be deserialized
|
|
238
|
+
# @return [Object] Deserialized data
|
|
239
|
+
def _deserialize(type, value)
|
|
240
|
+
case type.to_sym
|
|
241
|
+
when :DateTime
|
|
242
|
+
DateTime.parse(value)
|
|
243
|
+
when :Date
|
|
244
|
+
Date.parse(value)
|
|
245
|
+
when :String
|
|
246
|
+
value.to_s
|
|
247
|
+
when :Integer
|
|
248
|
+
value.to_i
|
|
249
|
+
when :Float
|
|
250
|
+
value.to_f
|
|
251
|
+
when :BOOLEAN
|
|
252
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
253
|
+
true
|
|
254
|
+
else
|
|
255
|
+
false
|
|
256
|
+
end
|
|
257
|
+
when :Object
|
|
258
|
+
# generic object (usually a Hash), return directly
|
|
259
|
+
value
|
|
260
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
261
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
262
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
263
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
264
|
+
k_type = Regexp.last_match[:k_type]
|
|
265
|
+
v_type = Regexp.last_match[:v_type]
|
|
266
|
+
{}.tap do |hash|
|
|
267
|
+
value.each do |k, v|
|
|
268
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
else # model
|
|
272
|
+
temp_model = SwaggerClient.const_get(type).new
|
|
273
|
+
temp_model.build_from_hash(value)
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# Returns the string representation of the object
|
|
278
|
+
# @return [String] String presentation of the object
|
|
279
|
+
def to_s
|
|
280
|
+
to_hash.to_s
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
284
|
+
# @return [Hash] Returns the object in the form of hash
|
|
285
|
+
def to_body
|
|
286
|
+
to_hash
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# Returns the object in the form of hash
|
|
290
|
+
# @return [Hash] Returns the object in the form of hash
|
|
291
|
+
def to_hash
|
|
292
|
+
hash = {}
|
|
293
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
294
|
+
value = self.send(attr)
|
|
295
|
+
next if value.nil?
|
|
296
|
+
hash[param] = _to_hash(value)
|
|
297
|
+
end
|
|
298
|
+
hash
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# Outputs non-array value in the form of hash
|
|
302
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
303
|
+
# @param [Object] value Any valid value
|
|
304
|
+
# @return [Hash] Returns the value in the form of hash
|
|
305
|
+
def _to_hash(value)
|
|
306
|
+
if value.is_a?(Array)
|
|
307
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
308
|
+
elsif value.is_a?(Hash)
|
|
309
|
+
{}.tap do |hash|
|
|
310
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
311
|
+
end
|
|
312
|
+
elsif value.respond_to? :to_hash
|
|
313
|
+
value.to_hash
|
|
314
|
+
else
|
|
315
|
+
value
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
end
|