transferzero-sdk 1.9.0 → 1.13.0

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +94 -0
  3. data/README.md +12 -4
  4. data/docs/AccountValidationRequest.md +2 -0
  5. data/docs/Document.md +4 -0
  6. data/docs/PayoutMethod.md +1 -1
  7. data/docs/PayoutMethodCashProviderEnum.md +16 -0
  8. data/docs/PayoutMethodCountryEnum.md +16 -0
  9. data/docs/PayoutMethodDetails.md +4 -0
  10. data/docs/PayoutMethodDetailsGHSCash.md +21 -0
  11. data/docs/PayoutMethodDetailsXOFCash.md +25 -0
  12. data/docs/PayoutMethodDetailsXOFMobile.md +3 -1
  13. data/docs/ProofOfPayment.md +23 -0
  14. data/docs/ProofOfPaymentListResponse.md +17 -0
  15. data/docs/Recipient.md +4 -0
  16. data/docs/RecipientStateReasonDetails.md +23 -0
  17. data/docs/RecipientsApi.md +62 -0
  18. data/docs/Sender.md +3 -1
  19. data/lib/transferzero-sdk.rb +7 -0
  20. data/lib/transferzero-sdk/api/recipients_api.rb +54 -0
  21. data/lib/transferzero-sdk/api_client.rb +1 -1
  22. data/lib/transferzero-sdk/models/account_validation_request.rb +10 -1
  23. data/lib/transferzero-sdk/models/document.rb +21 -1
  24. data/lib/transferzero-sdk/models/payout_method.rb +1 -1
  25. data/lib/transferzero-sdk/models/payout_method_cash_provider_enum.rb +31 -0
  26. data/lib/transferzero-sdk/models/payout_method_country_enum.rb +43 -0
  27. data/lib/transferzero-sdk/models/payout_method_details.rb +21 -1
  28. data/lib/transferzero-sdk/models/payout_method_details_ghs_cash.rb +236 -0
  29. data/lib/transferzero-sdk/models/payout_method_details_mad_cash.rb +1 -1
  30. data/lib/transferzero-sdk/models/payout_method_details_xof_bank.rb +1 -1
  31. data/lib/transferzero-sdk/models/payout_method_details_xof_cash.rb +254 -0
  32. data/lib/transferzero-sdk/models/payout_method_details_xof_mobile.rb +14 -5
  33. data/lib/transferzero-sdk/models/payout_method_identity_card_type_enum.rb +1 -1
  34. data/lib/transferzero-sdk/models/payout_method_mobile_provider_enum.rb +1 -0
  35. data/lib/transferzero-sdk/models/proof_of_payment.rb +233 -0
  36. data/lib/transferzero-sdk/models/proof_of_payment_list_response.rb +204 -0
  37. data/lib/transferzero-sdk/models/recipient.rb +20 -1
  38. data/lib/transferzero-sdk/models/recipient_state_reason_details.rb +235 -0
  39. data/lib/transferzero-sdk/models/sender.rb +12 -2
  40. data/lib/transferzero-sdk/version.rb +1 -1
  41. data/spec/models/payout_method_cash_provider_enum_spec.rb +35 -0
  42. data/spec/models/payout_method_country_enum_spec.rb +35 -0
  43. data/spec/models/payout_method_details_ghs_cash_spec.rb +53 -0
  44. data/spec/models/payout_method_details_xof_cash_spec.rb +71 -0
  45. data/spec/models/proof_of_payment_list_response_spec.rb +41 -0
  46. data/spec/models/proof_of_payment_spec.rb +59 -0
  47. data/spec/models/recipient_state_reason_details_spec.rb +59 -0
  48. metadata +32 -3
@@ -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'
@@ -0,0 +1,235 @@
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 RecipientStateReasonDetails
17
+ # Status code of failed transaction
18
+ attr_accessor :code
19
+
20
+ # Main category of error, it could be paid, unknown, pickupable, temporary_error, recipient_error, sender_error
21
+ attr_accessor :category
22
+
23
+ # Tiered messages
24
+ attr_accessor :messages
25
+
26
+ # Public, human readable, detailed error message
27
+ attr_accessor :description
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'code' => :'code',
33
+ :'category' => :'category',
34
+ :'messages' => :'messages',
35
+ :'description' => :'description'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'code' => :'String',
43
+ :'category' => :'String',
44
+ :'messages' => :'Array<String>',
45
+ :'description' => :'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::RecipientStateReasonDetails` 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::RecipientStateReasonDetails`. 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?(:'code')
65
+ self.code = attributes[:'code']
66
+ end
67
+
68
+ if attributes.key?(:'category')
69
+ self.category = attributes[:'category']
70
+ end
71
+
72
+ if attributes.key?(:'messages')
73
+ if (value = attributes[:'messages']).is_a?(Array)
74
+ self.messages = value
75
+ end
76
+ end
77
+
78
+ if attributes.key?(:'description')
79
+ self.description = attributes[:'description']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ code == o.code &&
102
+ category == o.category &&
103
+ messages == o.messages &&
104
+ description == o.description
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [code, category, messages, description].hash
117
+ end
118
+
119
+ require 'active_support/core_ext/hash'
120
+ require 'active_support/hash_with_indifferent_access.rb'
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ temp_model = TransferZero.const_get(type).new
179
+ temp_model.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ next if value.nil?
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
205
+ end
206
+
207
+ def [](key)
208
+ to_hash[key]
209
+ end
210
+
211
+ def dig(*args)
212
+ to_hash.dig(*args)
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ end