mundi_api 0.9.1 → 0.13.7

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 (144) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1755 -698
  3. data/lib/mundi_api.rb +75 -35
  4. data/lib/mundi_api/api_helper.rb +59 -7
  5. data/lib/mundi_api/controllers/charges_controller.rb +136 -97
  6. data/lib/mundi_api/controllers/customers_controller.rb +264 -253
  7. data/lib/mundi_api/controllers/invoices_controller.rb +97 -23
  8. data/lib/mundi_api/controllers/orders_controller.rb +247 -30
  9. data/lib/mundi_api/controllers/plans_controller.rb +108 -106
  10. data/lib/mundi_api/controllers/recipients_controller.rb +571 -0
  11. data/lib/mundi_api/controllers/sellers_controller.rb +244 -0
  12. data/lib/mundi_api/controllers/subscriptions_controller.rb +298 -108
  13. data/lib/mundi_api/models/create_access_token_request.rb +7 -9
  14. data/lib/mundi_api/models/create_address_request.rb +30 -14
  15. data/lib/mundi_api/models/create_anticipation_request.rb +53 -0
  16. data/lib/mundi_api/models/create_bank_account_request.rb +114 -0
  17. data/lib/mundi_api/models/create_bank_transfer_payment_request.rb +3 -5
  18. data/lib/mundi_api/models/create_boleto_payment_request.rb +18 -11
  19. data/lib/mundi_api/models/create_cancel_charge_request.rb +2 -4
  20. data/lib/mundi_api/models/create_cancel_subscription_request.rb +2 -4
  21. data/lib/mundi_api/models/create_capture_charge_request.rb +3 -5
  22. data/lib/mundi_api/models/create_card_options_request.rb +2 -4
  23. data/lib/mundi_api/models/create_card_request.rb +24 -17
  24. data/lib/mundi_api/models/create_card_token_request.rb +7 -9
  25. data/lib/mundi_api/models/create_charge_request.rb +8 -10
  26. data/lib/mundi_api/models/create_checkout_boleto_payment_request.rb +4 -6
  27. data/lib/mundi_api/models/create_checkout_card_installment_option_request.rb +3 -5
  28. data/lib/mundi_api/models/create_checkout_card_payment_request.rb +3 -5
  29. data/lib/mundi_api/models/create_checkout_payment_request.rb +55 -11
  30. data/lib/mundi_api/models/create_credit_card_payment_request.rb +28 -12
  31. data/lib/mundi_api/models/create_customer_request.rb +10 -12
  32. data/lib/mundi_api/models/create_device_request.rb +33 -0
  33. data/lib/mundi_api/models/create_discount_request.rb +5 -7
  34. data/lib/mundi_api/models/create_location_request.rb +42 -0
  35. data/lib/mundi_api/models/create_order_item_request.rb +15 -8
  36. data/lib/mundi_api/models/create_order_request.rb +57 -13
  37. data/lib/mundi_api/models/create_payment_request.rb +46 -13
  38. data/lib/mundi_api/models/create_phone_request.rb +4 -6
  39. data/lib/mundi_api/models/create_phones_request.rb +3 -5
  40. data/lib/mundi_api/models/create_plan_item_request.rb +7 -9
  41. data/lib/mundi_api/models/create_plan_request.rb +19 -21
  42. data/lib/mundi_api/models/create_price_bracket_request.rb +5 -7
  43. data/lib/mundi_api/models/create_pricing_scheme_request.rb +5 -7
  44. data/lib/mundi_api/models/create_recipient_request.rb +88 -0
  45. data/lib/mundi_api/models/create_seller_request.rb +21 -23
  46. data/lib/mundi_api/models/create_setup_request.rb +4 -6
  47. data/lib/mundi_api/models/create_shipping_request.rb +7 -9
  48. data/lib/mundi_api/models/create_split_request.rb +51 -0
  49. data/lib/mundi_api/models/create_subscription_item_request.rb +18 -11
  50. data/lib/mundi_api/models/create_subscription_request.rb +46 -30
  51. data/lib/mundi_api/models/create_token_request.rb +3 -5
  52. data/lib/mundi_api/models/create_transfer_request.rb +42 -0
  53. data/lib/mundi_api/models/create_usage_request.rb +4 -6
  54. data/lib/mundi_api/models/create_voucher_payment_request.rb +6 -8
  55. data/lib/mundi_api/models/get_access_token_response.rb +6 -8
  56. data/lib/mundi_api/models/get_address_response.rb +35 -19
  57. data/lib/mundi_api/models/get_anticipation_limit_response.rb +42 -0
  58. data/lib/mundi_api/models/get_anticipation_limits_response.rb +42 -0
  59. data/lib/mundi_api/models/get_anticipation_response.rb +117 -0
  60. data/lib/mundi_api/models/get_balance_response.rb +52 -0
  61. data/lib/mundi_api/models/get_bank_account_response.rb +161 -0
  62. data/lib/mundi_api/models/get_bank_transfer_transaction_response.rb +22 -9
  63. data/lib/mundi_api/models/get_billing_address_response.rb +29 -13
  64. data/lib/mundi_api/models/get_boleto_transaction_response.rb +96 -11
  65. data/lib/mundi_api/models/get_card_response.rb +16 -18
  66. data/lib/mundi_api/models/get_card_token_response.rb +8 -10
  67. data/lib/mundi_api/models/get_charge_response.rb +18 -20
  68. data/lib/mundi_api/models/get_checkout_boleto_payment_response.rb +43 -0
  69. data/lib/mundi_api/models/get_checkout_card_installment_options_response.rb +42 -0
  70. data/lib/mundi_api/models/get_checkout_card_payment_response.rb +49 -0
  71. data/lib/mundi_api/models/get_checkout_payment_response.rb +238 -0
  72. data/lib/mundi_api/models/get_checkout_payment_settings_response.rb +9 -11
  73. data/lib/mundi_api/models/get_credit_card_transaction_response.rb +36 -14
  74. data/lib/mundi_api/models/get_customer_response.rb +24 -17
  75. data/lib/mundi_api/models/get_device_response.rb +33 -0
  76. data/lib/mundi_api/models/get_discount_response.rb +9 -11
  77. data/lib/mundi_api/models/get_gateway_recipient_response.rb +69 -0
  78. data/lib/mundi_api/models/get_invoice_item_response.rb +27 -11
  79. data/lib/mundi_api/models/get_invoice_response.rb +29 -22
  80. data/lib/mundi_api/models/get_location_response.rb +42 -0
  81. data/lib/mundi_api/models/get_order_item_response.rb +28 -12
  82. data/lib/mundi_api/models/get_order_response.rb +64 -20
  83. data/lib/mundi_api/models/get_period_response.rb +6 -8
  84. data/lib/mundi_api/models/get_phone_response.rb +4 -6
  85. data/lib/mundi_api/models/get_phones_response.rb +3 -5
  86. data/lib/mundi_api/models/get_plan_item_response.rb +12 -14
  87. data/lib/mundi_api/models/get_plan_response.rb +22 -24
  88. data/lib/mundi_api/models/get_price_bracket_response.rb +5 -7
  89. data/lib/mundi_api/models/get_pricing_scheme_response.rb +5 -7
  90. data/lib/mundi_api/models/get_recipient_response.rb +150 -0
  91. data/lib/mundi_api/models/get_safety_pay_transaction_response.rb +21 -8
  92. data/lib/mundi_api/models/get_seller_response.rb +13 -15
  93. data/lib/mundi_api/models/get_sellers_request.rb +87 -0
  94. data/lib/mundi_api/models/get_setup_response.rb +5 -7
  95. data/lib/mundi_api/models/get_shipping_response.rb +6 -8
  96. data/lib/mundi_api/models/get_split_response.rb +52 -0
  97. data/lib/mundi_api/models/get_subscription_item_response.rb +24 -17
  98. data/lib/mundi_api/models/get_subscription_response.rb +44 -37
  99. data/lib/mundi_api/models/get_token_response.rb +6 -8
  100. data/lib/mundi_api/models/get_transaction_response.rb +37 -14
  101. data/lib/mundi_api/models/get_transfer_response.rb +89 -0
  102. data/lib/mundi_api/models/get_usage_response.rb +27 -11
  103. data/lib/mundi_api/models/get_voucher_transaction_response.rb +27 -14
  104. data/lib/mundi_api/models/list_access_tokens_response.rb +3 -5
  105. data/lib/mundi_api/models/list_addresses_response.rb +3 -5
  106. data/lib/mundi_api/models/list_anticipation_response.rb +49 -0
  107. data/lib/mundi_api/models/list_cards_response.rb +3 -5
  108. data/lib/mundi_api/models/list_charges_response.rb +3 -5
  109. data/lib/mundi_api/models/list_customers_response.rb +3 -5
  110. data/lib/mundi_api/models/list_invoices_response.rb +3 -5
  111. data/lib/mundi_api/models/list_order_response.rb +3 -5
  112. data/lib/mundi_api/models/list_plans_response.rb +3 -5
  113. data/lib/mundi_api/models/list_recipient_response.rb +49 -0
  114. data/lib/mundi_api/models/list_seller_response.rb +49 -0
  115. data/lib/mundi_api/models/list_subscription_items_response.rb +3 -5
  116. data/lib/mundi_api/models/list_subscriptions_response.rb +3 -5
  117. data/lib/mundi_api/models/list_transactions_response.rb +3 -5
  118. data/lib/mundi_api/models/list_transfer_response.rb +49 -0
  119. data/lib/mundi_api/models/list_usages_response.rb +3 -5
  120. data/lib/mundi_api/models/paging_response.rb +4 -6
  121. data/lib/mundi_api/models/update_address_request.rb +15 -8
  122. data/lib/mundi_api/models/update_card_request.rb +7 -9
  123. data/lib/mundi_api/models/update_charge_card_request.rb +5 -7
  124. data/lib/mundi_api/models/update_charge_due_date_request.rb +2 -4
  125. data/lib/mundi_api/models/update_charge_payment_method_request.rb +6 -8
  126. data/lib/mundi_api/models/update_customer_request.rb +23 -16
  127. data/lib/mundi_api/models/update_invoice_status_request.rb +33 -0
  128. data/lib/mundi_api/models/update_metadata_request.rb +2 -4
  129. data/lib/mundi_api/models/update_order_item_request.rb +60 -0
  130. data/lib/mundi_api/models/update_order_status_request.rb +33 -0
  131. data/lib/mundi_api/models/update_plan_item_request.rb +7 -9
  132. data/lib/mundi_api/models/update_plan_request.rb +16 -18
  133. data/lib/mundi_api/models/update_price_bracket_request.rb +5 -7
  134. data/lib/mundi_api/models/update_pricing_scheme_request.rb +5 -7
  135. data/lib/mundi_api/models/update_recipient_bank_account_request.rb +34 -0
  136. data/lib/mundi_api/models/update_recipient_request.rb +78 -0
  137. data/lib/mundi_api/models/update_seller_request.rb +97 -0
  138. data/lib/mundi_api/models/update_subscription_affiliation_id_request.rb +33 -0
  139. data/lib/mundi_api/models/update_subscription_billing_date_request.rb +2 -4
  140. data/lib/mundi_api/models/update_subscription_card_request.rb +3 -5
  141. data/lib/mundi_api/models/update_subscription_item_request.rb +16 -9
  142. data/lib/mundi_api/models/update_subscription_payment_method_request.rb +4 -6
  143. data/lib/mundi_api/mundi_api_client.rb +32 -20
  144. metadata +39 -3
