wallee-ruby-sdk 2.2.4 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/lib/wallee-ruby-sdk.rb +23 -1
  4. data/lib/wallee-ruby-sdk/api/charge_bank_transaction_service_api.rb +213 -0
  5. data/lib/wallee-ruby-sdk/api/external_transfer_bank_transaction_service_api.rb +213 -0
  6. data/lib/wallee-ruby-sdk/api/internal_transfer_bank_transaction_service_api.rb +213 -0
  7. data/lib/wallee-ruby-sdk/api/refund_bank_transaction_service_api.rb +213 -0
  8. data/lib/wallee-ruby-sdk/api/refund_recovery_bank_transaction_service_api.rb +213 -0
  9. data/lib/wallee-ruby-sdk/api_client.rb +2 -1
  10. data/lib/wallee-ruby-sdk/models/abstract_payment_link_update.rb +15 -15
  11. data/lib/wallee-ruby-sdk/models/bank_account.rb +291 -0
  12. data/lib/wallee-ruby-sdk/models/bank_account_environment.rb +35 -0
  13. data/lib/wallee-ruby-sdk/models/bank_account_state.rb +37 -0
  14. data/lib/wallee-ruby-sdk/models/bank_account_type.rb +227 -0
  15. data/lib/wallee-ruby-sdk/models/bank_transaction.rb +387 -0
  16. data/lib/wallee-ruby-sdk/models/bank_transaction_flow_direction.rb +35 -0
  17. data/lib/wallee-ruby-sdk/models/bank_transaction_source.rb +215 -0
  18. data/lib/wallee-ruby-sdk/models/bank_transaction_state.rb +35 -0
  19. data/lib/wallee-ruby-sdk/models/bank_transaction_type.rb +215 -0
  20. data/lib/wallee-ruby-sdk/models/charge_bank_transaction.rb +291 -0
  21. data/lib/wallee-ruby-sdk/models/currency_bank_account.rb +241 -0
  22. data/lib/wallee-ruby-sdk/models/external_transfer_bank_transaction.rb +251 -0
  23. data/lib/wallee-ruby-sdk/models/internal_transfer_bank_transaction.rb +231 -0
  24. data/lib/wallee-ruby-sdk/models/payment_adjustment.rb +231 -0
  25. data/lib/wallee-ruby-sdk/models/payment_adjustment_type.rb +215 -0
  26. data/lib/wallee-ruby-sdk/models/payment_link.rb +15 -15
  27. data/lib/wallee-ruby-sdk/models/payment_link_active.rb +15 -15
  28. data/lib/wallee-ruby-sdk/models/payment_link_address_handling_mode.rb +36 -0
  29. data/lib/wallee-ruby-sdk/models/payment_link_create.rb +15 -15
  30. data/lib/wallee-ruby-sdk/models/payment_link_update.rb +15 -15
  31. data/lib/wallee-ruby-sdk/models/payment_terminal_address.rb +0 -60
  32. data/lib/wallee-ruby-sdk/models/payment_terminal_location.rb +2 -12
  33. data/lib/wallee-ruby-sdk/models/refund_bank_transaction.rb +281 -0
  34. data/lib/wallee-ruby-sdk/models/refund_recovery_bank_transaction.rb +293 -0
  35. data/lib/wallee-ruby-sdk/models/subscription_ledger_entry.rb +11 -1
  36. data/lib/wallee-ruby-sdk/models/transaction.rb +64 -4
  37. data/lib/wallee-ruby-sdk/version.rb +1 -1
  38. data/test/condition_type_service_test.rb +22 -0
  39. metadata +27 -3
  40. data/lib/wallee-ruby-sdk/models/payment_terminal_contact_address.rb +0 -396
@@ -147,7 +147,8 @@ module Wallee
147
147
  # @return [Hash] the authentication headers
148
148
  def get_authentication_headers(http_method, path, query)
149
149
  base_url = URI(@config.base_url)
150
- completed_path = "#{base_url.path}#{path}"+'?'+query.map{|k,v| "#{k}=#{v}"}.join('&')
150
+ completed_path = "#{base_url.path}#{path}"
151
+ completed_path += "?" + query.map{|k,v| "#{k}=#{v}"}.join('&') unless query.empty?
151
152
  version = "1"
152
153
  timestamp = Time.now.to_i
153
154
  securedData = "#{version}|#{@config.user_id}|#{timestamp}|#{http_method.upcase}|#{completed_path}"
