univapay-apimatic-sdk 0.0.1

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 (272) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +224 -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 +903 -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 +116 -0
  16. data/lib/univapay_client_sdk/configuration.rb +178 -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_finished_handler.rb +37 -0
  21. data/lib/univapay_client_sdk/events/webhooks/charge_updated_handler.rb +37 -0
  22. data/lib/univapay_client_sdk/events/webhooks/customs_handler.rb +37 -0
  23. data/lib/univapay_client_sdk/events/webhooks/recurring_token_deleted_handler.rb +37 -0
  24. data/lib/univapay_client_sdk/events/webhooks/refund_handler.rb +37 -0
  25. data/lib/univapay_client_sdk/events/webhooks/subscription_canceled_handler.rb +37 -0
  26. data/lib/univapay_client_sdk/events/webhooks/subscription_completed_handler.rb +37 -0
  27. data/lib/univapay_client_sdk/events/webhooks/subscription_created_handler.rb +37 -0
  28. data/lib/univapay_client_sdk/events/webhooks/subscription_failure_handler.rb +37 -0
  29. data/lib/univapay_client_sdk/events/webhooks/subscription_payment_handler.rb +37 -0
  30. data/lib/univapay_client_sdk/events/webhooks/subscription_suspended_handler.rb +37 -0
  31. data/lib/univapay_client_sdk/events/webhooks/token_created_handler.rb +37 -0
  32. data/lib/univapay_client_sdk/events/webhooks/token_cvv_auth_check_updated_handler.rb +37 -0
  33. data/lib/univapay_client_sdk/events/webhooks/token_cvv_auth_updated_handler.rb +37 -0
  34. data/lib/univapay_client_sdk/events/webhooks/token_replaced_handler.rb +37 -0
  35. data/lib/univapay_client_sdk/events/webhooks/token_three_ds_updated_handler.rb +37 -0
  36. data/lib/univapay_client_sdk/events/webhooks/token_updated_handler.rb +37 -0
  37. data/lib/univapay_client_sdk/exceptions/api_error_exception.rb +199 -0
  38. data/lib/univapay_client_sdk/exceptions/api_exception.rb +21 -0
  39. data/lib/univapay_client_sdk/http/api_response.rb +19 -0
  40. data/lib/univapay_client_sdk/http/auth/oauth_2.rb +53 -0
  41. data/lib/univapay_client_sdk/http/http_call_back.rb +10 -0
  42. data/lib/univapay_client_sdk/http/http_method_enum.rb +10 -0
  43. data/lib/univapay_client_sdk/http/http_request.rb +10 -0
  44. data/lib/univapay_client_sdk/http/http_response.rb +10 -0
  45. data/lib/univapay_client_sdk/http/proxy_settings.rb +22 -0
  46. data/lib/univapay_client_sdk/logging/configuration/api_logging_configuration.rb +186 -0
  47. data/lib/univapay_client_sdk/logging/sdk_logger.rb +17 -0
  48. data/lib/univapay_client_sdk/models/api_error_detail.rb +87 -0
  49. data/lib/univapay_client_sdk/models/api_error_status.rb +26 -0
  50. data/lib/univapay_client_sdk/models/bank_transfer_event.rb +27 -0
  51. data/lib/univapay_client_sdk/models/bank_transfer_ledger.rb +199 -0
  52. data/lib/univapay_client_sdk/models/bank_transfer_ledger_bank_ledger_type.rb +36 -0
  53. data/lib/univapay_client_sdk/models/bank_transfer_ledger_list.rb +104 -0
  54. data/lib/univapay_client_sdk/models/bank_transfer_ledger_mode.rb +36 -0
  55. data/lib/univapay_client_sdk/models/bank_transfer_payment_status.rb +44 -0
  56. data/lib/univapay_client_sdk/models/bank_transfer_status_data.rb +229 -0
  57. data/lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb +134 -0
  58. data/lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback_extension.rb +75 -0
  59. data/lib/univapay_client_sdk/models/base_bank_transfer_data.rb +100 -0
  60. data/lib/univapay_client_sdk/models/base_konbini_data.rb +99 -0
  61. data/lib/univapay_client_sdk/models/base_konbini_data_convenience_store.rb +60 -0
  62. data/lib/univapay_client_sdk/models/base_model.rb +110 -0
  63. data/lib/univapay_client_sdk/models/base_online_data.rb +123 -0
  64. data/lib/univapay_client_sdk/models/base_online_data_brand.rb +48 -0
  65. data/lib/univapay_client_sdk/models/base_online_data_call_method.rb +52 -0
  66. data/lib/univapay_client_sdk/models/base_online_data_os_type.rb +36 -0
  67. data/lib/univapay_client_sdk/models/base_online_data_user_identifier_source.rb +36 -0
  68. data/lib/univapay_client_sdk/models/cancel.rb +183 -0
  69. data/lib/univapay_client_sdk/models/cancel_create_request.rb +77 -0
  70. data/lib/univapay_client_sdk/models/cancel_event.rb +26 -0
  71. data/lib/univapay_client_sdk/models/cancel_list.rb +94 -0
  72. data/lib/univapay_client_sdk/models/cancel_status.rb +44 -0
  73. data/lib/univapay_client_sdk/models/cancel_update_request.rb +76 -0
  74. data/lib/univapay_client_sdk/models/cancel_webhook_callback.rb +132 -0
  75. data/lib/univapay_client_sdk/models/cancel_webhook_callback_extension.rb +74 -0
  76. data/lib/univapay_client_sdk/models/card_processor_installment_config.rb +89 -0
  77. data/lib/univapay_client_sdk/models/charge.rb +411 -0
  78. data/lib/univapay_client_sdk/models/charge_capture_request.rb +84 -0
  79. data/lib/univapay_client_sdk/models/charge_create_request.rb +179 -0
  80. data/lib/univapay_client_sdk/models/charge_create_request_client_metadata.rb +76 -0
  81. data/lib/univapay_client_sdk/models/charge_create_request_redirect.rb +75 -0
  82. data/lib/univapay_client_sdk/models/charge_create_request_three_ds.rb +88 -0
  83. data/lib/univapay_client_sdk/models/charge_create_request_three_ds_mode.rb +44 -0
  84. data/lib/univapay_client_sdk/models/charge_finished_webhook_callback.rb +131 -0
  85. data/lib/univapay_client_sdk/models/charge_list.rb +104 -0
  86. data/lib/univapay_client_sdk/models/charge_mode.rb +36 -0
  87. data/lib/univapay_client_sdk/models/charge_redirect.rb +96 -0
  88. data/lib/univapay_client_sdk/models/charge_status.rb +56 -0
  89. data/lib/univapay_client_sdk/models/charge_three_ds.rb +97 -0
  90. data/lib/univapay_client_sdk/models/charge_transaction_token_type.rb +40 -0
  91. data/lib/univapay_client_sdk/models/charge_update_request.rb +75 -0
  92. data/lib/univapay_client_sdk/models/charge_updated_webhook_callback.rb +131 -0
  93. data/lib/univapay_client_sdk/models/cursor_direction_query.rb +36 -0
  94. data/lib/univapay_client_sdk/models/customs_declaration_create_request.rb +106 -0
  95. data/lib/univapay_client_sdk/models/customs_declaration_event.rb +27 -0
  96. data/lib/univapay_client_sdk/models/customs_declaration_patch_request.rb +77 -0
  97. data/lib/univapay_client_sdk/models/customs_declaration_webhook_callback.rb +135 -0
  98. data/lib/univapay_client_sdk/models/customs_declaration_webhook_callback_extension.rb +76 -0
  99. data/lib/univapay_client_sdk/models/customs_declaration_webhook_data.rb +232 -0
  100. data/lib/univapay_client_sdk/models/customs_declaration_webhook_declaration.rb +121 -0
  101. data/lib/univapay_client_sdk/models/customs_declaration_webhook_error.rb +127 -0
  102. data/lib/univapay_client_sdk/models/customs_declaration_webhook_other_error.rb +120 -0
  103. data/lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb +125 -0
  104. data/lib/univapay_client_sdk/models/customs_declaration_webhook_status.rb +44 -0
  105. data/lib/univapay_client_sdk/models/generic_metadata.rb +111 -0
  106. data/lib/univapay_client_sdk/models/installment_fixed_cycles.rb +70 -0
  107. data/lib/univapay_client_sdk/models/installment_plan_type.rb +36 -0
  108. data/lib/univapay_client_sdk/models/issuer_token.rb +177 -0
  109. data/lib/univapay_client_sdk/models/issuer_token_call_method.rb +51 -0
  110. data/lib/univapay_client_sdk/models/issuer_token_payload.rb +105 -0
  111. data/lib/univapay_client_sdk/models/issuer_token_payment_type.rb +36 -0
  112. data/lib/univapay_client_sdk/models/merchant.rb +179 -0
  113. data/lib/univapay_client_sdk/models/merchant_webhook_bank_transfer_configuration.rb +342 -0
  114. data/lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb +167 -0
  115. data/lib/univapay_client_sdk/models/merchant_webhook_card_configuration.rb +301 -0
  116. data/lib/univapay_client_sdk/models/merchant_webhook_checkout_configuration.rb +87 -0
  117. data/lib/univapay_client_sdk/models/merchant_webhook_checkout_toggle.rb +77 -0
  118. data/lib/univapay_client_sdk/models/merchant_webhook_configuration.rb +505 -0
  119. data/lib/univapay_client_sdk/models/merchant_webhook_convenience_configuration.rb +88 -0
  120. data/lib/univapay_client_sdk/models/merchant_webhook_customer_management_configuration.rb +99 -0
  121. data/lib/univapay_client_sdk/models/merchant_webhook_installment_plan_configuration.rb +139 -0
  122. data/lib/univapay_client_sdk/models/merchant_webhook_limit_charge_by_card_configuration.rb +88 -0
  123. data/lib/univapay_client_sdk/models/merchant_webhook_limit_refund_by_sales_configuration.rb +100 -0
  124. data/lib/univapay_client_sdk/models/merchant_webhook_money_amount.rb +85 -0
  125. data/lib/univapay_client_sdk/models/merchant_webhook_online_configuration.rb +77 -0
  126. data/lib/univapay_client_sdk/models/merchant_webhook_paidy_configuration.rb +77 -0
  127. data/lib/univapay_client_sdk/models/merchant_webhook_qr_merchant_configuration.rb +77 -0
  128. data/lib/univapay_client_sdk/models/merchant_webhook_qr_scan_configuration.rb +93 -0
  129. data/lib/univapay_client_sdk/models/merchant_webhook_recurring_cvv_confirmation_config.rb +97 -0
  130. data/lib/univapay_client_sdk/models/merchant_webhook_recurring_token_configuration.rb +109 -0
  131. data/lib/univapay_client_sdk/models/merchant_webhook_security_configuration.rb +234 -0
  132. data/lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb +138 -0
  133. data/lib/univapay_client_sdk/models/merchant_webhook_subscription_plan_configuration.rb +138 -0
  134. data/lib/univapay_client_sdk/models/merchant_webhook_transfer_schedule_configuration.rb +159 -0
  135. data/lib/univapay_client_sdk/models/merchant_webhook_user_transactions_configuration.rb +349 -0
  136. data/lib/univapay_client_sdk/models/mode_query.rb +36 -0
  137. data/lib/univapay_client_sdk/models/payment_error.rb +178 -0
  138. data/lib/univapay_client_sdk/models/plan_settings_type.rb +36 -0
  139. data/lib/univapay_client_sdk/models/recurring_token_deleted_webhook_callback.rb +132 -0
  140. data/lib/univapay_client_sdk/models/refund.rb +240 -0
  141. data/lib/univapay_client_sdk/models/refund_create_request.rb +118 -0
  142. data/lib/univapay_client_sdk/models/refund_event.rb +26 -0
  143. data/lib/univapay_client_sdk/models/refund_list.rb +104 -0
  144. data/lib/univapay_client_sdk/models/refund_reason_request.rb +42 -0
  145. data/lib/univapay_client_sdk/models/refund_reason_response.rb +62 -0
  146. data/lib/univapay_client_sdk/models/refund_status.rb +47 -0
  147. data/lib/univapay_client_sdk/models/refund_update_request.rb +99 -0
  148. data/lib/univapay_client_sdk/models/refund_webhook_callback.rb +132 -0
  149. data/lib/univapay_client_sdk/models/refund_webhook_callback_extension.rb +74 -0
  150. data/lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb +99 -0
  151. data/lib/univapay_client_sdk/models/store.rb +119 -0
  152. data/lib/univapay_client_sdk/models/store_list.rb +104 -0
  153. data/lib/univapay_client_sdk/models/store_list_item.rb +114 -0
  154. data/lib/univapay_client_sdk/models/subscription.rb +310 -0
  155. data/lib/univapay_client_sdk/models/subscription_canceled_webhook_callback.rb +132 -0
  156. data/lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb +132 -0
  157. data/lib/univapay_client_sdk/models/subscription_create_request.rb +216 -0
  158. data/lib/univapay_client_sdk/models/subscription_created_webhook_callback.rb +132 -0
  159. data/lib/univapay_client_sdk/models/subscription_failure_webhook_callback.rb +132 -0
  160. data/lib/univapay_client_sdk/models/subscription_installment_plan.rb +86 -0
  161. data/lib/univapay_client_sdk/models/subscription_list.rb +104 -0
  162. data/lib/univapay_client_sdk/models/subscription_list_item.rb +352 -0
  163. data/lib/univapay_client_sdk/models/subscription_next_payment.rb +222 -0
  164. data/lib/univapay_client_sdk/models/subscription_patch_payment_request.rb +117 -0
  165. data/lib/univapay_client_sdk/models/subscription_patch_token_request.rb +79 -0
  166. data/lib/univapay_client_sdk/models/subscription_payment.rb +185 -0
  167. data/lib/univapay_client_sdk/models/subscription_payment_list.rb +94 -0
  168. data/lib/univapay_client_sdk/models/subscription_payment_webhook_callback.rb +132 -0
  169. data/lib/univapay_client_sdk/models/subscription_period.rb +56 -0
  170. data/lib/univapay_client_sdk/models/subscription_plan_settings.rb +98 -0
  171. data/lib/univapay_client_sdk/models/subscription_schedule_settings.rb +132 -0
  172. data/lib/univapay_client_sdk/models/subscription_status.rb +56 -0
  173. data/lib/univapay_client_sdk/models/subscription_suspend_request.rb +79 -0
  174. data/lib/univapay_client_sdk/models/subscription_suspended_webhook_callback.rb +132 -0
  175. data/lib/univapay_client_sdk/models/subscription_terminate_with_status.rb +36 -0
  176. data/lib/univapay_client_sdk/models/subscription_termination_mode.rb +36 -0
  177. data/lib/univapay_client_sdk/models/subscription_update_next_payment.rb +104 -0
  178. data/lib/univapay_client_sdk/models/subscription_update_request.rb +134 -0
  179. data/lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb +110 -0
  180. data/lib/univapay_client_sdk/models/subscription_update_status.rb +37 -0
  181. data/lib/univapay_client_sdk/models/subscription_user_data.rb +134 -0
  182. data/lib/univapay_client_sdk/models/suspend_schedule_settings.rb +78 -0
  183. data/lib/univapay_client_sdk/models/three_ds_issuer_token.rb +116 -0
  184. data/lib/univapay_client_sdk/models/three_ds_issuer_token_call_method.rb +26 -0
  185. data/lib/univapay_client_sdk/models/three_ds_issuer_token_payment_type.rb +26 -0
  186. data/lib/univapay_client_sdk/models/token_create_bank_transfer_data.rb +122 -0
  187. data/lib/univapay_client_sdk/models/token_create_card_data.rb +231 -0
  188. data/lib/univapay_client_sdk/models/token_create_card_data_cvv_authorize.rb +95 -0
  189. data/lib/univapay_client_sdk/models/token_create_card_data_three_ds.rb +97 -0
  190. data/lib/univapay_client_sdk/models/token_create_konbini_data.rb +147 -0
  191. data/lib/univapay_client_sdk/models/token_create_online_data.rb +142 -0
  192. data/lib/univapay_client_sdk/models/token_create_phone_number.rb +104 -0
  193. data/lib/univapay_client_sdk/models/token_created_webhook_callback.rb +131 -0
  194. data/lib/univapay_client_sdk/models/token_cvv_auth_check_updated_webhook_callback.rb +132 -0
  195. data/lib/univapay_client_sdk/models/token_cvv_auth_updated_webhook_callback.rb +132 -0
  196. data/lib/univapay_client_sdk/models/token_replaced_webhook_callback.rb +131 -0
  197. data/lib/univapay_client_sdk/models/token_response_bank_transfer_data.rb +181 -0
  198. data/lib/univapay_client_sdk/models/token_response_card_data.rb +129 -0
  199. data/lib/univapay_client_sdk/models/token_response_card_data_billing.rb +153 -0
  200. data/lib/univapay_client_sdk/models/token_response_card_data_card.rb +187 -0
  201. data/lib/univapay_client_sdk/models/token_response_card_data_cvv_authorize.rb +132 -0
  202. data/lib/univapay_client_sdk/models/token_response_card_data_cvv_authorize_check.rb +118 -0
  203. data/lib/univapay_client_sdk/models/token_response_card_data_three_ds.rb +142 -0
  204. data/lib/univapay_client_sdk/models/token_response_card_data_three_ds_status.rb +48 -0
  205. data/lib/univapay_client_sdk/models/token_response_konbini_data.rb +135 -0
  206. data/lib/univapay_client_sdk/models/token_response_online_data.rb +158 -0
  207. data/lib/univapay_client_sdk/models/token_response_phone_number.rb +96 -0
  208. data/lib/univapay_client_sdk/models/token_three_ds_updated_webhook_callback.rb +132 -0
  209. data/lib/univapay_client_sdk/models/token_updated_webhook_callback.rb +131 -0
  210. data/lib/univapay_client_sdk/models/transaction_token.rb +250 -0
  211. data/lib/univapay_client_sdk/models/transaction_token_create_request.rb +161 -0
  212. data/lib/univapay_client_sdk/models/transaction_token_create_request_metadata.rb +124 -0
  213. data/lib/univapay_client_sdk/models/transaction_token_create_request_payment_type.rb +44 -0
  214. data/lib/univapay_client_sdk/models/transaction_token_create_request_type.rb +40 -0
  215. data/lib/univapay_client_sdk/models/transaction_token_list.rb +104 -0
  216. data/lib/univapay_client_sdk/models/transaction_token_list_item.rb +204 -0
  217. data/lib/univapay_client_sdk/models/transaction_token_list_item_user_data.rb +96 -0
  218. data/lib/univapay_client_sdk/models/transaction_token_mode.rb +36 -0
  219. data/lib/univapay_client_sdk/models/transaction_token_payment_type.rb +48 -0
  220. data/lib/univapay_client_sdk/models/transaction_token_type.rb +40 -0
  221. data/lib/univapay_client_sdk/models/transaction_token_update_request.rb +95 -0
  222. data/lib/univapay_client_sdk/models/transaction_token_update_request_data.rb +184 -0
  223. data/lib/univapay_client_sdk/models/transaction_token_update_request_data_phone_number.rb +86 -0
  224. data/lib/univapay_client_sdk/models/webhook.rb +191 -0
  225. data/lib/univapay_client_sdk/models/webhook_callback_envelope.rb +98 -0
  226. data/lib/univapay_client_sdk/models/webhook_create_request.rb +97 -0
  227. data/lib/univapay_client_sdk/models/webhook_event.rb +166 -0
  228. data/lib/univapay_client_sdk/models/webhook_event_list.rb +94 -0
  229. data/lib/univapay_client_sdk/models/webhook_list.rb +94 -0
  230. data/lib/univapay_client_sdk/models/webhook_trigger.rb +104 -0
  231. data/lib/univapay_client_sdk/models/webhook_update_request.rb +108 -0
  232. data/lib/univapay_client_sdk/utilities/date_time_helper.rb +11 -0
  233. data/lib/univapay_client_sdk/utilities/file_wrapper.rb +28 -0
  234. data/lib/univapay_client_sdk/utilities/union_type_lookup.rb +242 -0
  235. data/lib/univapay_client_sdk.rb +322 -0
  236. data/test/apis/api_test_base.rb +23 -0
  237. data/test/apis/test_cancels_api.rb +162 -0
  238. data/test/apis/test_charges_api.rb +564 -0
  239. data/test/apis/test_merchants_api.rb +50 -0
  240. data/test/apis/test_refunds_api.rb +172 -0
  241. data/test/apis/test_stores_api.rb +86 -0
  242. data/test/apis/test_subscriptions_api.rb +579 -0
  243. data/test/apis/test_transaction_tokens_api.rb +305 -0
  244. data/test/apis/test_webhooks_api.rb +245 -0
  245. data/test/events/webhooks/test_bank_transfer_handler.rb +95 -0
  246. data/test/events/webhooks/test_cancel_handler.rb +90 -0
  247. data/test/events/webhooks/test_charge_finished_handler.rb +95 -0
  248. data/test/events/webhooks/test_charge_updated_handler.rb +95 -0
  249. data/test/events/webhooks/test_customs_handler.rb +100 -0
  250. data/test/events/webhooks/test_recurring_token_deleted_handler.rb +92 -0
  251. data/test/events/webhooks/test_refund_handler.rb +95 -0
  252. data/test/events/webhooks/test_subscription_canceled_handler.rb +101 -0
  253. data/test/events/webhooks/test_subscription_completed_handler.rb +101 -0
  254. data/test/events/webhooks/test_subscription_created_handler.rb +101 -0
  255. data/test/events/webhooks/test_subscription_failure_handler.rb +101 -0
  256. data/test/events/webhooks/test_subscription_payment_handler.rb +101 -0
  257. data/test/events/webhooks/test_subscription_suspended_handler.rb +101 -0
  258. data/test/events/webhooks/test_token_created_handler.rb +92 -0
  259. data/test/events/webhooks/test_token_cvv_auth_check_updated_handler.rb +92 -0
  260. data/test/events/webhooks/test_token_cvv_auth_updated_handler.rb +92 -0
  261. data/test/events/webhooks/test_token_replaced_handler.rb +92 -0
  262. data/test/events/webhooks/test_token_three_ds_updated_handler.rb +92 -0
  263. data/test/events/webhooks/test_token_updated_handler.rb +92 -0
  264. data/test/framework_integrations/rails_app_test_helper.rb +14 -0
  265. data/test/framework_integrations/webhooks/apps/hanami_charge_updated_app.rb +61 -0
  266. data/test/framework_integrations/webhooks/apps/rails_charge_updated_app.rb +24 -0
  267. data/test/framework_integrations/webhooks/apps/sinatra_charge_updated_app.rb +27 -0
  268. data/test/framework_integrations/webhooks/test/test_hanami_charge_updated_app.rb +57 -0
  269. data/test/framework_integrations/webhooks/test/test_rails_charge_updated_app.rb +57 -0
  270. data/test/framework_integrations/webhooks/test/test_sinatra_charge_updated_app.rb +58 -0
  271. data/test/http_response_catcher.rb +19 -0
  272. metadata +397 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1bcfafb19181c51d0afce930617b19b414f2174cd975a3f677893b64c2107dd0