@@ -14,6 +14,43 @@ module MundiApi
14
14
  self.class.instance
15
15
  end
16
16
 
17
+ # Adds a new item to a plan
18
+ # @param [String] plan_id Required parameter: Plan id
19
+ # @param [CreatePlanItemRequest] request Required parameter: Request for
20
+ # creating a plan item
21
+ # @return GetPlanItemResponse response from the API call
22
+ def create_plan_item(plan_id,
23
+ request)
24
+ # Prepare query url.
25
+ _query_builder = Configuration.base_uri.dup
26
+ _query_builder << '/plans/{plan_id}/items'
27
+ _query_builder = APIHelper.append_url_with_template_parameters(
28
+ _query_builder,
29
+ 'plan_id' => plan_id
30
+ )
31
+ _query_url = APIHelper.clean_url _query_builder
32
+
33
+ # Prepare headers.
34
+ _headers = {
35
+ 'accept' => 'application/json',
36
+ 'content-type' => 'application/json; charset=utf-8'
37
+ }
38
+
39
+ # Prepare and execute HttpRequest.
40
+ _request = @http_client.post(
41
+ _query_url,
42
+ headers: _headers,
43
+ parameters: request.to_json
44
+ )
45
+ BasicAuth.apply(_request)
46
+ _context = execute_request(_request)
47
+ validate_response(_context)
48
+
49
+ # Return appropriate response type.
50
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
51
+ GetPlanItemResponse.from_hash(decoded)
52
+ end
53
+
17
54
  # Updates a plan item