@@ -31,8 +31,8 @@ module Wallee
31
31
  # The available from date defines the latest date on which the payment link can be used to initialize a transaction. When no date is specified there will be no restriction.
32
32
  attr_accessor :available_until
33
33
 
34
- # By making the billing address required the transaction can only be created when a billing address is provided within the request.
35
- attr_accessor :billing_address_required
34
+ # The billing address handling mode controls if the address is collected or not and how it is collected.
35
+ attr_accessor :billing_address_handling_mode
36
36
 
37
37
  # The currency defines in which currency the payment is executed in. If no currency is defined it has to be specified within the request parameter 'currency'.
38
38
  attr_accessor :currency
@@ -49,8 +49,8 @@ module Wallee
49
49
  # The payment link name is used internally to identify the payment link. For example the name is used within search fields and hence it should be distinct and descriptive.
50
50
  attr_accessor :name
51
51
 
52
- # By making the shipping address required the transaction can only be created when a shipping address is provided within the request.
53
- attr_accessor :shipping_address_required
52
+ # The shipping address handling mode controls if the address is collected or not and how it is collected.
53
+ attr_accessor :shipping_address_handling_mode
54
54
 
55
55
  # Attribute mapping from ruby-style variable name to JSON key.
56
56
  def self.attribute_map
@@ -59,13 +59,13 @@ module Wallee
59
59
  :'applied_space_view' => :'appliedSpaceView',
60
60
  :'available_from' => :'availableFrom',
61
61
  :'available_until' => :'availableUntil',
62
- :'billing_address_required' => :'billingAddressRequired',
62
+ :'billing_address_handling_mode' => :'billingAddressHandlingMode',
63
63
  :'currency' => :'currency',
64
64
  :'language' => :'language',
65
65
  :'line_items' => :'lineItems',
66
66
  :'maximal_number_of_transactions' => :'maximalNumberOfTransactions',
67
67
  :'name' => :'name',
68
- :'shipping_address_required' => :'shippingAddressRequired'
68
+ :'shipping_address_handling_mode' => :'shippingAddressHandlingMode'
69
69
  }
70
70
  end
71
71
 
@@ -76,13 +76,13 @@ module Wallee
76
76
  :'applied_space_view' => :'Integer',
77
77
  :'available_from' => :'DateTime',
78
78
  :'available_until' => :'DateTime',
79
- :'billing_address_required' => :'BOOLEAN',
79
+ :'billing_address_handling_mode' => :'PaymentLinkAddressHandlingMode',
80
80
  :'currency' => :'String',
81
81
  :'language' => :'String',
82
82
  :'line_items' => :'Array<LineItemCreate>',
83
83
  :'maximal_number_of_transactions' => :'Integer',
84
84
  :'name' => :'String',
85
- :'shipping_address_required' => :'BOOLEAN'
85
+ :'shipping_address_handling_mode' => :'PaymentLinkAddressHandlingMode'
86
86
  }
87
87
  end
88
88
 
@@ -112,8 +112,8 @@ module Wallee
112
112
  self.available_until = attributes[:'availableUntil']
113
113
  end
114
114
 
115
- if attributes.has_key?(:'billingAddressRequired')
116
- self.billing_address_required = attributes[:'billingAddressRequired']
115
+ if attributes.has_key?(:'billingAddressHandlingMode')
116
+ self.billing_address_handling_mode = attributes[:'billingAddressHandlingMode']
117
117
  end
118
118
 
119
119
  if attributes.has_key?(:'currency')
@@ -138,8 +138,8 @@ module Wallee
138
138
  self.name = attributes[:'name']
139
139
  end
140
140
 
141
- if attributes.has_key?(:'shippingAddressRequired')
142
- self.shipping_address_required = attributes[:'shippingAddressRequired']
141
+ if attributes.has_key?(:'shippingAddressHandlingMode')
142
+ self.shipping_address_handling_mode = attributes[:'shippingAddressHandlingMode']
143
143
  end
144
144
  end
145
145
 
@@ -180,13 +180,13 @@ module Wallee
180
180
  applied_space_view == o.applied_space_view &&
181
181
  available_from == o.available_from &&
182
182
  available_until == o.available_until &&
183
- billing_address_required == o.billing_address_required &&
183
+ billing_address_handling_mode == o.billing_address_handling_mode &&
184
184
  currency == o.currency &&
185
185
  language == o.language &&
186
186
  line_items == o.line_items &&
