univapay-client-sdk 1.0.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 (241) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +212 -0
  4. data/bin/console +15 -0
  5. data/lib/univapay_client_sdk/api_helper.rb +10 -0
  6. data/lib/univapay_client_sdk/apis/base_api.rb +67 -0
  7. data/lib/univapay_client_sdk/apis/cancels_api.rb +293 -0
  8. data/lib/univapay_client_sdk/apis/charges_api.rb +909 -0
  9. data/lib/univapay_client_sdk/apis/merchants_api.rb +57 -0
  10. data/lib/univapay_client_sdk/apis/refunds_api.rb +298 -0
  11. data/lib/univapay_client_sdk/apis/stores_api.rb +126 -0
  12. data/lib/univapay_client_sdk/apis/subscriptions_api.rb +1014 -0
  13. data/lib/univapay_client_sdk/apis/transaction_tokens_api.rb +455 -0
  14. data/lib/univapay_client_sdk/apis/webhooks_api.rb +463 -0
  15. data/lib/univapay_client_sdk/client.rb +128 -0
  16. data/lib/univapay_client_sdk/configuration.rb +179 -0
  17. data/lib/univapay_client_sdk/events/unknown_event.rb +32 -0
  18. data/lib/univapay_client_sdk/events/webhooks/bank_transfer_handler.rb +37 -0
  19. data/lib/univapay_client_sdk/events/webhooks/cancel_handler.rb +37 -0
  20. data/lib/univapay_client_sdk/events/webhooks/charge_handler.rb +37 -0
  21. data/lib/univapay_client_sdk/events/webhooks/customs_handler.rb +37 -0
  22. data/lib/univapay_client_sdk/events/webhooks/refund_handler.rb +37 -0
  23. data/lib/univapay_client_sdk/events/webhooks/subscription_handler.rb +37 -0
  24. data/lib/univapay_client_sdk/events/webhooks/token_handler.rb +37 -0
  25. data/lib/univapay_client_sdk/exceptions/api_error_exception.rb +199 -0
  26. data/lib/univapay_client_sdk/exceptions/api_exception.rb +21 -0
  27. data/lib/univapay_client_sdk/extensions.rb +127 -0
  28. data/lib/univapay_client_sdk/http/api_response.rb +19 -0
  29. data/lib/univapay_client_sdk/http/auth/oauth_2.rb +58 -0
  30. data/lib/univapay_client_sdk/http/http_call_back.rb +10 -0
  31. data/lib/univapay_client_sdk/http/http_method_enum.rb +10 -0
  32. data/lib/univapay_client_sdk/http/http_request.rb +10 -0
  33. data/lib/univapay_client_sdk/http/http_response.rb +10 -0
  34. data/lib/univapay_client_sdk/http/proxy_settings.rb +22 -0
  35. data/lib/univapay_client_sdk/logging/configuration/api_logging_configuration.rb +186 -0
  36. data/lib/univapay_client_sdk/logging/sdk_logger.rb +17 -0
  37. data/lib/univapay_client_sdk/models/api_error_detail.rb +87 -0
  38. data/lib/univapay_client_sdk/models/api_error_status.rb +26 -0
  39. data/lib/univapay_client_sdk/models/bank_transfer_event.rb +27 -0
  40. data/lib/univapay_client_sdk/models/bank_transfer_ledger.rb +199 -0
  41. data/lib/univapay_client_sdk/models/bank_transfer_ledger_bank_ledger_type.rb +36 -0
  42. data/lib/univapay_client_sdk/models/bank_transfer_ledger_list.rb +104 -0
  43. data/lib/univapay_client_sdk/models/bank_transfer_ledger_mode.rb +36 -0
  44. data/lib/univapay_client_sdk/models/bank_transfer_payment_status.rb +44 -0
  45. data/lib/univapay_client_sdk/models/bank_transfer_status_data.rb +229 -0
  46. data/lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb +134 -0
  47. data/lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback_extension.rb +75 -0
  48. data/lib/univapay_client_sdk/models/base_bank_transfer_data.rb +100 -0
  49. data/lib/univapay_client_sdk/models/base_konbini_data.rb +99 -0
  50. data/lib/univapay_client_sdk/models/base_konbini_data_convenience_store.rb +60 -0
  51. data/lib/univapay_client_sdk/models/base_model.rb +110 -0
  52. data/lib/univapay_client_sdk/models/base_online_data.rb +123 -0
  53. data/lib/univapay_client_sdk/models/base_online_data_brand.rb +48 -0
  54. data/lib/univapay_client_sdk/models/base_online_data_call_method.rb +52 -0
  55. data/lib/univapay_client_sdk/models/base_online_data_os_type.rb +36 -0
  56. data/lib/univapay_client_sdk/models/base_online_data_user_identifier_source.rb +36 -0
  57. data/lib/univapay_client_sdk/models/cancel.rb +183 -0
  58. data/lib/univapay_client_sdk/models/cancel_create_request.rb +77 -0
  59. data/lib/univapay_client_sdk/models/cancel_event.rb +26 -0
  60. data/lib/univapay_client_sdk/models/cancel_list.rb +94 -0
  61. data/lib/univapay_client_sdk/models/cancel_status.rb +44 -0
  62. data/lib/univapay_client_sdk/models/cancel_update_request.rb +76 -0
  63. data/lib/univapay_client_sdk/models/cancel_webhook_callback.rb +132 -0
  64. data/lib/univapay_client_sdk/models/cancel_webhook_callback_extension.rb +74 -0
  65. data/lib/univapay_client_sdk/models/card_processor_installment_config.rb +89 -0
  66. data/lib/univapay_client_sdk/models/charge.rb +411 -0
  67. data/lib/univapay_client_sdk/models/charge_capture_request.rb +84 -0
  68. data/lib/univapay_client_sdk/models/charge_create_request.rb +179 -0
  69. data/lib/univapay_client_sdk/models/charge_create_request_client_metadata.rb +76 -0
  70. data/lib/univapay_client_sdk/models/charge_create_request_redirect.rb +75 -0
  71. data/lib/univapay_client_sdk/models/charge_create_request_three_ds.rb +88 -0
  72. data/lib/univapay_client_sdk/models/charge_create_request_three_ds_mode.rb +44 -0
  73. data/lib/univapay_client_sdk/models/charge_event.rb +36 -0
  74. data/lib/univapay_client_sdk/models/charge_list.rb +104 -0
  75. data/lib/univapay_client_sdk/models/charge_mode.rb +36 -0
  76. data/lib/univapay_client_sdk/models/charge_redirect.rb +96 -0
  77. data/lib/univapay_client_sdk/models/charge_status.rb +56 -0
  78. data/lib/univapay_client_sdk/models/charge_three_ds.rb +97 -0
  79. data/lib/univapay_client_sdk/models/charge_transaction_token_type.rb +40 -0
  80. data/lib/univapay_client_sdk/models/charge_update_request.rb +75 -0
  81. data/lib/univapay_client_sdk/models/charge_webhook_event.rb +138 -0
  82. data/lib/univapay_client_sdk/models/cursor_direction_query.rb +36 -0
  83. data/lib/univapay_client_sdk/models/customs_declaration_create_request.rb +106 -0
  84. data/lib/univapay_client_sdk/models/customs_declaration_event.rb +27 -0
  85. data/lib/univapay_client_sdk/models/customs_declaration_patch_request.rb +77 -0
  86. data/lib/univapay_client_sdk/models/customs_declaration_webhook_callback.rb +135 -0
  87. data/lib/univapay_client_sdk/models/customs_declaration_webhook_callback_extension.rb +76 -0
  88. data/lib/univapay_client_sdk/models/customs_declaration_webhook_data.rb +232 -0
  89. data/lib/univapay_client_sdk/models/customs_declaration_webhook_declaration.rb +121 -0
  90. data/lib/univapay_client_sdk/models/customs_declaration_webhook_error.rb +127 -0
  91. data/lib/univapay_client_sdk/models/customs_declaration_webhook_other_error.rb +120 -0
  92. data/lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb +125 -0
  93. data/lib/univapay_client_sdk/models/customs_declaration_webhook_status.rb +44 -0
  94. data/lib/univapay_client_sdk/models/generic_metadata.rb +111 -0
  95. data/lib/univapay_client_sdk/models/installment_fixed_cycles.rb +70 -0
  96. data/lib/univapay_client_sdk/models/installment_plan_type.rb +36 -0
  97. data/lib/univapay_client_sdk/models/issuer_token.rb +177 -0
  98. data/lib/univapay_client_sdk/models/issuer_token_call_method.rb +51 -0
  99. data/lib/univapay_client_sdk/models/issuer_token_payload.rb +105 -0
  100. data/lib/univapay_client_sdk/models/issuer_token_payment_type.rb +36 -0
  101. data/lib/univapay_client_sdk/models/merchant.rb +179 -0
  102. data/lib/univapay_client_sdk/models/merchant_webhook_bank_transfer_configuration.rb +342 -0
  103. data/lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb +167 -0
  104. data/lib/univapay_client_sdk/models/merchant_webhook_card_configuration.rb +301 -0
  105. data/lib/univapay_client_sdk/models/merchant_webhook_checkout_configuration.rb +87 -0
  106. data/lib/univapay_client_sdk/models/merchant_webhook_checkout_toggle.rb +77 -0
  107. data/lib/univapay_client_sdk/models/merchant_webhook_configuration.rb +505 -0
  108. data/lib/univapay_client_sdk/models/merchant_webhook_convenience_configuration.rb +88 -0
  109. data/lib/univapay_client_sdk/models/merchant_webhook_customer_management_configuration.rb +99 -0
  110. data/lib/univapay_client_sdk/models/merchant_webhook_installment_plan_configuration.rb +139 -0
  111. data/lib/univapay_client_sdk/models/merchant_webhook_limit_charge_by_card_configuration.rb +88 -0
  112. data/lib/univapay_client_sdk/models/merchant_webhook_limit_refund_by_sales_configuration.rb +100 -0
  113. data/lib/univapay_client_sdk/models/merchant_webhook_money_amount.rb +85 -0
  114. data/lib/univapay_client_sdk/models/merchant_webhook_online_configuration.rb +77 -0
  115. data/lib/univapay_client_sdk/models/merchant_webhook_paidy_configuration.rb +77 -0
  116. data/lib/univapay_client_sdk/models/merchant_webhook_qr_merchant_configuration.rb +77 -0
  117. data/lib/univapay_client_sdk/models/merchant_webhook_qr_scan_configuration.rb +93 -0
  118. data/lib/univapay_client_sdk/models/merchant_webhook_recurring_cvv_confirmation_config.rb +97 -0
  119. data/lib/univapay_client_sdk/models/merchant_webhook_recurring_token_configuration.rb +109 -0
  120. data/lib/univapay_client_sdk/models/merchant_webhook_security_configuration.rb +234 -0
  121. data/lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb +138 -0
  122. data/lib/univapay_client_sdk/models/merchant_webhook_subscription_plan_configuration.rb +138 -0
  123. data/lib/univapay_client_sdk/models/merchant_webhook_transfer_schedule_configuration.rb +159 -0
  124. data/lib/univapay_client_sdk/models/merchant_webhook_user_transactions_configuration.rb +349 -0
  125. data/lib/univapay_client_sdk/models/mode_query.rb +36 -0
  126. data/lib/univapay_client_sdk/models/payment_error.rb +178 -0
  127. data/lib/univapay_client_sdk/models/plan_settings_type.rb +36 -0
  128. data/lib/univapay_client_sdk/models/refund.rb +240 -0
  129. data/lib/univapay_client_sdk/models/refund_create_request.rb +118 -0
  130. data/lib/univapay_client_sdk/models/refund_event.rb +26 -0
  131. data/lib/univapay_client_sdk/models/refund_list.rb +104 -0
  132. data/lib/univapay_client_sdk/models/refund_reason_request.rb +42 -0
  133. data/lib/univapay_client_sdk/models/refund_reason_response.rb +62 -0
  134. data/lib/univapay_client_sdk/models/refund_status.rb +47 -0
  135. data/lib/univapay_client_sdk/models/refund_update_request.rb +99 -0
  136. data/lib/univapay_client_sdk/models/refund_webhook_callback.rb +132 -0
  137. data/lib/univapay_client_sdk/models/refund_webhook_callback_extension.rb +74 -0
  138. data/lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb +99 -0
  139. data/lib/univapay_client_sdk/models/store.rb +119 -0
  140. data/lib/univapay_client_sdk/models/store_list.rb +104 -0
  141. data/lib/univapay_client_sdk/models/store_list_item.rb +114 -0
  142. data/lib/univapay_client_sdk/models/subscription.rb +310 -0
  143. data/lib/univapay_client_sdk/models/subscription_create_request.rb +216 -0
  144. data/lib/univapay_client_sdk/models/subscription_event.rb +54 -0
  145. data/lib/univapay_client_sdk/models/subscription_installment_plan.rb +86 -0
  146. data/lib/univapay_client_sdk/models/subscription_list.rb +104 -0
  147. data/lib/univapay_client_sdk/models/subscription_list_item.rb +352 -0
  148. data/lib/univapay_client_sdk/models/subscription_next_payment.rb +222 -0
  149. data/lib/univapay_client_sdk/models/subscription_patch_payment_request.rb +117 -0
  150. data/lib/univapay_client_sdk/models/subscription_patch_token_request.rb +79 -0
  151. data/lib/univapay_client_sdk/models/subscription_payment.rb +185 -0
  152. data/lib/univapay_client_sdk/models/subscription_payment_list.rb +94 -0
  153. data/lib/univapay_client_sdk/models/subscription_period.rb +56 -0
  154. data/lib/univapay_client_sdk/models/subscription_plan_settings.rb +98 -0
  155. data/lib/univapay_client_sdk/models/subscription_schedule_settings.rb +132 -0
  156. data/lib/univapay_client_sdk/models/subscription_status.rb +56 -0
  157. data/lib/univapay_client_sdk/models/subscription_suspend_request.rb +79 -0
  158. data/lib/univapay_client_sdk/models/subscription_terminate_with_status.rb +36 -0
  159. data/lib/univapay_client_sdk/models/subscription_termination_mode.rb +36 -0
  160. data/lib/univapay_client_sdk/models/subscription_update_next_payment.rb +104 -0
  161. data/lib/univapay_client_sdk/models/subscription_update_request.rb +134 -0
  162. data/lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb +110 -0
  163. data/lib/univapay_client_sdk/models/subscription_update_status.rb +37 -0
  164. data/lib/univapay_client_sdk/models/subscription_user_data.rb +134 -0
  165. data/lib/univapay_client_sdk/models/subscription_webhook_event.rb +143 -0
  166. data/lib/univapay_client_sdk/models/suspend_schedule_settings.rb +78 -0
  167. data/lib/univapay_client_sdk/models/three_ds_issuer_token.rb +116 -0
  168. data/lib/univapay_client_sdk/models/three_ds_issuer_token_call_method.rb +26 -0
  169. data/lib/univapay_client_sdk/models/three_ds_issuer_token_payment_type.rb +26 -0
  170. data/lib/univapay_client_sdk/models/token_create_bank_transfer_data.rb +122 -0
  171. data/lib/univapay_client_sdk/models/token_create_card_data.rb +230 -0
  172. data/lib/univapay_client_sdk/models/token_create_card_data_cvv_authorize.rb +95 -0
  173. data/lib/univapay_client_sdk/models/token_create_card_data_three_ds.rb +97 -0
  174. data/lib/univapay_client_sdk/models/token_create_konbini_data.rb +146 -0
  175. data/lib/univapay_client_sdk/models/token_create_online_data.rb +142 -0
  176. data/lib/univapay_client_sdk/models/token_create_phone_number.rb +104 -0
  177. data/lib/univapay_client_sdk/models/token_event.rb +59 -0
  178. data/lib/univapay_client_sdk/models/token_response_bank_transfer_data.rb +181 -0
  179. data/lib/univapay_client_sdk/models/token_response_card_data.rb +129 -0
  180. data/lib/univapay_client_sdk/models/token_response_card_data_billing.rb +153 -0
  181. data/lib/univapay_client_sdk/models/token_response_card_data_card.rb +187 -0
  182. data/lib/univapay_client_sdk/models/token_response_card_data_cvv_authorize.rb +132 -0
  183. data/lib/univapay_client_sdk/models/token_response_card_data_cvv_authorize_check.rb +118 -0
  184. data/lib/univapay_client_sdk/models/token_response_card_data_three_ds.rb +142 -0
  185. data/lib/univapay_client_sdk/models/token_response_card_data_three_ds_status.rb +48 -0
  186. data/lib/univapay_client_sdk/models/token_response_konbini_data.rb +135 -0
  187. data/lib/univapay_client_sdk/models/token_response_online_data.rb +158 -0
  188. data/lib/univapay_client_sdk/models/token_response_phone_number.rb +96 -0
  189. data/lib/univapay_client_sdk/models/token_webhook_event.rb +144 -0
  190. data/lib/univapay_client_sdk/models/transaction_token.rb +250 -0
  191. data/lib/univapay_client_sdk/models/transaction_token_create_request.rb +161 -0
  192. data/lib/univapay_client_sdk/models/transaction_token_create_request_metadata.rb +124 -0
  193. data/lib/univapay_client_sdk/models/transaction_token_create_request_payment_type.rb +44 -0
  194. data/lib/univapay_client_sdk/models/transaction_token_create_request_type.rb +40 -0
  195. data/lib/univapay_client_sdk/models/transaction_token_list.rb +104 -0
  196. data/lib/univapay_client_sdk/models/transaction_token_list_item.rb +204 -0
  197. data/lib/univapay_client_sdk/models/transaction_token_list_item_user_data.rb +96 -0
  198. data/lib/univapay_client_sdk/models/transaction_token_mode.rb +36 -0
  199. data/lib/univapay_client_sdk/models/transaction_token_payment_type.rb +48 -0
  200. data/lib/univapay_client_sdk/models/transaction_token_type.rb +40 -0
  201. data/lib/univapay_client_sdk/models/transaction_token_update_request.rb +95 -0
  202. data/lib/univapay_client_sdk/models/transaction_token_update_request_data.rb +184 -0
  203. data/lib/univapay_client_sdk/models/transaction_token_update_request_data_phone_number.rb +86 -0
  204. data/lib/univapay_client_sdk/models/webhook.rb +191 -0
  205. data/lib/univapay_client_sdk/models/webhook_callback_envelope.rb +98 -0
  206. data/lib/univapay_client_sdk/models/webhook_create_request.rb +97 -0
  207. data/lib/univapay_client_sdk/models/webhook_event.rb +166 -0
  208. data/lib/univapay_client_sdk/models/webhook_event_list.rb +94 -0
  209. data/lib/univapay_client_sdk/models/webhook_list.rb +94 -0
  210. data/lib/univapay_client_sdk/models/webhook_trigger.rb +104 -0
  211. data/lib/univapay_client_sdk/models/webhook_update_request.rb +108 -0
  212. data/lib/univapay_client_sdk/utilities/date_time_helper.rb +11 -0
  213. data/lib/univapay_client_sdk/utilities/file_wrapper.rb +28 -0
  214. data/lib/univapay_client_sdk/utilities/union_type_lookup.rb +182 -0
  215. data/lib/univapay_client_sdk.rb +285 -0
  216. data/test/apis/api_test_base.rb +23 -0
  217. data/test/apis/test_cancels_api.rb +162 -0
  218. data/test/apis/test_charges_api.rb +565 -0
  219. data/test/apis/test_error_messages.rb +38 -0
  220. data/test/apis/test_merchants_api.rb +50 -0
  221. data/test/apis/test_refunds_api.rb +172 -0
  222. data/test/apis/test_stores_api.rb +86 -0
  223. data/test/apis/test_subscriptions_api.rb +579 -0
  224. data/test/apis/test_transaction_tokens_api.rb +305 -0
  225. data/test/apis/test_webhooks_api.rb +245 -0
  226. data/test/events/webhooks/test_bank_transfer_handler.rb +95 -0
  227. data/test/events/webhooks/test_cancel_handler.rb +90 -0
  228. data/test/events/webhooks/test_charge_handler.rb +138 -0
  229. data/test/events/webhooks/test_customs_handler.rb +100 -0
  230. data/test/events/webhooks/test_refund_handler.rb +95 -0
  231. data/test/events/webhooks/test_subscription_handler.rb +346 -0
  232. data/test/events/webhooks/test_token_handler.rb +332 -0
  233. data/test/framework_integrations/rails_app_test_helper.rb +14 -0
  234. data/test/framework_integrations/webhooks/apps/hanami_charge_app.rb +61 -0
  235. data/test/framework_integrations/webhooks/apps/rails_charge_app.rb +24 -0
  236. data/test/framework_integrations/webhooks/apps/sinatra_charge_app.rb +27 -0
  237. data/test/framework_integrations/webhooks/test/test_hanami_charge_app.rb +57 -0
  238. data/test/framework_integrations/webhooks/test/test_rails_charge_app.rb +57 -0
  239. data/test/framework_integrations/webhooks/test/test_sinatra_charge_app.rb +58 -0
  240. data/test/http_response_catcher.rb +32 -0
  241. metadata +366 -0
