transferzero-sdk 1.7.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +93 -0
  3. data/README.md +11 -4
  4. data/docs/Currency.md +0 -2
  5. data/docs/CurrencyExchange.md +0 -2
  6. data/docs/CurrencyOpposite.md +3 -3
  7. data/docs/Document.md +4 -0
  8. data/docs/PayoutMethod.md +1 -1
  9. data/docs/PayoutMethodCashProviderEnum.md +16 -0
  10. data/docs/PayoutMethodDetails.md +13 -1
  11. data/docs/PayoutMethodDetailsMobile.md +3 -1
  12. data/docs/PayoutMethodDetailsXOFCash.md +23 -0
  13. data/docs/PayoutMethodDetailsZARBank.md +35 -0
  14. data/docs/ProofOfPayment.md +23 -0
  15. data/docs/ProofOfPaymentListResponse.md +17 -0
  16. data/docs/Recipient.md +4 -0
  17. data/docs/RecipientStateReasonDetails.md +23 -0
  18. data/docs/RecipientsApi.md +62 -0
  19. data/docs/Sender.md +18 -8
  20. data/example/client.rb +55 -18
  21. data/lib/transferzero-sdk.rb +6 -0
  22. data/lib/transferzero-sdk/api/recipients_api.rb +54 -0
  23. data/lib/transferzero-sdk/api_client.rb +1 -1
  24. data/lib/transferzero-sdk/models/currency.rb +1 -11
  25. data/lib/transferzero-sdk/models/currency_exchange.rb +1 -11
  26. data/lib/transferzero-sdk/models/currency_opposite.rb +14 -14
  27. data/lib/transferzero-sdk/models/document.rb +21 -1
  28. data/lib/transferzero-sdk/models/payout_method.rb +1 -1
  29. data/lib/transferzero-sdk/models/payout_method_cash_provider_enum.rb +31 -0
  30. data/lib/transferzero-sdk/models/payout_method_details.rb +76 -5
  31. data/lib/transferzero-sdk/models/payout_method_details_mobile.rb +13 -4
  32. data/lib/transferzero-sdk/models/payout_method_details_xof_bank.rb +1 -1
  33. data/lib/transferzero-sdk/models/payout_method_details_xof_cash.rb +245 -0
  34. data/lib/transferzero-sdk/models/payout_method_details_xof_mobile.rb +1 -1
  35. data/lib/transferzero-sdk/models/payout_method_details_zar_bank.rb +324 -0
  36. data/lib/transferzero-sdk/models/payout_method_mobile_provider_enum.rb +3 -0
  37. data/lib/transferzero-sdk/models/proof_of_payment.rb +233 -0
  38. data/lib/transferzero-sdk/models/proof_of_payment_list_response.rb +204 -0
  39. data/lib/transferzero-sdk/models/recipient.rb +20 -1
  40. data/lib/transferzero-sdk/models/recipient_state_reason_details.rb +235 -0
  41. data/lib/transferzero-sdk/models/sender.rb +88 -14
  42. data/lib/transferzero-sdk/version.rb +1 -1
  43. data/spec/models/payout_method_cash_provider_enum_spec.rb +35 -0
  44. data/spec/models/payout_method_details_xof_cash_spec.rb +71 -0
  45. data/spec/models/payout_method_details_zar_bank_spec.rb +89 -0
  46. data/spec/models/proof_of_payment_list_response_spec.rb +41 -0
  47. data/spec/models/proof_of_payment_spec.rb +59 -0
  48. data/spec/models/recipient_state_reason_details_spec.rb +59 -0
  49. data/transferzero-sdk-1.10.0.gem +0 -0
  50. metadata +28 -2
@@ -17,6 +17,9 @@ class PayoutMethodMobileProviderEnum
17
17
 
18
18
  ORANGE = "orange".freeze
19
19
  TIGO = "tigo".freeze
20
+ MTN = "mtn".freeze
21
+ AIRTEL = "airtel".freeze
22
+ VODAFONE = "vodafone".freeze
20
23
 
21
24
  # Builds the enum from string
22
25
  # @param [String] The enum value in the form of the string