18
55
  # @param [String] plan_id Required parameter: Plan id
19
56
  # @param [String] plan_item_id Required parameter: Plan item id
@@ -86,16 +123,13 @@ module MundiApi
86
123
  GetPlanResponse.from_hash(decoded)
87
124
  end
88
125
 
89
- # Adds a new item to a plan
126
+ # Deletes a plan
90
127
  # @param [String] plan_id Required parameter: Plan id
91
- # @param [CreatePlanItemRequest] request Required parameter: Request for
92
- # creating a plan item
93
- # @return GetPlanItemResponse response from the API call
94
- def create_plan_item(plan_id,
95
- request)
128
+ # @return GetPlanResponse response from the API call
129
+ def delete_plan(plan_id)
96
130
  # Prepare query url.
97
131
  _query_builder = Configuration.base_uri.dup
98
- _query_builder << '/plans/{plan_id}/items'
132
+ _query_builder << '/plans/{plan_id}'
99
133
  _query_builder = APIHelper.append_url_with_template_parameters(
100
134
  _query_builder,
101
135
  'plan_id' => plan_id
@@ -104,15 +138,13 @@ module MundiApi
104
138
 
105
139
  # Prepare headers.
106
140
  _headers = {
107
- 'accept' => 'application/json',
108
- 'content-type' => 'application/json; charset=utf-8'
141
+ 'accept' => 'application/json'
109
142
  }
110
143
 
111
144
  # Prepare and execute HttpRequest.
112
- _request = @http_client.post(
145
+ _request = @http_client.delete(
113
146
  _query_url,
114
- headers: _headers,
115
- parameters: request.to_json
147
+ headers: _headers
116
148
  )
117
149
  BasicAuth.apply(_request)
118
150
  _context = execute_request(_request)
@@ -120,7 +152,7 @@ module MundiApi
120
152
 
121
153
  # Return appropriate response type.
122
154
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
123
- GetPlanItemResponse.from_hash(decoded)
155
+ GetPlanResponse.from_hash(decoded)
124
156
  end
125
157
 
126
158
  # Updates a plan
@@ -191,16 +223,40 @@ module MundiApi
191
223
  GetPlanResponse.from_hash(decoded)
192
224
  end
193
225
 
194
- # Deletes a plan
195
- # @param [String] plan_id Required parameter: Plan id
196
- # @return GetPlanResponse response from the API call
197
- def delete_plan(plan_id)
226
+ # Gets all plans
227
+ # @param [Integer] page Optional parameter: Page number
228
+ # @param [Integer] size Optional parameter: Page size
229
+ # @param [String] name Optional parameter: Filter for Plan's name
230
+ # @param [String] status Optional parameter: Filter for Plan's status
231
+ # @param [String] billing_type Optional parameter: Filter for plan's billing
232
+ # type
233
+ # @param [DateTime] created_since Optional parameter: Filter for plan's
234
+ # creation date start range
235
+ # @param [DateTime] created_until Optional parameter: Filter for plan's
236
+ # creation date end range
237
+ # @return ListPlansResponse response from the API call
238
+ def get_plans(page = nil,
239
+ size = nil,
240
+ name = nil,
241
+ status = nil,
242
+ billing_type = nil,
243
+ created_since = nil,
244
+ created_until = nil)
198
245
  # Prepare query url.
199
246
  _query_builder = Configuration.base_uri.dup
200
- _query_builder << '/plans/{plan_id}'
201
- _query_builder = APIHelper.append_url_with_template_parameters(
247
+ _query_builder << '/plans'
248
+ _query_builder = APIHelper.append_url_with_query_parameters(
202
249
  _query_builder,
203
- 'plan_id' => plan_id
250
+ {
251
+ 'page' => page,
252
+ 'size' => size,
253
+ 'name' => name,
254
+ 'status' => status,
255
+ 'billing_type' => billing_type,
256
+ 'created_since' => created_since,
257
+ 'created_until' => created_until
258
+ },
259
+ array_serialization: Configuration.array_serialization
204
260
  )
205
261
  _query_url = APIHelper.clean_url _query_builder
206
262
 
@@ -210,7 +266,7 @@ module MundiApi
210
266
  }
211
267
 
212
268
  # Prepare and execute HttpRequest.
213
- _request = @http_client.delete(
269
+ _request = @http_client.get(
214
270
  _query_url,
215
271
  headers: _headers
216
272
  )
@@ -220,34 +276,36 @@ module MundiApi
220
276
 
221
277
  # Return appropriate response type.
222
278
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
223
- GetPlanResponse.from_hash(decoded)
279
+ ListPlansResponse.from_hash(decoded)
224
280
  end
225
281
 
226
- # Gets a plan item
227
- # @param [String] plan_id Required parameter: Plan id
228
- # @param [String] plan_item_id Required parameter: Plan item id
229
- # @return GetPlanItemResponse response from the API call
230
- def get_plan_item(plan_id,
231
- plan_item_id)
282
+ # Updates the metadata from a plan
283
+ # @param [String] plan_id Required parameter: The plan id
284
+ # @param [UpdateMetadataRequest] request Required parameter: Request for
285
+ # updating the plan metadata
286
+ # @return GetPlanResponse response from the API call
287
+ def update_plan_metadata(plan_id,
288
+ request)
232
289
  # Prepare query url.
233
290
  _query_builder = Configuration.base_uri.dup
234
- _query_builder << '/plans/{plan_id}/items/{plan_item_id}'
291
+ _query_builder << '/Plans/{plan_id}/metadata'
235
292
  _query_builder = APIHelper.append_url_with_template_parameters(
236
293
  _query_builder,
237
- 'plan_id' => plan_id,
238
- 'plan_item_id' => plan_item_id
294
+ 'plan_id' => plan_id
239
295
  )
240
296
  _query_url = APIHelper.clean_url _query_builder
241
297
 
242
298
  # Prepare headers.
243
299
  _headers = {
244
- 'accept' => 'application/json'
300
+ 'accept' => 'application/json',
301
+ 'content-type' => 'application/json; charset=utf-8'
245
302
  }
246
303
 
247
304
  # Prepare and execute HttpRequest.
248
- _request = @http_client.get(
305
+ _request = @http_client.patch(
249
306
  _query_url,
250
- headers: _headers
307
+ headers: _headers,
308
+ parameters: request.to_json
251
309
  )
252
310
  BasicAuth.apply(_request)
253
311
  _context = execute_request(_request)
@@ -255,15 +313,15 @@ module MundiApi
255
313
 
256
314
  # Return appropriate response type.
257
315
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
258
- GetPlanItemResponse.from_hash(decoded)
316
+ GetPlanResponse.from_hash(decoded)
259
317
  end
260
318
 
261
- # Removes an item from a plan
319
+ # Gets a plan item
262
320
  # @param [String] plan_id Required parameter: Plan id
263
321
  # @param [String] plan_item_id Required parameter: Plan item id
264
322
  # @return GetPlanItemResponse response from the API call
265
- def delete_plan_item(plan_id,
266
- plan_item_id)
323
+ def get_plan_item(plan_id,
324
+ plan_item_id)
267
325
  # Prepare query url.
268
326
  _query_builder = Configuration.base_uri.dup
269
327
  _query_builder << '/plans/{plan_id}/items/{plan_item_id}'
@@ -280,7 +338,7 @@ module MundiApi
280
338
  }
281
339
 
282
340
  # Prepare and execute HttpRequest.
283
- _request = @http_client.delete(
341
+ _request = @http_client.get(
284
342
  _query_url,
285
343
  headers: _headers
286
344
  )
@@ -293,75 +351,19 @@ module MundiApi
293
351
  GetPlanItemResponse.from_hash(decoded)
294
352
  end
295
353
 
296
- # Updates the metadata from a plan
297
- # @param [String] plan_id Required parameter: The plan id
298
- # @param [UpdateMetadataRequest] request Required parameter: Request for
299
- # updating the plan metadata
300
- # @return GetPlanResponse response from the API call
301
- def update_plan_metadata(plan_id,
302
- request)
354
+ # Removes an item from a plan
355
+ # @param [String] plan_id Required parameter: Plan id
356
+ # @param [String] plan_item_id Required parameter: Plan item id
357
+ # @return GetPlanItemResponse response from the API call
358
+ def delete_plan_item(plan_id,
359
+ plan_item_id)
303
360
  # Prepare query url.
304
361
  _query_builder = Configuration.base_uri.dup
305
- _query_builder << '/Plans/{plan_id}/metadata'
362
+ _query_builder << '/plans/{plan_id}/items/{plan_item_id}'
306
363
  _query_builder = APIHelper.append_url_with_template_parameters(
307
364
  _query_builder,
308
- 'plan_id' => plan_id
309
- )
310
- _query_url = APIHelper.clean_url _query_builder
311
-
312
- # Prepare headers.
313
- _headers = {
314
- 'accept' => 'application/json',
315
- 'content-type' => 'application/json; charset=utf-8'
316
- }
317
-
318
- # Prepare and execute HttpRequest.
319
- _request = @http_client.patch(
320
- _query_url,
321
- headers: _headers,
322
- parameters: request.to_json
323
- )
324
- BasicAuth.apply(_request)
325
- _context = execute_request(_request)
326
- validate_response(_context)
327
-
328
- # Return appropriate response type.
329
- decoded = APIHelper.json_deserialize(_context.response.raw_body)
330
- GetPlanResponse.from_hash(decoded)
331
- end
332
-
333
- # Gets all plans
334
- # @param [Integer] page Optional parameter: Page number
335
- # @param [Integer] size Optional parameter: Page size
336
- # @param [String] name Optional parameter: Filter for Plan's name
337
- # @param [String] status Optional parameter: Filter for Plan's status
338
- # @param [String] billing_type Optional parameter: Filter for plan's billing
339
- # type
340
- # @param [DateTime] created_since Optional parameter: Filter for plan's
341
- # creation date start range
342
- # @param [DateTime] created_until Optional parameter: Filter for plan's
343
- # creation date end range
344
- # @return ListPlansResponse response from the API call
345
- def get_plans(page = nil,
346
- size = nil,
347
- name = nil,
348
- status = nil,
349
- billing_type = nil,
350
- created_since = nil,
351
- created_until = nil)
352
- # Prepare query url.
353
- _query_builder = Configuration.base_uri.dup
354
- _query_builder << '/plans'
355
- _query_builder = APIHelper.append_url_with_query_parameters(
356
- _query_builder,
357
- 'page' => page,
358
- 'size' => size,
359
- 'name' => name,
360
- 'status' => status,
361
- 'billing_type' => billing_type,
362
- 'created_since' => created_since,
363
- 'created_until' => created_until,
364
- array_serialization: Configuration.array_serialization
365
+ 'plan_id' => plan_id,
366
+ 'plan_item_id' => plan_item_id
365
367
  )
366
368
  _query_url = APIHelper.clean_url _query_builder
367
369
 
@@ -371,7 +373,7 @@ module MundiApi
371
373
  }
372
374
 
373
375
  # Prepare and execute HttpRequest.
374
- _request = @http_client.get(
376
+ _request = @http_client.delete(
375
377
  _query_url,
376
378
  headers: _headers
377
379
  )
@@ -381,7 +383,7 @@ module MundiApi
381
383
 
382
384
  # Return appropriate response type.
383
385
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
384
- ListPlansResponse.from_hash(decoded)
386
+ GetPlanItemResponse.from_hash(decoded)
385
387
  end
386
388
  end
387
389
  end
@@ -0,0 +1,571 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # RecipientsController
6
+ class RecipientsController < BaseController
7
+ @instance = RecipientsController.new
8
+
9
+ class << self
10
+ attr_accessor :instance
11
+ end
12
+
13
+ def instance
14
+ self.class.instance
15
+ end
16
+
17
+ # Updates recipient metadata
18
+ # @param [String] recipient_id Required parameter: Recipient id
19
+ # @param [UpdateMetadataRequest] request Required parameter: Metadata
20
+ # @return GetRecipientResponse response from the API call
21
+ def update_recipient_metadata(recipient_id,
22
+ request)
23
+ # Prepare query url.
24
+ _query_builder = Configuration.base_uri.dup
25
+ _query_builder << '/recipients/{recipient_id}/metadata'
26
+ _query_builder = APIHelper.append_url_with_template_parameters(
27
+ _query_builder,
28
+ 'recipient_id' => recipient_id
29
+ )
30
+ _query_url = APIHelper.clean_url _query_builder
31
+
32
+ # Prepare headers.
33
+ _headers = {
34
+ 'accept' => 'application/json',
35
+ 'content-type' => 'application/json; charset=utf-8'
36
+ }
37
+
38
+ # Prepare and execute HttpRequest.
39
+ _request = @http_client.patch(
40
+ _query_url,
41
+ headers: _headers,
42
+ parameters: request.to_json
43
+ )
44
+ BasicAuth.apply(_request)
45
+ _context = execute_request(_request)
46
+ validate_response(_context)
47
+
48
+ # Return appropriate response type.
49
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
50
+ GetRecipientResponse.from_hash(decoded)
51
+ end
52
+
53
+ # Gets a transfer
54
+ # @param [String] recipient_id Required parameter: Recipient id
55
+ # @param [String] transfer_id Required parameter: Transfer id
56
+ # @return GetTransferResponse response from the API call
57
+ def get_transfer(recipient_id,
58
+ transfer_id)
59
+ # Prepare query url.
60
+ _query_builder = Configuration.base_uri.dup
61
+ _query_builder << '/recipients/{recipient_id}/transfers/{transfer_id}'
62
+ _query_builder = APIHelper.append_url_with_template_parameters(
63
+ _query_builder,
64
+ 'recipient_id' => recipient_id,
65
+ 'transfer_id' => transfer_id
66
+ )
67
+ _query_url = APIHelper.clean_url _query_builder
68
+
69
+ # Prepare headers.
70
+ _headers = {
71
+ 'accept' => 'application/json'
72
+ }
73
+
74
+ # Prepare and execute HttpRequest.
75
+ _request = @http_client.get(
76
+ _query_url,
77
+ headers: _headers
78
+ )
79
+ BasicAuth.apply(_request)
80
+ _context = execute_request(_request)
81
+ validate_response(_context)
82
+
83
+ # Return appropriate response type.
84
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
85
+ GetTransferResponse.from_hash(decoded)
86
+ end
87
+
88
+ # Gets a paginated list of transfers for the recipient
89
+ # @param [String] recipient_id Required parameter: Recipient id
90
+ # @param [Integer] page Optional parameter: Page number
91
+ # @param [Integer] size Optional parameter: Page size
92
+ # @param [String] status Optional parameter: Filter for transfer status
93
+ # @param [DateTime] created_since Optional parameter: Filter for start range
94
+ # of transfer creation date
95
+ # @param [DateTime] created_until Optional parameter: Filter for end range
96
+ # of transfer creation date
97
+ # @return ListTransferResponse response from the API call
98
+ def get_transfers(recipient_id,
99
+ page = nil,
100
+ size = nil,
101
+ status = nil,
102
+ created_since = nil,
103
+ created_until = nil)
104
+ # Prepare query url.
105
+ _query_builder = Configuration.base_uri.dup
106
+ _query_builder << '/recipients/{recipient_id}/transfers'
107
+ _query_builder = APIHelper.append_url_with_template_parameters(
108
+ _query_builder,
109
+ 'recipient_id' => recipient_id
110
+ )
111
+ _query_builder = APIHelper.append_url_with_query_parameters(
112
+ _query_builder,
113
+ {
114
+ 'page' => page,
115
+ 'size' => size,
116
+ 'status' => status,
117
+ 'created_since' => created_since,
118
+ 'created_until' => created_until
119
+ },
120
+ array_serialization: Configuration.array_serialization
121
+ )
122
+ _query_url = APIHelper.clean_url _query_builder
123
+
124
+ # Prepare headers.
125
+ _headers = {
126
+ 'accept' => 'application/json'
127
+ }
128
+
129
+ # Prepare and execute HttpRequest.
130
+ _request = @http_client.get(
131
+ _query_url,
132
+ headers: _headers
133
+ )
134
+ BasicAuth.apply(_request)
135
+ _context = execute_request(_request)
136
+ validate_response(_context)
137
+
138
+ # Return appropriate response type.
139
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
140
+ ListTransferResponse.from_hash(decoded)
141
+ end
142
+
143
+ # Creates an anticipation
144
+ # @param [String] recipient_id Required parameter: Recipient id
145
+ # @param [CreateAnticipationRequest] request Required parameter:
146
+ # Anticipation data
147
+ # @return GetAnticipationResponse response from the API call
148
+ def create_anticipation(recipient_id,
149
+ request)
150
+ # Prepare query url.
151
+ _query_builder = Configuration.base_uri.dup
152
+ _query_builder << '/recipients/{recipient_id}/anticipations'
153
+ _query_builder = APIHelper.append_url_with_template_parameters(
154
+ _query_builder,
155
+ 'recipient_id' => recipient_id
156
+ )
157
+ _query_url = APIHelper.clean_url _query_builder
158
+
159
+ # Prepare headers.
160
+ _headers = {
161
+ 'accept' => 'application/json',
162
+ 'content-type' => 'application/json; charset=utf-8'
163
+ }
164
+
165
+ # Prepare and execute HttpRequest.
166
+ _request = @http_client.post(
167
+ _query_url,
168
+ headers: _headers,
169
+ parameters: request.to_json
170
+ )
171
+ BasicAuth.apply(_request)
172
+ _context = execute_request(_request)
173
+ validate_response(_context)
174
+
175
+ # Return appropriate response type.
176
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
177
+ GetAnticipationResponse.from_hash(decoded)
178
+ end
179
+
180
+ # Gets an anticipation
181
+ # @param [String] recipient_id Required parameter: Recipient id
182
+ # @param [String] anticipation_id Required parameter: Anticipation id
183
+ # @return GetAnticipationResponse response from the API call
184
+ def get_anticipation(recipient_id,
185
+ anticipation_id)
186
+ # Prepare query url.
187
+ _query_builder = Configuration.base_uri.dup
188
+ _query_builder << '/recipients/{recipient_id}/anticipations/{anticipation_id}'
189
+ _query_builder = APIHelper.append_url_with_template_parameters(
190
+ _query_builder,
191
+ 'recipient_id' => recipient_id,
192
+ 'anticipation_id' => anticipation_id
193
+ )
194
+ _query_url = APIHelper.clean_url _query_builder
195
+
196
+ # Prepare headers.
197
+ _headers = {
198
+ 'accept' => 'application/json'
199
+ }
200
+
201
+ # Prepare and execute HttpRequest.
202
+ _request = @http_client.get(
203
+ _query_url,
204
+ headers: _headers
205
+ )
206
+ BasicAuth.apply(_request)
207
+ _context = execute_request(_request)
208
+ validate_response(_context)
209
+
210
+ # Return appropriate response type.
211
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
212
+ GetAnticipationResponse.from_hash(decoded)
213
+ end
214
+
215
+ # Gets the anticipation limits for a recipient
216
+ # @param [String] recipient_id Required parameter: Recipient id
217
+ # @param [String] timeframe Required parameter: Timeframe
218
+ # @param [DateTime] payment_date Required parameter: Anticipation payment
219
+ # date
220
+ # @return GetAnticipationLimitResponse response from the API call
221
+ def get_anticipation_limits(recipient_id,
222
+ timeframe,
223
+ payment_date)
224
+ # Prepare query url.
225
+ _query_builder = Configuration.base_uri.dup
226
+ _query_builder << '/recipients/{recipient_id}/anticipation_limits'
227
+ _query_builder = APIHelper.append_url_with_template_parameters(
228
+ _query_builder,
229
+ 'recipient_id' => recipient_id
230
+ )
231
+ _query_builder = APIHelper.append_url_with_query_parameters(
232
+ _query_builder,
233
+ {
234
+ 'timeframe' => timeframe,
235
+ 'payment_date' => payment_date
236
+ },
237
+ array_serialization: Configuration.array_serialization
238
+ )
239
+ _query_url = APIHelper.clean_url _query_builder
240
+
241
+ # Prepare headers.
242
+ _headers = {
243
+ 'accept' => 'application/json'
244
+ }
245
+
246
+ # Prepare and execute HttpRequest.
247
+ _request = @http_client.get(
248
+ _query_url,
249
+ headers: _headers
250
+ )
251
+ BasicAuth.apply(_request)
252
+ _context = execute_request(_request)
253
+ validate_response(_context)
254
+
255
+ # Return appropriate response type.
256
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
257
+ GetAnticipationLimitResponse.from_hash(decoded)
258
+ end
259
+
260
+ # Retrieves a paginated list of anticipations from a recipient
261
+ # @param [String] recipient_id Required parameter: Recipient id
262
+ # @param [Integer] page Optional parameter: Page number
263
+ # @param [Integer] size Optional parameter: Page size
264
+ # @param [String] status Optional parameter: Filter for anticipation
265
+ # status
266
+ # @param [String] timeframe Optional parameter: Filter for anticipation
267
+ # timeframe
268
+ # @param [DateTime] payment_date_since Optional parameter: Filter for start
269
+ # range for anticipation payment date
270
+ # @param [DateTime] payment_date_until Optional parameter: Filter for end
271
+ # range for anticipation payment date
272
+ # @param [DateTime] created_since Optional parameter: Filter for start range
273
+ # for anticipation creation date
274
+ # @param [DateTime] created_until Optional parameter: Filter for end range
275
+ # for anticipation creation date
276
+ # @return ListAnticipationResponse response from the API call
277
+ def get_anticipations(recipient_id,
278
+ page = nil,
279
+ size = nil,
280
+ status = nil,
281
+ timeframe = nil,
282
+ payment_date_since = nil,
283
+ payment_date_until = nil,
284
+ created_since = nil,
285
+ created_until = nil)
286
+ # Prepare query url.
287
+ _query_builder = Configuration.base_uri.dup
288
+ _query_builder << '/recipients/{recipient_id}/anticipations'
289
+ _query_builder = APIHelper.append_url_with_template_parameters(
290
+ _query_builder,
291
+ 'recipient_id' => recipient_id
292
+ )
293
+ _query_builder = APIHelper.append_url_with_query_parameters(
294
+ _query_builder,
295
+ {
296
+ 'page' => page,
297
+ 'size' => size,
298
+ 'status' => status,
299
+ 'timeframe' => timeframe,
300
+ 'payment_date_since' => payment_date_since,
301
+ 'payment_date_until' => payment_date_until,
302
+ 'created_since' => created_since,
303
+ 'created_until' => created_until
304
+ },
305
+ array_serialization: Configuration.array_serialization
306
+ )
307
+ _query_url = APIHelper.clean_url _query_builder
308
+
309
+ # Prepare headers.
310
+ _headers = {
311
+ 'accept' => 'application/json'
312
+ }
313
+
314
+ # Prepare and execute HttpRequest.
315
+ _request = @http_client.get(
316
+ _query_url,
317
+ headers: _headers
318
+ )
319
+ BasicAuth.apply(_request)
320
+ _context = execute_request(_request)
321
+ validate_response(_context)
322
+
323
+ # Return appropriate response type.
324
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
325
+ ListAnticipationResponse.from_hash(decoded)
326
+ end
327
+
328
+ # Updates a recipient
329
+ # @param [String] recipient_id Required parameter: Recipient id
330
+ # @param [UpdateRecipientRequest] request Required parameter: Recipient
331
+ # data
332
+ # @return GetRecipientResponse response from the API call
333
+ def update_recipient(recipient_id,
334
+ request)
335
+ # Prepare query url.
336
+ _query_builder = Configuration.base_uri.dup
337
+ _query_builder << '/recipients/{recipient_id}'
338
+ _query_builder = APIHelper.append_url_with_template_parameters(
339
+ _query_builder,
340
+ 'recipient_id' => recipient_id
341
+ )
342
+ _query_url = APIHelper.clean_url _query_builder
343
+
344
+ # Prepare headers.
345
+ _headers = {
346
+ 'accept' => 'application/json',
347
+ 'content-type' => 'application/json; charset=utf-8'
348
+ }
349
+
350
+ # Prepare and execute HttpRequest.
351
+ _request = @http_client.put(
352
+ _query_url,
353
+ headers: _headers,
354
+ parameters: request.to_json
355
+ )
356
+ BasicAuth.apply(_request)
357
+ _context = execute_request(_request)
358
+ validate_response(_context)
359
+
360
+ # Return appropriate response type.
361
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
362
+ GetRecipientResponse.from_hash(decoded)
363
+ end
364
+
365
+ # Updates the default bank account from a recipient
366
+ # @param [String] recipient_id Required parameter: Recipient id
367
+ # @param [UpdateRecipientBankAccountRequest] request Required parameter:
368
+ # Bank account data
369
+ # @return GetRecipientResponse response from the API call
370
+ def update_recipient_default_bank_account(recipient_id,
371
+ request)
372
+ # Prepare query url.
373
+ _query_builder = Configuration.base_uri.dup
374
+ _query_builder << '/recipients/{recipient_id}/default-bank-account'
375
+ _query_builder = APIHelper.append_url_with_template_parameters(
376
+ _query_builder,
377
+ 'recipient_id' => recipient_id
378
+ )
379
+ _query_url = APIHelper.clean_url _query_builder
380
+
381
+ # Prepare headers.
382
+ _headers = {
383
+ 'accept' => 'application/json',
384
+ 'content-type' => 'application/json; charset=utf-8'
385
+ }
386
+
387
+ # Prepare and execute HttpRequest.
388
+ _request = @http_client.patch(
389
+ _query_url,
390
+ headers: _headers,
391
+ parameters: request.to_json
392
+ )
393
+ BasicAuth.apply(_request)
394
+ _context = execute_request(_request)
395
+ validate_response(_context)
396
+
397
+ # Return appropriate response type.
398
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
399
+ GetRecipientResponse.from_hash(decoded)
400
+ end
401
+
402
+ # Retrieves recipient information
403
+ # @param [String] recipient_id Required parameter: Recipiend id
404
+ # @return GetRecipientResponse response from the API call
405
+ def get_recipient(recipient_id)
406
+ # Prepare query url.
407
+ _query_builder = Configuration.base_uri.dup
408
+ _query_builder << '/recipients/{recipient_id}'
409
+ _query_builder = APIHelper.append_url_with_template_parameters(
410
+ _query_builder,
411
+ 'recipient_id' => recipient_id
412
+ )
413
+ _query_url = APIHelper.clean_url _query_builder
414
+
415
+ # Prepare headers.
416
+ _headers = {
417
+ 'accept' => 'application/json'
418
+ }
419
+
420
+ # Prepare and execute HttpRequest.
421
+ _request = @http_client.get(
422
+ _query_url,
423
+ headers: _headers
424
+ )
425
+ BasicAuth.apply(_request)
426
+ _context = execute_request(_request)
427
+ validate_response(_context)
428
+
429
+ # Return appropriate response type.
430
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
431
+ GetRecipientResponse.from_hash(decoded)
432
+ end
433
+
434
+ # Retrieves paginated recipients information
435
+ # @param [Integer] page Optional parameter: Page number
436
+ # @param [Integer] size Optional parameter: Page size
437
+ # @return ListRecipientResponse response from the API call
438
+ def get_recipients(page = nil,
439
+ size = nil)
440
+ # Prepare query url.
441
+ _query_builder = Configuration.base_uri.dup
442
+ _query_builder << '/recipients'
443
+ _query_builder = APIHelper.append_url_with_query_parameters(
444
+ _query_builder,
445
+ {
446
+ 'page' => page,
447
+ 'size' => size
448
+ },
449
+ array_serialization: Configuration.array_serialization
450
+ )
451
+ _query_url = APIHelper.clean_url _query_builder
452
+
453
+ # Prepare headers.
454
+ _headers = {
455
+ 'accept' => 'application/json'
456
+ }
457
+
458
+ # Prepare and execute HttpRequest.
459
+ _request = @http_client.get(
460
+ _query_url,
461
+ headers: _headers
462
+ )
463
+ BasicAuth.apply(_request)
464
+ _context = execute_request(_request)
465
+ validate_response(_context)
466
+
467
+ # Return appropriate response type.
468
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
469
+ ListRecipientResponse.from_hash(decoded)
470
+ end
471
+
472
+ # Get balance information for a recipient
473
+ # @param [String] recipient_id Required parameter: Recipient id
474
+ # @return GetBalanceResponse response from the API call
475
+ def get_balance(recipient_id)
476
+ # Prepare query url.
477
+ _query_builder = Configuration.base_uri.dup
478
+ _query_builder << '/recipients/{recipient_id}/balance'
479
+ _query_builder = APIHelper.append_url_with_template_parameters(
480
+ _query_builder,
481
+ 'recipient_id' => recipient_id
482
+ )
483
+ _query_url = APIHelper.clean_url _query_builder
484
+
485
+ # Prepare headers.
486
+ _headers = {
487
+ 'accept' => 'application/json'
488
+ }
489
+
490
+ # Prepare and execute HttpRequest.
491
+ _request = @http_client.get(
492
+ _query_url,
493
+ headers: _headers
494
+ )
495
+ BasicAuth.apply(_request)
496
+ _context = execute_request(_request)
497
+ validate_response(_context)
498
+
499
+ # Return appropriate response type.
500
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
501
+ GetBalanceResponse.from_hash(decoded)
502
+ end
503
+
504
+ # Creates a transfer for a recipient
505
+ # @param [String] recipient_id Required parameter: Recipient Id
506
+ # @param [CreateTransferRequest] request Required parameter: Transfer data
507
+ # @return GetTransferResponse response from the API call
508
+ def create_transfer(recipient_id,
509
+ request)
510
+ # Prepare query url.
511
+ _query_builder = Configuration.base_uri.dup
512
+ _query_builder << '/recipients/{recipient_id}/transfers'
513
+ _query_builder = APIHelper.append_url_with_template_parameters(
514
+ _query_builder,
515
+ 'recipient_id' => recipient_id
516
+ )
517
+ _query_url = APIHelper.clean_url _query_builder
518
+
519
+ # Prepare headers.
520
+ _headers = {
521
+ 'accept' => 'application/json',
522
+ 'content-type' => 'application/json; charset=utf-8'
523
+ }
524
+
525
+ # Prepare and execute HttpRequest.
526
+ _request = @http_client.post(
527
+ _query_url,
528
+ headers: _headers,
529
+ parameters: request.to_json
530
+ )
531
+ BasicAuth.apply(_request)
532
+ _context = execute_request(_request)
533
+ validate_response(_context)
534
+
535
+ # Return appropriate response type.
536
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
537
+ GetTransferResponse.from_hash(decoded)
538
+ end
539
+
540
+ # Creates a new recipient
541
+ # @param [CreateRecipientRequest] request Required parameter: Recipient
542
+ # data
543
+ # @return GetRecipientResponse response from the API call
544
+ def create_recipient(request)
545
+ # Prepare query url.
546
+ _query_builder = Configuration.base_uri.dup
547
+ _query_builder << '/recipients'
548
+ _query_url = APIHelper.clean_url _query_builder
549
+
550
+ # Prepare headers.
551
+ _headers = {
552
+ 'accept' => 'application/json',
553
+ 'content-type' => 'application/json; charset=utf-8'
554
+ }
555
+
556
+ # Prepare and execute HttpRequest.
557
+ _request = @http_client.post(
558
+ _query_url,
559
+ headers: _headers,
560
+ parameters: request.to_json
561
+ )
562
+ BasicAuth.apply(_request)
563
+ _context = execute_request(_request)
564
+ validate_response(_context)
565
+
566
+ # Return appropriate response type.
567
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
568
+ GetRecipientResponse.from_hash(decoded)
569
+ end
570
+ end
571
+ end