@@ -0,0 +1,909 @@
1
+ # univapay_client_sdk
2
+ #
3
+ # This file was automatically generated for Univapay
4
+ # by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module UnivapayClientSdk
7
+ # ChargesApi
8
+ class ChargesApi < BaseApi
9
+ # Creates a charge on a payment instrument (e.g. transaction token).
10
+ # @param [String] idempotency_key Optional parameter: An optional
11
+ # idempotency key to prevent double charges and duplicate operations. We
12
+ # recommend a randomly generated UUID (v4).
13
+ # @param [ChargeCreateRequest] body Optional parameter: Request payload for
14
+ # creating a charge.
15
+ # @return [ApiResponse] Complete http response with raw body and status code.
16
+ def create_charge(idempotency_key: nil,
17
+ body: nil)
18
+ @api_call
19
+ .request(new_request_builder(HttpMethodEnum::POST,
20
+ '/charges',
21
+ Server::DEFAULT)
22
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
23
+ .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
24
+ .body_param(new_parameter(body))
25
+ .header_param(new_parameter('application/json', key: 'accept'))
26
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
27
+ .auth(Single.new('JWT_TOKEN')))
28
+ .response(new_response_handler
29
+ .deserializer(APIHelper.method(:custom_type_deserializer))
30
+ .deserialize_into(Charge.method(:from_hash))
31
+ .is_api_response(true)
32
+ .local_error_template('400',
33
+ 'HTTP 400 Bad Request: {$response.body#/code}',
34
+ ApiErrorException)
35
+ .local_error_template('401',
36
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
37
+ ApiErrorException)
38
+ .local_error_template('403',
39
+ 'HTTP 403 Forbidden: {$response.body#/code}',
40
+ ApiErrorException)
41
+ .local_error_template('429',
42
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
43
+ APIException)
44
+ .local_error_template('404',
45
+ 'HTTP 404 Not Found: {$response.body#/code}',
46
+ APIException)
47
+ .local_error_template('409',
48
+ 'HTTP 409 Conflict: {$response.body#/code}',
49
+ APIException)
50
+ .local_error_template('500',
51
+ 'HTTP 500 Server Error: {$response.body#/code}',
52
+ APIException)
53
+ .local_error_template('503',
54
+ 'HTTP 503 Unavailable: {$response.body#/code}',
55
+ APIException)
56
+ .local_error_template('504',
57
+ 'HTTP 504 Timeout: {$response.body#/code}',
58
+ APIException)
59
+ .local_error_template('default',
60
+ 'HTTP {$statusCode}: {$response.body#/code}',
61
+ APIException))
62
+ .execute
63
+ end
64
+
65
+ # Lists all charges across all stores for the authenticated user.
66
+ # @param [Integer] limit Optional parameter: Maximum number of resources to
67
+ # return in one page.
68
+ # @param [UUID | String] cursor Optional parameter: Cursor pointing to the
69
+ # resource after which pagination should continue.
70
+ # @param [CursorDirectionQuery] cursor_direction Optional parameter:
71
+ # Pagination direction relative to the supplied cursor.
72
+ # @param [String] last_four Optional parameter: Filter by the last 4 digits
73
+ # of the card. **Note:** If specified, `name`, `exp_month`, and `exp_year`
74
+ # must also be included.
75
+ # @param [String] name Optional parameter: Filter by cardholder name.
76
+ # **Note:** If specified, `last_four`, `exp_month`, and `exp_year` must also
77
+ # be included.
78
+ # @param [Integer] exp_month Optional parameter: Filter by expiration month.
79
+ # **Note:** If specified, `last_four`, `name`, and `exp_year` must also be
80
+ # included.
81
+ # @param [Integer] exp_year Optional parameter: Filter by expiration year.
82
+ # **Note:** If specified, `last_four`, `name`, and `exp_month` must also be
83
+ # included.
84
+ # @param [String] from Optional parameter: Show charges created on or after
85
+ # this date (ISO-8601).
86
+ # @param [String] to Optional parameter: Show charges created before this
87
+ # date (ISO-8601).
88
+ # @param [String] email Optional parameter: Filter by email address.
89
+ # @param [String] phone Optional parameter: Filter by phone number.
90
+ # @param [Integer] amount_from Optional parameter: Show charges with an
91
+ # amount greater than or equal to this value.
92
+ # @param [Integer] amount_to Optional parameter: Show charges with an amount
93
+ # strictly less than this value.
94
+ # @param [String] currency Optional parameter: Filter by currency
95
+ # (ISO-4217).
96
+ # @param [ModeQuery] mode Optional parameter: Filter by environment mode.
97
+ # @param [String] metadata Optional parameter: Filter by metadata.
98
+ # @param [UUID | String] transaction_token_id Optional parameter: Filter by
99
+ # transaction token ID.
100
+ # @return [ApiResponse] Complete http response with raw body and status code.
101
+ def list_all_charges(limit: 10,
102
+ cursor: nil,
103
+ cursor_direction: CursorDirectionQuery::DESC,
104
+ last_four: nil,
105
+ name: nil,
106
+ exp_month: nil,
107
+ exp_year: nil,
108
+ from: nil,
109
+ to: nil,
110
+ email: nil,
111
+ phone: nil,
112
+ amount_from: nil,
113
+ amount_to: nil,
114
+ currency: nil,
115
+ mode: nil,
116
+ metadata: nil,
117
+ transaction_token_id: nil)
118
+ @api_call
119
+ .request(new_request_builder(HttpMethodEnum::GET,
120
+ '/charges',
121
+ Server::DEFAULT)
122
+ .query_param(new_parameter(limit, key: 'limit'))
123
+ .query_param(new_parameter(cursor, key: 'cursor'))
124
+ .query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
125
+ .query_param(new_parameter(last_four, key: 'last_four'))
126
+ .query_param(new_parameter(name, key: 'name'))
127
+ .query_param(new_parameter(exp_month, key: 'exp_month'))
128
+ .query_param(new_parameter(exp_year, key: 'exp_year'))
129
+ .query_param(new_parameter(from, key: 'from'))
130
+ .query_param(new_parameter(to, key: 'to'))
131
+ .query_param(new_parameter(email, key: 'email'))
132
+ .query_param(new_parameter(phone, key: 'phone'))
133
+ .query_param(new_parameter(amount_from, key: 'amount_from'))
134
+ .query_param(new_parameter(amount_to, key: 'amount_to'))
135
+ .query_param(new_parameter(currency, key: 'currency'))
136
+ .query_param(new_parameter(mode, key: 'mode'))
137
+ .query_param(new_parameter(metadata, key: 'metadata'))
138
+ .query_param(new_parameter(transaction_token_id, key: 'transaction_token_id'))
139
+ .header_param(new_parameter('application/json', key: 'accept'))
140
+ .auth(Single.new('JWT_TOKEN')))
141
+ .response(new_response_handler
142
+ .deserializer(APIHelper.method(:custom_type_deserializer))
143
+ .deserialize_into(ChargeList.method(:from_hash))
144
+ .is_api_response(true)
145
+ .local_error_template('400',
146
+ 'HTTP 400 Bad Request: {$response.body#/code}',
147
+ ApiErrorException)
148
+ .local_error_template('401',
149
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
150
+ ApiErrorException)
151
+ .local_error_template('403',
152
+ 'HTTP 403 Forbidden: {$response.body#/code}',
153
+ ApiErrorException)
154
+ .local_error_template('429',
155
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
156
+ APIException)
157
+ .local_error_template('404',
158
+ 'HTTP 404 Not Found: {$response.body#/code}',
159
+ APIException)
160
+ .local_error_template('409',
161
+ 'HTTP 409 Conflict: {$response.body#/code}',
162
+ APIException)
163
+ .local_error_template('500',
164
+ 'HTTP 500 Server Error: {$response.body#/code}',
165
+ APIException)
166
+ .local_error_template('503',
167
+ 'HTTP 503 Unavailable: {$response.body#/code}',
168
+ APIException)
169
+ .local_error_template('504',
170
+ 'HTTP 504 Timeout: {$response.body#/code}',
171
+ APIException)
172
+ .local_error_template('default',
173
+ 'HTTP {$statusCode}: {$response.body#/code}',
174
+ APIException))
175
+ .execute
176
+ end
177
+
178
+ # Lists all charges for a specific store.
179
+ # @param [UUID | String] store_id Required parameter: The unique identifier
180
+ # of the store.
181
+ # @param [Integer] limit Optional parameter: Maximum number of resources to
182
+ # return in one page.
183
+ # @param [UUID | String] cursor Optional parameter: Cursor pointing to the
184
+ # resource after which pagination should continue.
185
+ # @param [CursorDirectionQuery] cursor_direction Optional parameter:
186
+ # Pagination direction relative to the supplied cursor.
187
+ # @param [String] last_four Optional parameter: Filter by the last 4 digits
188
+ # of the card. **Note:** If specified, `name`, `exp_month`, and `exp_year`
189
+ # must also be included.
190
+ # @param [String] name Optional parameter: Filter by cardholder name.
191
+ # **Note:** If specified, `last_four`, `exp_month`, and `exp_year` must also
192
+ # be included.
193
+ # @param [Integer] exp_month Optional parameter: Filter by expiration month.
194
+ # **Note:** If specified, `last_four`, `name`, and `exp_year` must also be
195
+ # included.
196
+ # @param [Integer] exp_year Optional parameter: Filter by expiration year.
197
+ # **Note:** If specified, `last_four`, `name`, and `exp_month` must also be
198
+ # included.
199
+ # @param [String] from Optional parameter: Show charges created on or after
200
+ # this date (ISO-8601).
201
+ # @param [String] to Optional parameter: Show charges created before this
202
+ # date (ISO-8601).
203
+ # @param [String] email Optional parameter: Filter by email address.
204
+ # @param [String] phone Optional parameter: Filter by phone number.
205
+ # @param [Integer] amount_from Optional parameter: Show charges with an
206
+ # amount greater than or equal to this value.
207
+ # @param [Integer] amount_to Optional parameter: Show charges with an amount
208
+ # strictly less than this value.
209
+ # @param [String] currency Optional parameter: Filter by currency
210
+ # (ISO-4217).
211
+ # @param [ModeQuery] mode Optional parameter: Filter by environment mode.
212
+ # @param [String] metadata Optional parameter: Filter by metadata.
213
+ # @param [UUID | String] transaction_token_id Optional parameter: Filter by
214
+ # transaction token ID.
215
+ # @return [ApiResponse] Complete http response with raw body and status code.
216
+ def list_store_charges(store_id,
217
+ limit: 10,
218
+ cursor: nil,
219
+ cursor_direction: CursorDirectionQuery::DESC,
220
+ last_four: nil,
221
+ name: nil,
222
+ exp_month: nil,
223
+ exp_year: nil,
224
+ from: nil,
225
+ to: nil,
226
+ email: nil,
227
+ phone: nil,
228
+ amount_from: nil,
229
+ amount_to: nil,
230
+ currency: nil,
231
+ mode: nil,
232
+ metadata: nil,
233
+ transaction_token_id: nil)
234
+ @api_call
235
+ .request(new_request_builder(HttpMethodEnum::GET,
236
+ '/stores/{storeId}/charges',
237
+ Server::DEFAULT)
238
+ .template_param(new_parameter(store_id, key: 'storeId')
239
+ .is_required(true)
240
+ .should_encode(true))
241
+ .query_param(new_parameter(limit, key: 'limit'))
242
+ .query_param(new_parameter(cursor, key: 'cursor'))
243
+ .query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
244
+ .query_param(new_parameter(last_four, key: 'last_four'))
245
+ .query_param(new_parameter(name, key: 'name'))
246
+ .query_param(new_parameter(exp_month, key: 'exp_month'))
247
+ .query_param(new_parameter(exp_year, key: 'exp_year'))
248
+ .query_param(new_parameter(from, key: 'from'))
249
+ .query_param(new_parameter(to, key: 'to'))
250
+ .query_param(new_parameter(email, key: 'email'))
251
+ .query_param(new_parameter(phone, key: 'phone'))
252
+ .query_param(new_parameter(amount_from, key: 'amount_from'))
253
+ .query_param(new_parameter(amount_to, key: 'amount_to'))
254
+ .query_param(new_parameter(currency, key: 'currency'))
255
+ .query_param(new_parameter(mode, key: 'mode'))
256
+ .query_param(new_parameter(metadata, key: 'metadata'))
257
+ .query_param(new_parameter(transaction_token_id, key: 'transaction_token_id'))
258
+ .header_param(new_parameter('application/json', key: 'accept'))
259
+ .auth(Single.new('JWT_TOKEN')))
260
+ .response(new_response_handler
261
+ .deserializer(APIHelper.method(:custom_type_deserializer))
262
+ .deserialize_into(ChargeList.method(:from_hash))
263
+ .is_api_response(true)
264
+ .local_error_template('400',
265
+ 'HTTP 400 Bad Request: {$response.body#/code}',
266
+ ApiErrorException)
267
+ .local_error_template('401',
268
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
269
+ ApiErrorException)
270
+ .local_error_template('403',
271
+ 'HTTP 403 Forbidden: {$response.body#/code}',
272
+ ApiErrorException)
273
+ .local_error_template('429',
274
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
275
+ APIException)
276
+ .local_error_template('404',
277
+ 'HTTP 404 Not Found: {$response.body#/code}',
278
+ APIException)
279
+ .local_error_template('409',
280
+ 'HTTP 409 Conflict: {$response.body#/code}',
281
+ APIException)
282
+ .local_error_template('500',
283
+ 'HTTP 500 Server Error: {$response.body#/code}',
284
+ APIException)
285
+ .local_error_template('503',
286
+ 'HTTP 503 Unavailable: {$response.body#/code}',
287
+ APIException)
288
+ .local_error_template('504',
289
+ 'HTTP 504 Timeout: {$response.body#/code}',
290
+ APIException)
291
+ .local_error_template('default',
292
+ 'HTTP {$statusCode}: {$response.body#/code}',
293
+ APIException))
294
+ .execute
295
+ end
296
+
297
+ # Retrieves the details of an existing charge.
298
+ # @param [UUID | String] store_id Required parameter: The unique identifier
299
+ # of the store.
300
+ # @param [UUID | String] id Required parameter: The unique identifier of the
301
+ # resource.
302
+ # @param [TrueClass | FalseClass] polling Optional parameter: If set to
303
+ # true, instructs the API to internally poll the charge status until it
304
+ # changes from 'pending' (the initial status) to another status.
305
+ # @return [ApiResponse] Complete http response with raw body and status code.
306
+ def get_charge(store_id,
307
+ id,
308
+ polling: nil)
309
+ @api_call
310
+ .request(new_request_builder(HttpMethodEnum::GET,
311
+ '/stores/{storeId}/charges/{id}',
312
+ Server::DEFAULT)
313
+ .template_param(new_parameter(store_id, key: 'storeId')
314
+ .is_required(true)
315
+ .should_encode(true))
316
+ .template_param(new_parameter(id, key: 'id')
317
+ .is_required(true)
318
+ .should_encode(true))
319
+ .query_param(new_parameter(polling, key: 'polling'))
320
+ .header_param(new_parameter('application/json', key: 'accept'))
321
+ .auth(Single.new('JWT_TOKEN')))
322
+ .response(new_response_handler
323
+ .deserializer(APIHelper.method(:custom_type_deserializer))
324
+ .deserialize_into(Charge.method(:from_hash))
325
+ .is_api_response(true)
326
+ .local_error_template('400',
327
+ 'HTTP 400 Bad Request: {$response.body#/code}',
328
+ ApiErrorException)
329
+ .local_error_template('401',
330
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
331
+ ApiErrorException)
332
+ .local_error_template('403',
333
+ 'HTTP 403 Forbidden: {$response.body#/code}',
334
+ ApiErrorException)
335
+ .local_error_template('404',
336
+ 'HTTP 404 Not Found: {$response.body#/code}',
337
+ ApiErrorException)
338
+ .local_error_template('429',
339
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
340
+ APIException)
341
+ .local_error_template('409',
342
+ 'HTTP 409 Conflict: {$response.body#/code}',
343
+ APIException)
344
+ .local_error_template('500',
345
+ 'HTTP 500 Server Error: {$response.body#/code}',
346
+ APIException)
347
+ .local_error_template('503',
348
+ 'HTTP 503 Unavailable: {$response.body#/code}',
349
+ APIException)
350
+ .local_error_template('504',
351
+ 'HTTP 504 Timeout: {$response.body#/code}',
352
+ APIException)
353
+ .local_error_template('default',
354
+ 'HTTP {$statusCode}: {$response.body#/code}',
355
+ APIException))
356
+ .execute
357
+ end
358
+
359
+ # Use this request to add or modify arbitrary metadata on an existing
360
+ # charge.
361
+ # @param [UUID | String] store_id Required parameter: The unique identifier
362
+ # of the store.
363
+ # @param [UUID | String] id Required parameter: The unique identifier of the
364
+ # resource.
365
+ # @param [String] idempotency_key Optional parameter: An optional
366
+ # idempotency key to prevent double charges and duplicate operations. We
367
+ # recommend a randomly generated UUID (v4).
368
+ # @param [ChargeUpdateRequest] body Optional parameter: Request payload for
369
+ # updating charge metadata.
370
+ # @return [ApiResponse] Complete http response with raw body and status code.
371
+ def update_charge(store_id,
372
+ id,
373
+ idempotency_key: nil,
374
+ body: nil)
375
+ @api_call
376
+ .request(new_request_builder(HttpMethodEnum::PATCH,
377
+ '/stores/{storeId}/charges/{id}',
378
+ Server::DEFAULT)
379
+ .template_param(new_parameter(store_id, key: 'storeId')
380
+ .is_required(true)
381
+ .should_encode(true))
382
+ .template_param(new_parameter(id, key: 'id')
383
+ .is_required(true)
384
+ .should_encode(true))
385
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
386
+ .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
387
+ .body_param(new_parameter(body))
388
+ .header_param(new_parameter('application/json', key: 'accept'))
389
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
390
+ .auth(Single.new('JWT_TOKEN')))
391
+ .response(new_response_handler
392
+ .deserializer(APIHelper.method(:custom_type_deserializer))
393
+ .deserialize_into(Charge.method(:from_hash))
394
+ .is_api_response(true)
395
+ .local_error_template('400',
396
+ 'HTTP 400 Bad Request: {$response.body#/code}',
397
+ ApiErrorException)
398
+ .local_error_template('401',
399
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
400
+ ApiErrorException)
401
+ .local_error_template('403',
402
+ 'HTTP 403 Forbidden: {$response.body#/code}',
403
+ ApiErrorException)
404
+ .local_error_template('404',
405
+ 'HTTP 404 Not Found: {$response.body#/code}',
406
+ ApiErrorException)
407
+ .local_error_template('429',
408
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
409
+ APIException)
410
+ .local_error_template('409',
411
+ 'HTTP 409 Conflict: {$response.body#/code}',
412
+ APIException)
413
+ .local_error_template('500',
414
+ 'HTTP 500 Server Error: {$response.body#/code}',
415
+ APIException)
416
+ .local_error_template('503',
417
+ 'HTTP 503 Unavailable: {$response.body#/code}',
418
+ APIException)
419
+ .local_error_template('504',
420
+ 'HTTP 504 Timeout: {$response.body#/code}',
421
+ APIException)
422
+ .local_error_template('default',
423
+ 'HTTP {$statusCode}: {$response.body#/code}',
424
+ APIException))
425
+ .execute
426
+ end
427
+
428
+ # Captures a previously authorized charge (where `capture` was set to false
429
+ # during creation). The capture amount must be less than or equal to the
430
+ # authorized amount, and the currency must match.
431
+ # @param [UUID | String] store_id Required parameter: The unique identifier
432
+ # of the store.
433
+ # @param [UUID | String] id Required parameter: The unique identifier of the
434
+ # resource.
435
+ # @param [ChargeCaptureRequest] body Required parameter: Request payload for
436
+ # capturing an authorized charge.
437
+ # @param [String] idempotency_key Optional parameter: An optional
438
+ # idempotency key to prevent double charges and duplicate operations. We
439
+ # recommend a randomly generated UUID (v4).
440
+ # @return [ApiResponse] Complete http response with raw body and status code.
441
+ def capture_charge(store_id,
442
+ id,
443
+ body,
444
+ idempotency_key: nil)
445
+ @api_call
446
+ .request(new_request_builder(HttpMethodEnum::POST,
447
+ '/stores/{storeId}/charges/{id}/capture',
448
+ Server::DEFAULT)
449
+ .template_param(new_parameter(store_id, key: 'storeId')
450
+ .is_required(true)
451
+ .should_encode(true))
452
+ .template_param(new_parameter(id, key: 'id')
453
+ .is_required(true)
454
+ .should_encode(true))
455
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
456
+ .body_param(new_parameter(body)
457
+ .is_required(true))
458
+ .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
459
+ .header_param(new_parameter('application/json', key: 'accept'))
460
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
461
+ .auth(Single.new('JWT_TOKEN')))
462
+ .response(new_response_handler
463
+ .deserializer(APIHelper.method(:json_deserialize))
464
+ .is_api_response(true)
465
+ .local_error_template('400',
466
+ 'HTTP 400 Bad Request: {$response.body#/code}',
467
+ ApiErrorException)
468
+ .local_error_template('401',
469
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
470
+ ApiErrorException)
471
+ .local_error_template('403',
472
+ 'HTTP 403 Forbidden: {$response.body#/code}',
473
+ ApiErrorException)
474
+ .local_error_template('404',
475
+ 'HTTP 404 Not Found: {$response.body#/code}',
476
+ ApiErrorException)
477
+ .local_error_template('429',
478
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
479
+ APIException)
480
+ .local_error_template('409',
481
+ 'HTTP 409 Conflict: {$response.body#/code}',
482
+ APIException)
483
+ .local_error_template('500',
484
+ 'HTTP 500 Server Error: {$response.body#/code}',
485
+ APIException)
486
+ .local_error_template('503',
487
+ 'HTTP 503 Unavailable: {$response.body#/code}',
488
+ APIException)
489
+ .local_error_template('504',
490
+ 'HTTP 504 Timeout: {$response.body#/code}',
491
+ APIException)
492
+ .local_error_template('default',
493
+ 'HTTP {$statusCode}: {$response.body#/code}',
494
+ APIException))
495
+ .execute
496
+ end
497
+
498
+ # Retrieves the necessary payment execution URL (for online payments) or
499
+ # bank account details (for bank transfers).
500
+ # **⚠️ Prerequisite:** The charge `status` must be `awaiting` before
501
+ # requesting the issuer token. If requested while the charge is in any
502
+ # other status, an error will be returned.
503
+ # @param [UUID | String] store_id Required parameter: The unique identifier
504
+ # of the store.
505
+ # @param [UUID | String] id Required parameter: The unique identifier of the
506
+ # resource.
507
+ # @return [ApiResponse] Complete http response with raw body and status code.
508
+ def get_charge_issuer_token(store_id,
509
+ id)
510
+ @api_call
511
+ .request(new_request_builder(HttpMethodEnum::GET,
512
+ '/stores/{storeId}/charges/{id}/issuer_token',
513
+ Server::DEFAULT)
514
+ .template_param(new_parameter(store_id, key: 'storeId')
515
+ .is_required(true)
516
+ .should_encode(true))
517
+ .template_param(new_parameter(id, key: 'id')
518
+ .is_required(true)
519
+ .should_encode(true))
520
+ .header_param(new_parameter('application/json', key: 'accept'))
521
+ .auth(Single.new('JWT_TOKEN')))
522
+ .response(new_response_handler
523
+ .deserializer(APIHelper.method(:custom_type_deserializer))
524
+ .deserialize_into(IssuerToken.method(:from_hash))
525
+ .is_api_response(true)
526
+ .local_error_template('400',
527
+ 'HTTP 400 Bad Request: {$response.body#/code}',
528
+ ApiErrorException)
529
+ .local_error_template('401',
530
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
531
+ ApiErrorException)
532
+ .local_error_template('403',
533
+ 'HTTP 403 Forbidden: {$response.body#/code}',
534
+ ApiErrorException)
535
+ .local_error_template('404',
536
+ 'HTTP 404 Not Found: {$response.body#/code}',
537
+ ApiErrorException)
538
+ .local_error_template('429',
539
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
540
+ APIException)
541
+ .local_error_template('409',
542
+ 'HTTP 409 Conflict: {$response.body#/code}',
543
+ APIException)
544
+ .local_error_template('500',
545
+ 'HTTP 500 Server Error: {$response.body#/code}',
546
+ APIException)
547
+ .local_error_template('503',
548
+ 'HTTP 503 Unavailable: {$response.body#/code}',
549
+ APIException)
550
+ .local_error_template('504',
551
+ 'HTTP 504 Timeout: {$response.body#/code}',
552
+ APIException)
553
+ .local_error_template('default',
554
+ 'HTTP {$statusCode}: {$response.body#/code}',
555
+ APIException))
556
+ .execute
557
+ end
558
+
559
+ # Retrieves the 3-D Secure issuer token details required to authenticate a
560
+ # card charge.
561
+ # **⚠️ Prerequisites:** 1. The charge must be created with `three_ds.mode`
562
+ # set to `normal` or `force`. 2. You must poll the charge until its `status`
563
+ # becomes `awaiting` before making this request.
564
+ # **Execution Flow:** Once retrieved, the client (browser) must execute an
565
+ # `http_post` request to the `issuer_token` URL. The `payload` object must
566
+ # be formatted according to the `content_type` (e.g., URL-encoded) and sent
567
+ # in the body. You can execute this via a redirect or inside an iframe. If
568
+ # using an iframe, continue polling the charge status in the background
569
+ # until it reaches `successful`, `failed`, or `error`.
570
+ # @param [UUID | String] store_id Required parameter: The unique identifier
571
+ # of the store.
572
+ # @param [UUID | String] id Required parameter: The unique identifier of the
573
+ # resource.
574
+ # @return [ApiResponse] Complete http response with raw body and status code.
575
+ def get_charge_three_ds_issuer_token(store_id,
576
+ id)
577
+ @api_call
578
+ .request(new_request_builder(HttpMethodEnum::GET,
579
+ '/stores/{storeId}/charges/{id}/three_ds/issuer_token',
580
+ Server::DEFAULT)
581
+ .template_param(new_parameter(store_id, key: 'storeId')
582
+ .is_required(true)
583
+ .should_encode(true))
584
+ .template_param(new_parameter(id, key: 'id')
585
+ .is_required(true)
586
+ .should_encode(true))
587
+ .header_param(new_parameter('application/json', key: 'accept'))
588
+ .auth(Single.new('JWT_TOKEN')))
589
+ .response(new_response_handler
590
+ .deserializer(APIHelper.method(:custom_type_deserializer))
591
+ .deserialize_into(ThreeDsIssuerToken.method(:from_hash))
592
+ .is_api_response(true)
593
+ .local_error_template('400',
594
+ 'HTTP 400 Bad Request: {$response.body#/code}',
595
+ ApiErrorException)
596
+ .local_error_template('401',
597
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
598
+ ApiErrorException)
599
+ .local_error_template('403',
600
+ 'HTTP 403 Forbidden: {$response.body#/code}',
601
+ ApiErrorException)
602
+ .local_error_template('404',
603
+ 'HTTP 404 Not Found: {$response.body#/code}',
604
+ ApiErrorException)
605
+ .local_error_template('429',
606
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
607
+ APIException)
608
+ .local_error_template('409',
609
+ 'HTTP 409 Conflict: {$response.body#/code}',
610
+ APIException)
611
+ .local_error_template('500',
612
+ 'HTTP 500 Server Error: {$response.body#/code}',
613
+ APIException)
614
+ .local_error_template('503',
615
+ 'HTTP 503 Unavailable: {$response.body#/code}',
616
+ APIException)
617
+ .local_error_template('504',
618
+ 'HTTP 504 Timeout: {$response.body#/code}',
619
+ APIException)
620
+ .local_error_template('default',
621
+ 'HTTP {$statusCode}: {$response.body#/code}',
622
+ APIException))
623
+ .execute
624
+ end
625
+
626
+ # Retrieves bank transfer ledger entries associated with a charge. This is
627
+ # an optional reconciliation endpoint — not part of the required
628
+ # create-charge-and-poll flow.
629
+ # **⚠️ Requires a merchant-level application token**, unlike the rest of the
630
+ # bank transfer flow. A store application token (`Bearer {secret}.{jwt}`
631
+ # scoped to a `store_id`) is not sufficient here, even though the path is
632
+ # store-scoped.
633
+ # @param [UUID | String] store_id Required parameter: The unique identifier
634
+ # of the store.
635
+ # @param [UUID | String] id Required parameter: The unique identifier of the
636
+ # resource.
637
+ # @return [ApiResponse] Complete http response with raw body and status code.
638
+ def list_bank_transfer_ledgers(store_id,
639
+ id)
640
+ @api_call
641
+ .request(new_request_builder(HttpMethodEnum::GET,
642
+ '/stores/{storeId}/charges/{id}/bank_transfer_ledgers',
643
+ Server::DEFAULT)
644
+ .template_param(new_parameter(store_id, key: 'storeId')
645
+ .is_required(true)
646
+ .should_encode(true))
647
+ .template_param(new_parameter(id, key: 'id')
648
+ .is_required(true)
649
+ .should_encode(true))
650
+ .header_param(new_parameter('application/json', key: 'accept'))
651
+ .auth(Single.new('JWT_TOKEN')))
652
+ .response(new_response_handler
653
+ .deserializer(APIHelper.method(:custom_type_deserializer))
654
+ .deserialize_into(BankTransferLedgerList.method(:from_hash))
655
+ .is_api_response(true)
656
+ .local_error_template('400',
657
+ 'HTTP 400 Bad Request: {$response.body#/code}',
658
+ ApiErrorException)
659
+ .local_error_template('401',
660
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
661
+ ApiErrorException)
662
+ .local_error_template('403',
663
+ 'HTTP 403 Forbidden: {$response.body#/code}',
664
+ ApiErrorException)
665
+ .local_error_template('404',
666
+ 'HTTP 404 Not Found: {$response.body#/code}',
667
+ ApiErrorException)
668
+ .local_error_template('429',
669
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
670
+ APIException)
671
+ .local_error_template('409',
672
+ 'HTTP 409 Conflict: {$response.body#/code}',
673
+ APIException)
674
+ .local_error_template('500',
675
+ 'HTTP 500 Server Error: {$response.body#/code}',
676
+ APIException)
677
+ .local_error_template('503',
678
+ 'HTTP 503 Unavailable: {$response.body#/code}',
679
+ APIException)
680
+ .local_error_template('504',
681
+ 'HTTP 504 Timeout: {$response.body#/code}',
682
+ APIException)
683
+ .local_error_template('default',
684
+ 'HTTP {$statusCode}: {$response.body#/code}',
685
+ APIException))
686
+ .execute
687
+ end
688
+
689
+ # Creates a customs declaration for a successful charge. Backend only
690
+ # accepts this request for WeChat Online and WeChat MPM charges. If a
691
+ # declaration already exists and is no longer pending, the backend updates
692
+ # its identity fields and restarts processing instead of creating a new
693
+ # record.
694
+ # @param [UUID | String] store_id Required parameter: The unique identifier
695
+ # of the store.
696
+ # @param [UUID | String] charge_id Required parameter: The unique identifier
697
+ # of the charge.
698
+ # @param [CustomsDeclarationCreateRequest] body Required parameter: Request
699
+ # payload for creating a customs declaration.
700
+ # @param [String] idempotency_key Optional parameter: An optional
701
+ # idempotency key to prevent double charges and duplicate operations. We
702
+ # recommend a randomly generated UUID (v4).
703
+ # @return [ApiResponse] Complete http response with raw body and status code.
704
+ def create_customs_declaration(store_id,
705
+ charge_id,
706
+ body,
707
+ idempotency_key: nil)
708
+ @api_call
709
+ .request(new_request_builder(HttpMethodEnum::POST,
710
+ '/stores/{storeId}/charges/{chargeId}/customs',
711
+ Server::DEFAULT)
712
+ .template_param(new_parameter(store_id, key: 'storeId')
713
+ .is_required(true)
714
+ .should_encode(true))
715
+ .template_param(new_parameter(charge_id, key: 'chargeId')
716
+ .is_required(true)
717
+ .should_encode(true))
718
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
719
+ .body_param(new_parameter(body)
720
+ .is_required(true))
721
+ .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
722
+ .header_param(new_parameter('application/json', key: 'accept'))
723
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
724
+ .auth(Single.new('JWT_TOKEN')))
725
+ .response(new_response_handler
726
+ .deserializer(APIHelper.method(:custom_type_deserializer))
727
+ .deserialize_into(CustomsDeclarationWebhookData.method(:from_hash))
728
+ .is_api_response(true)
729
+ .local_error_template('400',
730
+ 'HTTP 400 Bad Request: {$response.body#/code}',
731
+ ApiErrorException)
732
+ .local_error_template('401',
733
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
734
+ ApiErrorException)
735
+ .local_error_template('403',
736
+ 'HTTP 403 Forbidden: {$response.body#/code}',
737
+ ApiErrorException)
738
+ .local_error_template('404',
739
+ 'HTTP 404 Not Found: {$response.body#/code}',
740
+ ApiErrorException)
741
+ .local_error_template('429',
742
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
743
+ APIException)
744
+ .local_error_template('409',
745
+ 'HTTP 409 Conflict: {$response.body#/code}',
746
+ APIException)
747
+ .local_error_template('500',
748
+ 'HTTP 500 Server Error: {$response.body#/code}',
749
+ APIException)
750
+ .local_error_template('503',
751
+ 'HTTP 503 Unavailable: {$response.body#/code}',
752
+ APIException)
753
+ .local_error_template('504',
754
+ 'HTTP 504 Timeout: {$response.body#/code}',
755
+ APIException)
756
+ .local_error_template('default',
757
+ 'HTTP {$statusCode}: {$response.body#/code}',
758
+ APIException))
759
+ .execute
760
+ end
761
+
762
+ # Retrieves a customs declaration for a charge. Supports long polling when
763
+ # `polling=true`, returning once the declaration leaves its current state or
764
+ # the polling timeout is reached.
765
+ # @param [UUID | String] store_id Required parameter: The unique identifier
766
+ # of the store.
767
+ # @param [UUID | String] charge_id Required parameter: The unique identifier
768
+ # of the charge.
769
+ # @param [UUID | String] id Required parameter: The unique identifier of the
770
+ # customs declaration.
771
+ # @param [TrueClass | FalseClass] polling Optional parameter: Hold the
772
+ # request open while waiting for a status change.
773
+ # @return [ApiResponse] Complete http response with raw body and status code.
774
+ def get_customs_declaration(store_id,
775
+ charge_id,
776
+ id,
777
+ polling: false)
778
+ @api_call
779
+ .request(new_request_builder(HttpMethodEnum::GET,
780
+ '/stores/{storeId}/charges/{chargeId}/customs/{id}',
781
+ Server::DEFAULT)
782
+ .template_param(new_parameter(store_id, key: 'storeId')
783
+ .is_required(true)
784
+ .should_encode(true))
785
+ .template_param(new_parameter(charge_id, key: 'chargeId')
786
+ .is_required(true)
787
+ .should_encode(true))
788
+ .template_param(new_parameter(id, key: 'id')
789
+ .is_required(true)
790
+ .should_encode(true))
791
+ .query_param(new_parameter(polling, key: 'polling'))
792
+ .header_param(new_parameter('application/json', key: 'accept'))
793
+ .auth(Single.new('JWT_TOKEN')))
794
+ .response(new_response_handler
795
+ .deserializer(APIHelper.method(:custom_type_deserializer))
796
+ .deserialize_into(CustomsDeclarationWebhookData.method(:from_hash))
797
+ .is_api_response(true)
798
+ .local_error_template('401',
799
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
800
+ ApiErrorException)
801
+ .local_error_template('403',
802
+ 'HTTP 403 Forbidden: {$response.body#/code}',
803
+ ApiErrorException)
804
+ .local_error_template('404',
805
+ 'HTTP 404 Not Found: {$response.body#/code}',
806
+ ApiErrorException)
807
+ .local_error_template('400',
808
+ 'HTTP 400 Bad Request: {$response.body#/code}',
809
+ APIException)
810
+ .local_error_template('409',
811
+ 'HTTP 409 Conflict: {$response.body#/code}',
812
+ APIException)
813
+ .local_error_template('429',
814
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
815
+ APIException)
816
+ .local_error_template('500',
817
+ 'HTTP 500 Server Error: {$response.body#/code}',
818
+ APIException)
819
+ .local_error_template('503',
820
+ 'HTTP 503 Unavailable: {$response.body#/code}',
821
+ APIException)
822
+ .local_error_template('504',
823
+ 'HTTP 504 Timeout: {$response.body#/code}',
824
+ APIException)
825
+ .local_error_template('default',
826
+ 'HTTP {$statusCode}: {$response.body#/code}',
827
+ APIException))
828
+ .execute
829
+ end
830
+
831
+ # Updates a customs declaration and requeues processing. Backend patching
832
+ # preserves the original `customs`, `certificate_id`, and `certificate_name`
833
+ # values and only accepts a new `merchant_customs_no`. Pending declarations
834
+ # cannot be patched.
835
+ # @param [UUID | String] store_id Required parameter: The unique identifier
836
+ # of the store.
837
+ # @param [UUID | String] charge_id Required parameter: The unique identifier
838
+ # of the charge.
839
+ # @param [UUID | String] id Required parameter: The unique identifier of the
840
+ # customs declaration.
841
+ # @param [CustomsDeclarationPatchRequest] body Required parameter: Request
842
+ # payload for patching a customs declaration.
843
+ # @param [String] idempotency_key Optional parameter: An optional
844
+ # idempotency key to prevent double charges and duplicate operations. We
845
+ # recommend a randomly generated UUID (v4).
846
+ # @return [ApiResponse] Complete http response with raw body and status code.
847
+ def patch_customs_declaration(store_id,
848
+ charge_id,
849
+ id,
850
+ body,
851
+ idempotency_key: nil)
852
+ @api_call
853
+ .request(new_request_builder(HttpMethodEnum::PATCH,
854
+ '/stores/{storeId}/charges/{chargeId}/customs/{id}',
855
+ Server::DEFAULT)
856
+ .template_param(new_parameter(store_id, key: 'storeId')
857
+ .is_required(true)
858
+ .should_encode(true))
859
+ .template_param(new_parameter(charge_id, key: 'chargeId')
860
+ .is_required(true)
861
+ .should_encode(true))
862
+ .template_param(new_parameter(id, key: 'id')
863
+ .is_required(true)
864
+ .should_encode(true))
865
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
866
+ .body_param(new_parameter(body)
867
+ .is_required(true))
868
+ .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
869
+ .header_param(new_parameter('application/json', key: 'accept'))
870
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
871
+ .auth(Single.new('JWT_TOKEN')))
872
+ .response(new_response_handler
873
+ .deserializer(APIHelper.method(:custom_type_deserializer))
874
+ .deserialize_into(CustomsDeclarationWebhookData.method(:from_hash))
875
+ .is_api_response(true)
876
+ .local_error_template('400',
877
+ 'HTTP 400 Bad Request: {$response.body#/code}',
878
+ ApiErrorException)
879
+ .local_error_template('401',
880
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
881
+ ApiErrorException)
882
+ .local_error_template('403',
883
+ 'HTTP 403 Forbidden: {$response.body#/code}',
884
+ ApiErrorException)
885
+ .local_error_template('404',
886
+ 'HTTP 404 Not Found: {$response.body#/code}',
887
+ ApiErrorException)
888
+ .local_error_template('429',
889
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
890
+ APIException)
891
+ .local_error_template('409',
892
+ 'HTTP 409 Conflict: {$response.body#/code}',
893
+ APIException)
894
+ .local_error_template('500',
895
+ 'HTTP 500 Server Error: {$response.body#/code}',
896
+ APIException)
897
+ .local_error_template('503',
898
+ 'HTTP 503 Unavailable: {$response.body#/code}',
899
+ APIException)
900
+ .local_error_template('504',
901
+ 'HTTP 504 Timeout: {$response.body#/code}',
902
+ APIException)
903
+ .local_error_template('default',
904
+ 'HTTP {$statusCode}: {$response.body#/code}',
905
+ APIException))
906
+ .execute
907
+ end
908
+ end
909
+ end