187
187
  maximal_number_of_transactions == o.maximal_number_of_transactions &&
188
188
  name == o.name &&
189
- shipping_address_required == o.shipping_address_required
189
+ shipping_address_handling_mode == o.shipping_address_handling_mode
190
190
  end
191
191
 
192
192
  # @see the `==` method
@@ -198,7 +198,7 @@ module Wallee
198
198
  # Calculates hash code according to all attributes.
199
199
  # @return [Fixnum] Hash code
200
200
  def hash
201
- [allowed_payment_method_configurations, applied_space_view, available_from, available_until, billing_address_required, currency, language, line_items, maximal_number_of_transactions, name, shipping_address_required].hash
201
+ [allowed_payment_method_configurations, applied_space_view, available_from, available_until, billing_address_handling_mode, currency, language, line_items, maximal_number_of_transactions, name, shipping_address_handling_mode].hash
202
202
  end
203
203
 
204
204
  # Builds the object from hash
@@ -0,0 +1,291 @@
1
+ =begin
2
+ The wallee API allows an easy interaction with the wallee web service.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ =end
17
+
18
+ require 'date'
19
+
20
+ module Wallee
21
+ #
22
+ class BankAccount
23
+ # The optional description is shown along the identifier. The intention of the description is to give an alternative name to the bank account.
24
+ attr_accessor :description
25
+
26
+ # The ID is the primary key of the entity. The ID identifies the entity uniquely.
27
+ attr_accessor :id
28
+
29
+ # The bank account identifier is responsible to uniquely identify the bank account.
30
+ attr_accessor :identifier
31
+
32
+ # The linked space id holds the ID of the space to which the entity belongs to.
33
+ attr_accessor :linked_space_id
34
+
35
+ # The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.
36
+ attr_accessor :planned_purge_date
37
+
38
+ #
39
+ attr_accessor :state
40
+
41
+ #
42
+ attr_accessor :type
43
+
44
+ # The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
45
+ attr_accessor :version
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'description' => :'description',
51
+ :'id' => :'id',
52
+ :'identifier' => :'identifier',
53
+ :'linked_space_id' => :'linkedSpaceId',
54
+ :'planned_purge_date' => :'plannedPurgeDate',
55
+ :'state' => :'state',
56
+ :'type' => :'type',
57
+ :'version' => :'version'
58
+ }
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.swagger_types
63
+ {
64
+ :'description' => :'String',
65
+ :'id' => :'Integer',
66
+ :'identifier' => :'String',
67
+ :'linked_space_id' => :'Integer',
68
+ :'planned_purge_date' => :'DateTime',
69
+ :'state' => :'BankAccountState',
70
+ :'type' => :'Integer',
71
+ :'version' => :'Integer'
72
+ }
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ return unless attributes.is_a?(Hash)
79
+
80
+ # convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
82
+
83
+ if attributes.has_key?(:'description')
84
+ self.description = attributes[:'description']
85
+ end
86
+
87
+ if attributes.has_key?(:'id')
88
+ self.id = attributes[:'id']
89
+ end
90
+
91
+ if attributes.has_key?(:'identifier')
92
+ self.identifier = attributes[:'identifier']
93
+ end
94
+
95
+ if attributes.has_key?(:'linkedSpaceId')
96
+ self.linked_space_id = attributes[:'linkedSpaceId']
97
+ end
98
+
99
+ if attributes.has_key?(:'plannedPurgeDate')
100
+ self.planned_purge_date = attributes[:'plannedPurgeDate']
101
+ end
102
+
103
+ if attributes.has_key?(:'state')
104
+ self.state = attributes[:'state']
105
+ end
106
+
107
+ if attributes.has_key?(:'type')
108
+ self.type = attributes[:'type']
109
+ end
110
+
111
+ if attributes.has_key?(:'version')
112
+ self.version = attributes[:'version']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ if !@description.nil? && @description.to_s.length > 100
121
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 100.')
122
+ end
123
+
124
+ if !@identifier.nil? && @identifier.to_s.length > 100
125
+ invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 100.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ return false if !@description.nil? && @description.to_s.length > 100
135
+ return false if !@identifier.nil? && @identifier.to_s.length > 100
136
+ true
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] description Value to be assigned
141
+ def description=(description)
142
+ if !description.nil? && description.to_s.length > 100
143
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 100.'
144
+ end
145
+
146
+ @description = description
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] identifier Value to be assigned
151
+ def identifier=(identifier)
152
+ if !identifier.nil? && identifier.to_s.length > 100
153
+ fail ArgumentError, 'invalid value for "identifier", the character length must be smaller than or equal to 100.'
154
+ end
155
+
156
+ @identifier = identifier
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(o)
162
+ return true if self.equal?(o)
163
+ self.class == o.class &&
164
+ description == o.description &&
165
+ id == o.id &&
166
+ identifier == o.identifier &&
167
+ linked_space_id == o.linked_space_id &&
168
+ planned_purge_date == o.planned_purge_date &&
169
+ state == o.state &&
170
+ type == o.type &&
171
+ version == o.version
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] Object to be compared
176
+ def eql?(o)
177
+ self == o
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Fixnum] Hash code
182
+ def hash
183
+ [description, id, identifier, linked_space_id, planned_purge_date, state, type, version].hash
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ self.class.swagger_types.each_pair do |key, type|
192
+ if type =~ /\AArray<(.*)>/i
193
+ # check to ensure the input is an array given that the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
196
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
197
+ end
198
+ elsif !attributes[self.class.attribute_map[key]].nil?
199
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
200
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
201
+ end
202
+
203
+ self
204
+ end
205
+
206
+ # Deserializes the data based on type
207
+ # @param string type Data type
208
+ # @param string value Value to be deserialized
209
+ # @return [Object] Deserialized data
210
+ def _deserialize(type, value)
211
+ case type.to_sym
212
+ when :DateTime
213
+ DateTime.parse(value)
214
+ when :Date
215
+ Date.parse(value)
216
+ when :String
217
+ value.to_s
218
+ when :Integer
219
+ value.to_i
220
+ when :Float
221
+ value.to_f
222
+ when :BOOLEAN
223
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
224
+ true
225
+ else
226
+ false
227
+ end
228
+ when :Object
229
+ # generic object (usually a Hash), return directly
230
+ value
231
+ when /\AArray<(?<inner_type>.+)>\z/
232
+ inner_type = Regexp.last_match[:inner_type]
233
+ value.map { |v| _deserialize(inner_type, v) }
234
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
235
+ k_type = Regexp.last_match[:k_type]
236
+ v_type = Regexp.last_match[:v_type]
237
+ {}.tap do |hash|
238
+ value.each do |k, v|
239
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
240
+ end
241
+ end
242
+ else # model
243
+ temp_model = Wallee.const_get(type).new
244
+ temp_model.build_from_hash(value)
245
+ end
246
+ end
247
+
248
+ # Returns the string representation of the object
249
+ # @return [String] String presentation of the object
250
+ def to_s
251
+ to_hash.to_s
252
+ end
253
+
254
+ # to_body is an alias to to_hash (backward compatibility)
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_body
257
+ to_hash
258
+ end
259
+
260
+ # Returns the object in the form of hash
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_hash
263
+ hash = {}
264
+ self.class.attribute_map.each_pair do |attr, param|
265
+ value = self.send(attr)
266
+ next if value.nil?
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map{ |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+
290
+ end
291
+ end
@@ -0,0 +1,35 @@
1
+ =begin
2
+ The wallee API allows an easy interaction with the wallee web service.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ =end
17
+
18
+ require 'date'
19
+
20
+ module Wallee
21
+ class BankAccountEnvironment
22
+
23
+ PRODUCTION = 'PRODUCTION'.freeze
24
+ TEST = 'TEST'.freeze
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def build_from_hash(value)
30
+ constantValues = BankAccountEnvironment.constants.select { |c| BankAccountEnvironment::const_get(c) == value }
31
+ raise "Invalid ENUM value #{value} for class #BankAccountEnvironment" if constantValues.empty?
32
+ value
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,37 @@
1
+ =begin
2
+ The wallee API allows an easy interaction with the wallee web service.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ =end
17
+
18
+ require 'date'
19
+
20
+ module Wallee
21
+ class BankAccountState
22
+
23
+ CREATE = 'CREATE'.freeze
24
+ ACTIVE = 'ACTIVE'.freeze
25
+ DELETING = 'DELETING'.freeze
26
+ DELETED = 'DELETED'.freeze
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ constantValues = BankAccountState.constants.select { |c| BankAccountState::const_get(c) == value }
33
+ raise "Invalid ENUM value #{value} for class #BankAccountState" if constantValues.empty?
34
+ value
35
+ end
36
+ end
37
+ end