@@ -0,0 +1,233 @@
1
+ =begin
2
+ #TransferZero API
3
+
4
+ #Reference documentation for the TransferZero API V1
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TransferZero
16
+ class ProofOfPayment
17
+ # UUID of the uploaded document
18
+ attr_accessor :id
19
+
20
+ # Name of the uploaded file
21
+ attr_accessor :file_name
22
+
23
+ # URL to thumbnail image of the uploaded file
24
+ attr_accessor :thumbnail
25
+
26
+ # URL to uploaded file
27
+ attr_accessor :url
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'id' => :'id',
33
+ :'file_name' => :'file_name',
34
+ :'thumbnail' => :'thumbnail',
35
+ :'url' => :'url'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'id' => :'String',
43
+ :'file_name' => :'String',
44
+ :'thumbnail' => :'String',
45
+ :'url' => :'String'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::ProofOfPayment` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::ProofOfPayment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'id')
65
+ self.id = attributes[:'id']
66
+ end
67
+
68
+ if attributes.key?(:'file_name')
69
+ self.file_name = attributes[:'file_name']
70
+ end
71
+
72
+ if attributes.key?(:'thumbnail')
73
+ self.thumbnail = attributes[:'thumbnail']
74
+ end
75
+
76
+ if attributes.key?(:'url')
77
+ self.url = attributes[:'url']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ id == o.id &&
100
+ file_name == o.file_name &&
101
+ thumbnail == o.thumbnail &&
102
+ url == o.url
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [id, file_name, thumbnail, url].hash
115
+ end
116
+
117
+ require 'active_support/core_ext/hash'
118
+ require 'active_support/hash_with_indifferent_access.rb'
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ self.class.openapi_types.each_pair do |key, type|
125
+ if type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :DateTime
146
+ DateTime.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ temp_model = TransferZero.const_get(type).new
177
+ temp_model.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ next if value.nil?
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
203
+ end
204
+
205
+ def [](key)
206
+ to_hash[key]
207
+ end
208
+
209
+ def dig(*args)
210
+ to_hash.dig(*args)
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+
231
+ end
232
+
233
+ end
@@ -0,0 +1,204 @@
1
+ =begin
2
+ #TransferZero API
3
+
4
+ #Reference documentation for the TransferZero API V1
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TransferZero
16
+ class ProofOfPaymentListResponse
17
+ attr_accessor :object
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'object' => :'object'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'object' => :'Array<ProofOfPayment>'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ if (!attributes.is_a?(Hash))
37
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::ProofOfPaymentListResponse` initialize method"
38
+ end
39
+
40
+ # check to see if the attribute exists and convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h|
42
+ if (!self.class.attribute_map.key?(k.to_sym))
43
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::ProofOfPaymentListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
44
+ end
45
+ h[k.to_sym] = v
46
+ }
47
+
48
+ if attributes.key?(:'object')
49
+ if (value = attributes[:'object']).is_a?(Array)
50
+ self.object = value
51
+ end
52
+ end
53
+ end
54
+
55
+ # Show invalid properties with the reasons. Usually used together with valid?
56
+ # @return Array for valid properties with the reasons
57
+ def list_invalid_properties
58
+ invalid_properties = Array.new
59
+ invalid_properties
60
+ end
61
+
62
+ # Check to see if the all the properties in the model are valid
63
+ # @return true if the model is valid
64
+ def valid?
65
+ true
66
+ end
67
+
68
+ # Checks equality by comparing each attribute.
69
+ # @param [Object] Object to be compared
70
+ def ==(o)
71
+ return true if self.equal?(o)
72
+ self.class == o.class &&
73
+ object == o.object
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Integer] Hash code
84
+ def hash
85
+ [object].hash
86
+ end
87
+
88
+ require 'active_support/core_ext/hash'
89
+ require 'active_support/hash_with_indifferent_access.rb'
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.openapi_types.each_pair do |key, type|
96
+ if type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :Boolean
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ temp_model = TransferZero.const_get(type).new
148
+ temp_model.build_from_hash(value)
149
+ end
150
+ end
151
+
152
+ # Returns the string representation of the object
153
+ # @return [String] String presentation of the object
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # to_body is an alias to to_hash (backward compatibility)
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_body
161
+ to_hash
162
+ end
163
+
164
+ # Returns the object in the form of hash
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_hash
167
+ hash = {}
168
+ self.class.attribute_map.each_pair do |attr, param|
169
+ value = self.send(attr)
170
+ next if value.nil?
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
174
+ end
175
+
176
+ def [](key)
177
+ to_hash[key]
178
+ end
179
+
180
+ def dig(*args)
181
+ to_hash.dig(*args)
182
+ end
183
+
184
+ # Outputs non-array value in the form of hash
185
+ # For object, use to_hash. Otherwise, just return the value
186
+ # @param [Object] value Any valid value
187
+ # @return [Hash] Returns the value in the form of hash
188
+ def _to_hash(value)
189
+ if value.is_a?(Array)
190
+ value.compact.map { |v| _to_hash(v) }
191
+ elsif value.is_a?(Hash)
192
+ {}.tap do |hash|
193
+ value.each { |k, v| hash[k] = _to_hash(v) }
194
+ end
195
+ elsif value.respond_to? :to_hash
196
+ value.to_hash
197
+ else
198
+ value
199
+ end
200
+ end
201
+
202
+ end
203
+
204
+ end
@@ -44,11 +44,16 @@ class Recipient
44
44
  # In case the payment is unsuccessful it holds the error message associated with the last unsuccessful payout.