4
+ data.tar.gz: 84a9765dc7bc44877cd1eb08b1cf21f3ee9201e3b32b88c7cea3c6643c0a81ef
5
+ SHA512:
6
+ metadata.gz: bc20723299cead99bfcb8bc57ad0167224fb35a5299066e0fa1e7a27bbc67d3fffac1ad8a18a7b502e5d49037500dfc1f99177fe96ac0723e57671b2b0eb473f
7
+ data.tar.gz: a0005cba2c26ef46d699518bdc5c99c5252fc2a1ae3107b7840a910be0315f0f046ecab803fe26fc26bf3b2f34dccbb5079f5b8a311f5d2fc72387d75e9b7588
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2026 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,224 @@
1
+
2
+ # Getting Started with Univapay Public API
3
+
4
+ ## Introduction
5
+
6
+ OpenAPI specification for the Univapay Online Payment API.
7
+
8
+ ### Authentication (JWT)
9
+
10
+ This API uses JWT (JSON Web Tokens) for authentication via the HTTP `Authorization` header. To authenticate, you must generate an **Application Token** in the Univapay dashboard. This generates two components: 1. **Token (`{jwt}`)** 2. **Secret (`{secret}`)**
11
+
12
+ #### ⚠️ Security Warning
13
+
14
+ The **Secret** grants extensive privileges (e.g., creating charges, capturing authorized card charges, refunding).
15
+ **NEVER expose the `{secret}` in frontend application code** (e.g., consumer browsers) or public repositories. It is strictly for backend server-to-server communication.
16
+ *Univapay is not responsible for accidents caused by leaked secrets.*
17
+
18
+ #### Bearer Auth Formats
19
+
20
+ Depending on where you are calling the API from, the Bearer format changes:
21
+
22
+ * **Frontend / Browser (No Secret)**: `Bearer {jwt}`
23
+ *(Used for Widgets or Inline Forms. You must register your allowed domains in the dashboard when creating the token).*
24
+ * **Backend / Server (With Secret)**: `Bearer {secret}.{jwt}`
25
+ *(Required for all backend processing).*
26
+
27
+ We will assume that all requests are going to originate from a backend server thus, all requests will require the secret
28
+
29
+ #### Token Types
30
+
31
+ * **Store Token**: Grants full access to requests for that specific store.
32
+ * **Merchant Token**: Can't create transaction tokens but can access data from multiple stores.
33
+
34
+ ## Install the Package
35
+
36
+ Install the gem from the command line:
37
+
38
+ ```bash
39
+ gem install univapay-apimatic-sdk -v 0.0.1
40
+ ```
41
+
42
+ Or add the gem to your Gemfile and run `bundle`:
43
+
44
+ ```ruby
45
+ gem 'univapay-apimatic-sdk', '0.0.1'
46
+ ```
47
+
48
+ For additional gem details, see the [RubyGems page for the univapay-apimatic-sdk gem](https://rubygems.org/gems/univapay-apimatic-sdk/versions/0.0.1).
49
+
50
+ ## IRB Console Usage
51
+
52
+ You can explore the SDK interactively using IRB in two ways
53
+
54
+ ### 1. Use IRB with Installed Gem
55
+
56
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
57
+
58
+ ```bash
59
+ irb
60
+ ```
61
+
62
+ Now you can load the SDK in the IRB
63
+
64
+ ```ruby
65
+ require 'univapay_client_sdk'
66
+ include UnivapayClientSdk
67
+ ```
68
+
69
+ ### 2. Use IRB within SDK
70
+
71
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
72
+
73
+ ```
74
+ cd path/to/univapay_client_sdk
75
+ ```
76
+
77
+ Now you can start the preconfigured irb console by running the following command
78
+
79
+ ```bash
80
+ ruby bin/console
81
+ ```
82
+
83
+ **_Note:_** This automatically loads the SDK from lib/
84
+
85
+ ## Test the SDK
86
+
87
+ To run the tests, navigate to the root directory of the SDK in your terminal and execute the following command:
88
+
89
+ ```
90
+ rake
91
+ ```
92
+
93
+ ## Initialize the API Client
94
+
95
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/client.md)
96
+
97
+ The following parameters are configurable for the API Client:
98
+
99
+ | Parameter | Type | Description |
100
+ | --- | --- | --- |
101
+ | base_url | `String` | Base URL for the API<br>*Default*: `'https://api.univapay.com'` |
102
+ | environment | [`Environment`](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/README.md#environments) | The API environment. <br> **Default: `Environment.PRODUCTION`** |
103
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
104
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
105
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
106
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
107
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
108
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
109
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
110
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
111
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
112
+ | proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
113
+ | logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
114
+ | bearer_auth_credentials | [`BearerAuthCredentials`](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-bearer-token.md) | The credential object for OAuth 2 Bearer token |
115
+
116
+ The API client can be initialized as follows:
117
+
118
+ ### Code-Based Client Initialization
119
+
120
+ ```ruby
121
+ require 'univapay_client_sdk'
122
+ include UnivapayClientSdk
123
+
124
+ client = Client.new(
125
+ bearer_auth_credentials: BearerAuthCredentials.new(
126
+ access_token: 'AccessToken'
127
+ ),
128
+ environment: Environment::PRODUCTION,
129
+ base_url: 'https://api.univapay.com',
130
+ logging_configuration: LoggingConfiguration.new(
131
+ log_level: Logger::INFO,
132
+ request_logging_config: RequestLoggingConfiguration.new(
133
+ log_body: true
134
+ ),
135
+ response_logging_config: ResponseLoggingConfiguration.new(
136
+ log_headers: true
137
+ )
138
+ )
139
+ )
140
+ ```
141
+
142
+ ### Environment-Based Client Initialization
143
+
144
+ ```ruby
145
+ require 'univapay_client_sdk'
146
+ include UnivapayClientSdk
147
+
148
+ # Create client from environment
149
+ client = Client.from_env
150
+ ```
151
+
152
+ See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md) section for details.
153
+
154
+ ## Environments
155
+
156
+ The SDK can be configured to use a different environment for making API calls. Available environments are:
157
+
158
+ ### Fields
159
+
160
+ | Name | Description |
161
+ | --- | --- |
162
+ | PRODUCTION | **Default** Production Server |
163
+
164
+ ## Authorization
165
+
166
+ This API uses the following authentication schemes.
167
+
168
+ * [`JWT_TOKEN (OAuth 2 Bearer token)`](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-bearer-token.md)
169
+
170
+ ## List of APIs
171
+
172
+ * [Transaction Tokens](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/transaction-tokens.md)
173
+ * [Charges](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/charges.md)
174
+ * [Refunds](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/refunds.md)
175
+ * [Subscriptions](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/subscriptions.md)
176
+ * [Cancels](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/cancels.md)
177
+ * [Merchants](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/merchants.md)
178
+ * [Stores](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/stores.md)
179
+ * [Webhooks](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/webhooks.md)
180
+
181
+ ## Webhooks
182
+
183
+ * [Charge Updated](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/charge-updated-handler.md)
184
+ * [Charge Finished](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/charge-finished-handler.md)
185
+ * [Token Created](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/token-created-handler.md)
186
+ * [Token Updated](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/token-updated-handler.md)
187
+ * [Token Three Ds Updated](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/token-three-ds-updated-handler.md)
188
+ * [Token Cvv Auth Updated](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/token-cvv-auth-updated-handler.md)
189
+ * [Token Cvv Auth Check Updated](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/token-cvv-auth-check-updated-handler.md)
190
+ * [Token Replaced](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/token-replaced-handler.md)
191
+ * [Recurring Token Deleted](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/recurring-token-deleted-handler.md)
192
+ * [Refund](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/refund-handler.md)
193
+ * [Cancel](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/cancel-handler.md)
194
+ * [Subscription Created](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/subscription-created-handler.md)
195
+ * [Subscription Payment](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/subscription-payment-handler.md)
196
+ * [Subscription Completed](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/subscription-completed-handler.md)
197
+ * [Subscription Failure](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/subscription-failure-handler.md)
198
+ * [Subscription Canceled](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/subscription-canceled-handler.md)
199
+ * [Subscription Suspended](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/subscription-suspended-handler.md)
200
+ * [Bank-Transfer](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/bank-transfer-handler.md)
201
+ * [Customs](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/events/webhooks/customs-handler.md)
202
+
203
+ ## SDK Infrastructure
204
+
205
+ ### Configuration
206
+
207
+ * [ProxySettings](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/proxy-settings.md)
208
+ * [Environment-Based Client Initialization](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md)
209
+ * [AbstractLogger](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/abstract-logger.md)
210
+ * [LoggingConfiguration](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/logging-configuration.md)
211
+ * [RequestLoggingConfiguration](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/request-logging-configuration.md)
212
+ * [ResponseLoggingConfiguration](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/response-logging-configuration.md)
213
+
214
+ ### HTTP
215
+
216
+ * [HttpResponse](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/http-response.md)
217
+ * [HttpRequest](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/http-request.md)
218
+
219
+ ### Utilities
220
+
221
+ * [ApiResponse](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/api-response.md)
222
+ * [ApiHelper](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/api-helper.md)
223
+ * [DateTimeHelper](https://www.github.com/sdks-io/univapay-apimatic-ruby-sdk/tree/0.0.1/doc/date-time-helper.md)
224
+
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Load the lib folder into Ruby's load path
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
+
6
+ # Require the gem
7
+ require 'univapay_client_sdk'
8
+
9
+ puts 'UnivapayClientSdk SDK loaded!'
10
+ puts 'You can now create a client with: client = UnivapayClientSdk::Client.new'
11
+ puts 'Or use from_env: client = UnivapayClientSdk::Client.from_env'
12
+
13
+ # Start an interactive IRB session
14
+ require 'irb'
15
+ IRB.start
@@ -0,0 +1,10 @@
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
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,67 @@
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
+ # BaseApi.
8
+ class BaseApi
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'Ruby-SDK/0.0.1 (OS: {os-info}, Engine: {engine}/{engine-version})'
14
+ end
15
+
16
+ def self.user_agent_parameters
17
+ {
18
+ '{engine}' => { 'value' => RUBY_ENGINE, 'encode' => false },
19
+ '{engine-version}' => { 'value' => RUBY_ENGINE_VERSION, 'encode' => false },
20
+ '{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false }
21
+ }
22
+ end
23
+
24
+ GLOBAL_ERRORS = {
25
+ 'default' => ErrorCase.new
26
+ .error_message('HTTP response not OK.')
27
+ .exception_type(APIException)
28
+ }.freeze
29
+
30
+ # Initialization constructor.
31
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
32
+ def initialize(global_configuration)
33
+ @global_configuration = global_configuration
34
+ @config = @global_configuration.client_configuration
35
+ @http_call_back = @config.http_callback
36
+ @api_call = ApiCall.new(@global_configuration)
37
+ end
38
+
39
+ # Creates a new instance of the request builder.
40
+ # @param [String] http_method The HTTP method to use in the request.
41
+ # @param [String] path The endpoint path to use in the request.
42
+ # @param [String] server The server to extract the base uri for the request.
43
+ # @return [RequestBuilder] The instance of RequestBuilder.
44
+ def new_request_builder(http_method, path, server)
45
+ RequestBuilder.new
46
+ .http_method(http_method)
47
+ .path(path)
48
+ .server(server)
49
+ end
50
+
51
+ # Creates a new instance of the response handler.
52
+ # @return [ResponseHandler] The instance of ResponseHandler.
53
+ def new_response_handler
54
+ ResponseHandler.new
55
+ end
56
+
57
+ # Creates a new instance of the parameter.
58
+ # @param [String|optional] key The key of the parameter.
59
+ # @param [Object] value The value of the parameter.
60
+ # @return [Parameter] The instance of Parameter.
61
+ def new_parameter(value, key: nil)
62
+ Parameter.new
63
+ .key(key)
64
+ .value(value)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,293 @@
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
+ # CancelsApi
8
+ class CancelsApi < BaseApi
9
+ # Returns a paginated list of cancels for the specified charge.
10
+ # @param [UUID | String] store_id Required parameter: The unique identifier
11
+ # of the store.
12
+ # @param [UUID | String] charge_id Required parameter: The unique identifier
13
+ # of the charge.
14
+ # @param [Integer] limit Optional parameter: Maximum number of resources to
15
+ # return in one page.
16
+ # @param [UUID | String] cursor Optional parameter: Cursor pointing to the
17
+ # resource after which pagination should continue.
18
+ # @param [CursorDirectionQuery] cursor_direction Optional parameter:
19
+ # Pagination direction relative to the supplied cursor.
20
+ # @return [ApiResponse] Complete http response with raw body and status code.
21
+ def list_cancels(store_id,
22
+ charge_id,
23
+ limit: 10,
24
+ cursor: nil,
25
+ cursor_direction: CursorDirectionQuery::DESC)
26
+ @api_call
27
+ .request(new_request_builder(HttpMethodEnum::GET,
28
+ '/stores/{storeId}/charges/{chargeId}/cancels',
29
+ Server::DEFAULT)
30
+ .template_param(new_parameter(store_id, key: 'storeId')
31
+ .is_required(true)
32
+ .should_encode(true))
33
+ .template_param(new_parameter(charge_id, key: 'chargeId')
34
+ .is_required(true)
35
+ .should_encode(true))
36
+ .query_param(new_parameter(limit, key: 'limit'))
37
+ .query_param(new_parameter(cursor, key: 'cursor'))
38
+ .query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
39
+ .header_param(new_parameter('application/json', key: 'accept'))
40
+ .auth(Single.new('JWT_TOKEN')))
41
+ .response(new_response_handler
42
+ .deserializer(APIHelper.method(:custom_type_deserializer))
43
+ .deserialize_into(CancelList.method(:from_hash))
44
+ .is_api_response(true)
45
+ .local_error_template('401',
46
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
47
+ ApiErrorException)
48
+ .local_error_template('404',
49
+ 'HTTP 404 Not Found: {$response.body#/code}',
50
+ ApiErrorException)
51
+ .local_error_template('400',
52
+ 'HTTP 400 Bad Request: {$response.body#/code}',
53
+ APIException)
54
+ .local_error_template('403',
55
+ 'HTTP 403 Forbidden: {$response.body#/code}',
56
+ APIException)
57
+ .local_error_template('409',
58
+ 'HTTP 409 Conflict: {$response.body#/code}',
59
+ APIException)
60
+ .local_error_template('429',
61
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
62
+ APIException)
63
+ .local_error_template('500',
64
+ 'HTTP 500 Server Error: {$response.body#/code}',
65
+ APIException)
66
+ .local_error_template('503',
67
+ 'HTTP 503 Unavailable: {$response.body#/code}',
68
+ APIException)
69
+ .local_error_template('504',
70
+ 'HTTP 504 Timeout: {$response.body#/code}',
71
+ APIException)
72
+ .local_error_template('default',
73
+ 'HTTP {$statusCode}: {$response.body#/code}',
74
+ APIException))
75
+ .execute
76
+ end
77
+
78
+ # Creates a new cancellation request for a charge. The charge must be in a
79
+ # cancellable state. Bank transfer and konbini charges that have already
80
+ # been paid cannot be cancelled
81
+ # @param [UUID | String] store_id Required parameter: The unique identifier
82
+ # of the store.
83
+ # @param [UUID | String] charge_id Required parameter: The unique identifier
84
+ # of the charge.
85
+ # @param [String] idempotency_key Optional parameter: An optional
86
+ # idempotency key to prevent double charges and duplicate operations. We
87
+ # recommend a randomly generated UUID (v4).
88
+ # @param [CancelCreateRequest] body Optional parameter: Optional metadata
89
+ # payload for creating a cancel.
90
+ # @return [ApiResponse] Complete http response with raw body and status code.
91
+ def create_cancel(store_id,
92
+ charge_id,
93
+ idempotency_key: nil,
94
+ body: nil)
95
+ @api_call
96
+ .request(new_request_builder(HttpMethodEnum::POST,
97
+ '/stores/{storeId}/charges/{chargeId}/cancels',
98
+ Server::DEFAULT)
99
+ .template_param(new_parameter(store_id, key: 'storeId')
100
+ .is_required(true)
101
+ .should_encode(true))
102
+ .template_param(new_parameter(charge_id, key: 'chargeId')
103
+ .is_required(true)
104
+ .should_encode(true))
105
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
106
+ .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
107
+ .body_param(new_parameter(body))
108
+ .header_param(new_parameter('application/json', key: 'accept'))
109
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
110
+ .auth(Single.new('JWT_TOKEN')))
111
+ .response(new_response_handler
112
+ .deserializer(APIHelper.method(:custom_type_deserializer))
113
+ .deserialize_into(Cancel.method(:from_hash))
114
+ .is_api_response(true)
115
+ .local_error_template('400',
116
+ 'HTTP 400 Bad Request: {$response.body#/code}',
117
+ ApiErrorException)
118
+ .local_error_template('401',
119
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
120
+ ApiErrorException)
121
+ .local_error_template('404',
122
+ 'HTTP 404 Not Found: {$response.body#/code}',
123
+ ApiErrorException)
124
+ .local_error_template('403',
125
+ 'HTTP 403 Forbidden: {$response.body#/code}',
126
+ APIException)
127
+ .local_error_template('409',
128
+ 'HTTP 409 Conflict: {$response.body#/code}',
129
+ APIException)
130
+ .local_error_template('429',
131
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
132
+ APIException)
133
+ .local_error_template('500',
134
+ 'HTTP 500 Server Error: {$response.body#/code}',
135
+ APIException)
136
+ .local_error_template('503',
137
+ 'HTTP 503 Unavailable: {$response.body#/code}',
138
+ APIException)
139
+ .local_error_template('504',
140
+ 'HTTP 504 Timeout: {$response.body#/code}',
141
+ APIException)
142
+ .local_error_template('default',
143
+ 'HTTP {$statusCode}: {$response.body#/code}',
144
+ APIException))
145
+ .execute
146
+ end
147
+
148
+ # Retrieves a specific cancel by ID. Supports long-polling by appending
149
+ # `?polling=true` to wait for a status change (up to the server timeout).
150
+ # Requires a secret-bearing token.
151
+ # @param [UUID | String] store_id Required parameter: The unique identifier
152
+ # of the store.
153
+ # @param [UUID | String] charge_id Required parameter: The unique identifier
154
+ # of the charge.
155
+ # @param [UUID | String] id Required parameter: The unique identifier of the
156
+ # resource.
157
+ # @param [TrueClass | FalseClass] polling Optional parameter: If `true`, the
158
+ # server holds the connection open until the cancel status changes or the
159
+ # polling timeout is reached.
160
+ # @return [ApiResponse] Complete http response with raw body and status code.
161
+ def get_cancel(store_id,
162
+ charge_id,
163
+ id,
164
+ polling: false)
165
+ @api_call
166
+ .request(new_request_builder(HttpMethodEnum::GET,
167
+ '/stores/{storeId}/charges/{chargeId}/cancels/{id}',
168
+ Server::DEFAULT)
169
+ .template_param(new_parameter(store_id, key: 'storeId')
170
+ .is_required(true)
171
+ .should_encode(true))
172
+ .template_param(new_parameter(charge_id, key: 'chargeId')
173
+ .is_required(true)
174
+ .should_encode(true))
175
+ .template_param(new_parameter(id, key: 'id')
176
+ .is_required(true)
177
+ .should_encode(true))
178
+ .query_param(new_parameter(polling, key: 'polling'))
179
+ .header_param(new_parameter('application/json', key: 'accept'))
180
+ .auth(Single.new('JWT_TOKEN')))
181
+ .response(new_response_handler
182
+ .deserializer(APIHelper.method(:custom_type_deserializer))
183
+ .deserialize_into(Cancel.method(:from_hash))
184
+ .is_api_response(true)
185
+ .local_error_template('401',
186
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
187
+ ApiErrorException)
188
+ .local_error_template('404',
189
+ 'HTTP 404 Not Found: {$response.body#/code}',
190
+ ApiErrorException)
191
+ .local_error_template('400',
192
+ 'HTTP 400 Bad Request: {$response.body#/code}',
193
+ APIException)
194
+ .local_error_template('403',
195
+ 'HTTP 403 Forbidden: {$response.body#/code}',
196
+ APIException)
197
+ .local_error_template('409',
198
+ 'HTTP 409 Conflict: {$response.body#/code}',
199
+ APIException)
200
+ .local_error_template('429',
201
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
202
+ APIException)
203
+ .local_error_template('500',
204
+ 'HTTP 500 Server Error: {$response.body#/code}',
205
+ APIException)
206
+ .local_error_template('503',
207
+ 'HTTP 503 Unavailable: {$response.body#/code}',
208
+ APIException)
209
+ .local_error_template('504',
210
+ 'HTTP 504 Timeout: {$response.body#/code}',
211
+ APIException)
212
+ .local_error_template('default',
213
+ 'HTTP {$statusCode}: {$response.body#/code}',
214
+ APIException))
215
+ .execute
216
+ end
217
+
218
+ # Updates metadata on an existing cancel. Requires a secret-bearing token.
219
+ # @param [UUID | String] store_id Required parameter: The unique identifier
220
+ # of the store.
221
+ # @param [UUID | String] charge_id Required parameter: The unique identifier
222
+ # of the charge.
223
+ # @param [UUID | String] id Required parameter: The unique identifier of the
224
+ # resource.
225
+ # @param [CancelUpdateRequest] body Required parameter: Request payload for
226
+ # updating cancel metadata.
227
+ # @param [String] idempotency_key Optional parameter: An optional
228
+ # idempotency key to prevent double charges and duplicate operations. We
229
+ # recommend a randomly generated UUID (v4).
230
+ # @return [ApiResponse] Complete http response with raw body and status code.
231
+ def update_cancel(store_id,
232
+ charge_id,
233
+ id,
234
+ body,
235
+ idempotency_key: nil)
236
+ @api_call
237
+ .request(new_request_builder(HttpMethodEnum::PATCH,
238
+ '/stores/{storeId}/charges/{chargeId}/cancels/{id}',
239
+ Server::DEFAULT)
240
+ .template_param(new_parameter(store_id, key: 'storeId')
241
+ .is_required(true)
242
+ .should_encode(true))
243
+ .template_param(new_parameter(charge_id, key: 'chargeId')
244
+ .is_required(true)
245
+ .should_encode(true))
246
+ .template_param(new_parameter(id, key: 'id')
247
+ .is_required(true)
248
+ .should_encode(true))
249
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
250
+ .body_param(new_parameter(body)
251
+ .is_required(true))
252
+ .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
253
+ .header_param(new_parameter('application/json', key: 'accept'))
254
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
255
+ .auth(Single.new('JWT_TOKEN')))
256
+ .response(new_response_handler
257
+ .deserializer(APIHelper.method(:custom_type_deserializer))
258
+ .deserialize_into(Cancel.method(:from_hash))
259
+ .is_api_response(true)
260
+ .local_error_template('400',
261
+ 'HTTP 400 Bad Request: {$response.body#/code}',
262
+ ApiErrorException)
263
+ .local_error_template('401',
264
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
265
+ ApiErrorException)
266
+ .local_error_template('403',
267
+ 'HTTP 403 Forbidden: {$response.body#/code}',
268
+ ApiErrorException)
269
+ .local_error_template('404',
270
+ 'HTTP 404 Not Found: {$response.body#/code}',
271
+ ApiErrorException)
272
+ .local_error_template('409',
273
+ 'HTTP 409 Conflict: {$response.body#/code}',
274
+ APIException)
275
+ .local_error_template('429',
276
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
277
+ APIException)
278
+ .local_error_template('500',
279
+ 'HTTP 500 Server Error: {$response.body#/code}',
280
+ APIException)
281
+ .local_error_template('503',
282
+ 'HTTP 503 Unavailable: {$response.body#/code}',
283
+ APIException)
284
+ .local_error_template('504',
285
+ 'HTTP 504 Timeout: {$response.body#/code}',
286
+ APIException)
287
+ .local_error_template('default',
288
+ 'HTTP {$statusCode}: {$response.body#/code}',
289
+ APIException))
290
+ .execute
291
+ end
292
+ end
293
+ end