45
45
  attr_accessor :state_reason
46
46
 
47
+ attr_accessor :state_reason_details
48
+
47
49
  attr_accessor :state
48
50
 
49
51
  # The ID of the transaction that is related to this recipient
50
52
  attr_accessor :transaction_id
51
53
 
54
+ # Optional ID that is supplied by partner linking it to the partner's own Transaction ID.
55
+ attr_accessor :transaction_external_id
56
+
52
57
  attr_accessor :transaction_state
53
58
 
54
59
  # The exchange rate used in this payment
@@ -87,8 +92,10 @@ class Recipient
87
92
  :'input_usd_amount' => :'input_usd_amount',
88
93
  :'may_cancel' => :'may_cancel',
89
94
  :'state_reason' => :'state_reason',
95
+ :'state_reason_details' => :'state_reason_details',
90
96
  :'state' => :'state',
91
97
  :'transaction_id' => :'transaction_id',
98
+ :'transaction_external_id' => :'transaction_external_id',
92
99
  :'transaction_state' => :'transaction_state',
93
100
  :'exchange_rate' => :'exchange_rate',
94
101
  :'fee_fractional' => :'fee_fractional',
@@ -114,8 +121,10 @@ class Recipient
114
121
  :'input_usd_amount' => :'Float',
115
122
  :'may_cancel' => :'Boolean',
116
123
  :'state_reason' => :'String',
124
+ :'state_reason_details' => :'RecipientStateReasonDetails',
117
125
  :'state' => :'RecipientState',
118
126
  :'transaction_id' => :'String',
127
+ :'transaction_external_id' => :'String',
119
128
  :'transaction_state' => :'TransactionState',
120
129
  :'exchange_rate' => :'Float',
121
130
  :'fee_fractional' => :'Float',
@@ -183,6 +192,10 @@ class Recipient
183
192
  self.state_reason = attributes[:'state_reason']
184
193
  end
185
194
 
195
+ if attributes.key?(:'state_reason_details')
196
+ self.state_reason_details = attributes[:'state_reason_details']
197
+ end
198
+
186
199
  if attributes.key?(:'state')
187
200
  self.state = attributes[:'state']
188
201
  end
@@ -191,6 +204,10 @@ class Recipient
191
204
  self.transaction_id = attributes[:'transaction_id']
192
205
  end
193
206
 
207
+ if attributes.key?(:'transaction_external_id')
208
+ self.transaction_external_id = attributes[:'transaction_external_id']
209
+ end
210
+
194
211
  if attributes.key?(:'transaction_state')
195
212
  self.transaction_state = attributes[:'transaction_state']
196
213
  end
@@ -273,8 +290,10 @@ class Recipient
273
290
  input_usd_amount == o.input_usd_amount &&
274
291
  may_cancel == o.may_cancel &&
275
292
  state_reason == o.state_reason &&
293
+ state_reason_details == o.state_reason_details &&
276
294
  state == o.state &&
277
295
  transaction_id == o.transaction_id &&
296
+ transaction_external_id == o.transaction_external_id &&
278
297
  transaction_state == o.transaction_state &&
279
298
  exchange_rate == o.exchange_rate &&
280
299
  fee_fractional == o.fee_fractional &&
@@ -295,7 +314,7 @@ class Recipient
295
314
  # Calculates hash code according to all attributes.
296
315
  # @return [Integer] Hash code
297
316
  def hash
298
- [requested_amount, requested_currency, payout_method, metadata, created_at, editable, retriable, input_usd_amount, may_cancel, state_reason, state, transaction_id, transaction_state, exchange_rate, fee_fractional, input_amount, input_currency, output_amount, output_currency, id, errors].hash
317
+ [requested_amount, requested_currency, payout_method, metadata, created_at, editable, retriable, input_usd_amount, may_cancel, state_reason, state_reason_details, state, transaction_id, transaction_external_id, transaction_state, exchange_rate, fee_fractional, input_amount, input_currency, output_amount, output_currency, id, errors].hash
299
318
  end
300
319
 
301
320
  require 'active_support/core_ext/hash'