onlinepayments-sdk-ruby 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +2 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +140 -0
  5. data/Rakefile +34 -0
  6. data/lib/onlinepayments/sdk/api_exception.rb +42 -0
  7. data/lib/onlinepayments/sdk/api_resource.rb +115 -0
  8. data/lib/onlinepayments/sdk/authenticator.rb +16 -0
  9. data/lib/onlinepayments/sdk/authorization_exception.rb +13 -0
  10. data/lib/onlinepayments/sdk/call_context.rb +26 -0
  11. data/lib/onlinepayments/sdk/client.rb +82 -0
  12. data/lib/onlinepayments/sdk/communication_exception.rb +16 -0
  13. data/lib/onlinepayments/sdk/communicator.rb +300 -0
  14. data/lib/onlinepayments/sdk/communicator_configuration.rb +59 -0
  15. data/lib/onlinepayments/sdk/connection.rb +41 -0
  16. data/lib/onlinepayments/sdk/data_object.rb +31 -0
  17. data/lib/onlinepayments/sdk/declined_payment_exception.rb +30 -0
  18. data/lib/onlinepayments/sdk/declined_payout_exception.rb +32 -0
  19. data/lib/onlinepayments/sdk/declined_refund_exception.rb +32 -0
  20. data/lib/onlinepayments/sdk/declined_transaction_exception.rb +16 -0
  21. data/lib/onlinepayments/sdk/defaultimpl/authorization_type.rb +24 -0
  22. data/lib/onlinepayments/sdk/defaultimpl/default_authenticator.rb +108 -0
  23. data/lib/onlinepayments/sdk/defaultimpl/default_connection.rb +295 -0
  24. data/lib/onlinepayments/sdk/defaultimpl/default_marshaller.rb +32 -0
  25. data/lib/onlinepayments/sdk/defaultimpl.rb +6 -0
  26. data/lib/onlinepayments/sdk/domain/account_on_file.rb +49 -0
  27. data/lib/onlinepayments/sdk/domain/account_on_file_attribute.rb +38 -0
  28. data/lib/onlinepayments/sdk/domain/account_on_file_display_hints.rb +37 -0
  29. data/lib/onlinepayments/sdk/domain/additional_order_input.rb +54 -0
  30. data/lib/onlinepayments/sdk/domain/address.rb +50 -0
  31. data/lib/onlinepayments/sdk/domain/address_personal.rb +58 -0
  32. data/lib/onlinepayments/sdk/domain/airline_data.rb +128 -0
  33. data/lib/onlinepayments/sdk/domain/airline_flight_leg.rb +102 -0
  34. data/lib/onlinepayments/sdk/domain/airline_passenger.rb +38 -0
  35. data/lib/onlinepayments/sdk/domain/amount_breakdown.rb +30 -0
  36. data/lib/onlinepayments/sdk/domain/amount_of_money.rb +30 -0
  37. data/lib/onlinepayments/sdk/domain/api_error.rb +46 -0
  38. data/lib/onlinepayments/sdk/domain/bank_account_iban.rb +26 -0
  39. data/lib/onlinepayments/sdk/domain/browser_data.rb +42 -0
  40. data/lib/onlinepayments/sdk/domain/cancel_payment_response.rb +30 -0
  41. data/lib/onlinepayments/sdk/domain/capture.rb +46 -0
  42. data/lib/onlinepayments/sdk/domain/capture_output.rb +82 -0
  43. data/lib/onlinepayments/sdk/domain/capture_payment_request.rb +38 -0
  44. data/lib/onlinepayments/sdk/domain/capture_response.rb +46 -0
  45. data/lib/onlinepayments/sdk/domain/capture_status_output.rb +26 -0
  46. data/lib/onlinepayments/sdk/domain/captures_response.rb +33 -0
  47. data/lib/onlinepayments/sdk/domain/card.rb +38 -0
  48. data/lib/onlinepayments/sdk/domain/card_essentials.rb +34 -0
  49. data/lib/onlinepayments/sdk/domain/card_fraud_results.rb +34 -0
  50. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input.rb +98 -0
  51. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input_base.rb +86 -0
  52. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input_for_hosted_checkout.rb +26 -0
  53. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_output.rb +78 -0
  54. data/lib/onlinepayments/sdk/domain/card_payout_method_specific_input.rb +38 -0
  55. data/lib/onlinepayments/sdk/domain/card_recurrence_details.rb +26 -0
  56. data/lib/onlinepayments/sdk/domain/card_without_cvv.rb +34 -0
  57. data/lib/onlinepayments/sdk/domain/company_information.rb +26 -0
  58. data/lib/onlinepayments/sdk/domain/complete_payment_card_payment_method_specific_input.rb +30 -0
  59. data/lib/onlinepayments/sdk/domain/complete_payment_request.rb +38 -0
  60. data/lib/onlinepayments/sdk/domain/complete_payment_response.rb +46 -0
  61. data/lib/onlinepayments/sdk/domain/contact_details.rb +42 -0
  62. data/lib/onlinepayments/sdk/domain/create_hosted_checkout_request.rb +78 -0
  63. data/lib/onlinepayments/sdk/domain/create_hosted_checkout_response.rb +48 -0
  64. data/lib/onlinepayments/sdk/domain/create_hosted_tokenization_request.rb +38 -0
  65. data/lib/onlinepayments/sdk/domain/create_hosted_tokenization_response.rb +50 -0
  66. data/lib/onlinepayments/sdk/domain/create_mandate_request.rb +58 -0
  67. data/lib/onlinepayments/sdk/domain/create_mandate_response.rb +38 -0
  68. data/lib/onlinepayments/sdk/domain/create_mandate_with_return_url.rb +58 -0
  69. data/lib/onlinepayments/sdk/domain/create_payment_request.rb +74 -0
  70. data/lib/onlinepayments/sdk/domain/create_payment_response.rb +46 -0
  71. data/lib/onlinepayments/sdk/domain/create_payout_request.rb +46 -0
  72. data/lib/onlinepayments/sdk/domain/create_token_request.rb +34 -0
  73. data/lib/onlinepayments/sdk/domain/created_payment_output.rb +34 -0
  74. data/lib/onlinepayments/sdk/domain/created_token_response.rb +50 -0
  75. data/lib/onlinepayments/sdk/domain/customer.rb +86 -0
  76. data/lib/onlinepayments/sdk/domain/customer_account.rb +70 -0
  77. data/lib/onlinepayments/sdk/domain/customer_account_authentication.rb +30 -0
  78. data/lib/onlinepayments/sdk/domain/customer_device.rb +50 -0
  79. data/lib/onlinepayments/sdk/domain/customer_payment_activity.rb +34 -0
  80. data/lib/onlinepayments/sdk/domain/customer_token.rb +46 -0
  81. data/lib/onlinepayments/sdk/domain/decrypted_payment_data.rb +42 -0
  82. data/lib/onlinepayments/sdk/domain/directory_entry.rb +34 -0
  83. data/lib/onlinepayments/sdk/domain/empty_validator.rb +12 -0
  84. data/lib/onlinepayments/sdk/domain/error_response.rb +37 -0
  85. data/lib/onlinepayments/sdk/domain/external_cardholder_authentication_data.rb +58 -0
  86. data/lib/onlinepayments/sdk/domain/external_token_linked.rb +34 -0
  87. data/lib/onlinepayments/sdk/domain/fixed_list_validator.rb +32 -0
  88. data/lib/onlinepayments/sdk/domain/fraud_fields.rb +30 -0
  89. data/lib/onlinepayments/sdk/domain/fraud_results.rb +26 -0
  90. data/lib/onlinepayments/sdk/domain/g_pay_three_d_secure.rb +46 -0
  91. data/lib/onlinepayments/sdk/domain/get_hosted_checkout_response.rb +34 -0
  92. data/lib/onlinepayments/sdk/domain/get_hosted_tokenization_response.rb +34 -0
  93. data/lib/onlinepayments/sdk/domain/get_iin_details_request.rb +34 -0
  94. data/lib/onlinepayments/sdk/domain/get_iin_details_response.rb +45 -0
  95. data/lib/onlinepayments/sdk/domain/get_mandate_response.rb +30 -0
  96. data/lib/onlinepayments/sdk/domain/get_payment_product_groups_response.rb +33 -0
  97. data/lib/onlinepayments/sdk/domain/get_payment_products_response.rb +33 -0
  98. data/lib/onlinepayments/sdk/domain/gift_card_purchase.rb +34 -0
  99. data/lib/onlinepayments/sdk/domain/hosted_checkout_specific_input.rb +66 -0
  100. data/lib/onlinepayments/sdk/domain/hosted_checkout_specific_output.rb +30 -0
  101. data/lib/onlinepayments/sdk/domain/iin_detail.rb +30 -0
  102. data/lib/onlinepayments/sdk/domain/label_template_element.rb +30 -0
  103. data/lib/onlinepayments/sdk/domain/length_validator.rb +30 -0
  104. data/lib/onlinepayments/sdk/domain/line_item.rb +46 -0
  105. data/lib/onlinepayments/sdk/domain/line_item_invoice_data.rb +26 -0
  106. data/lib/onlinepayments/sdk/domain/loan_recipient.rb +42 -0
  107. data/lib/onlinepayments/sdk/domain/lodging_data.rb +26 -0
  108. data/lib/onlinepayments/sdk/domain/mandate_address.rb +42 -0
  109. data/lib/onlinepayments/sdk/domain/mandate_contact_details.rb +26 -0
  110. data/lib/onlinepayments/sdk/domain/mandate_customer.rb +58 -0
  111. data/lib/onlinepayments/sdk/domain/mandate_merchant_action.rb +34 -0
  112. data/lib/onlinepayments/sdk/domain/mandate_personal_information.rb +34 -0
  113. data/lib/onlinepayments/sdk/domain/mandate_personal_name.rb +30 -0
  114. data/lib/onlinepayments/sdk/domain/mandate_redirect_data.rb +30 -0
  115. data/lib/onlinepayments/sdk/domain/mandate_response.rb +50 -0
  116. data/lib/onlinepayments/sdk/domain/merchant_action.rb +34 -0
  117. data/lib/onlinepayments/sdk/domain/mobile_payment_data.rb +30 -0
  118. data/lib/onlinepayments/sdk/domain/mobile_payment_method_hosted_checkout_specific_input.rb +30 -0
  119. data/lib/onlinepayments/sdk/domain/mobile_payment_method_specific_input.rb +62 -0
  120. data/lib/onlinepayments/sdk/domain/mobile_payment_method_specific_output.rb +58 -0
  121. data/lib/onlinepayments/sdk/domain/mobile_payment_product320_specific_input.rb +30 -0
  122. data/lib/onlinepayments/sdk/domain/operation_output.rb +58 -0
  123. data/lib/onlinepayments/sdk/domain/order.rb +70 -0
  124. data/lib/onlinepayments/sdk/domain/order_line_details.rb +54 -0
  125. data/lib/onlinepayments/sdk/domain/order_references.rb +34 -0
  126. data/lib/onlinepayments/sdk/domain/order_status_output.rb +49 -0
  127. data/lib/onlinepayments/sdk/domain/order_type_information.rb +30 -0
  128. data/lib/onlinepayments/sdk/domain/payment_account_on_file.rb +30 -0
  129. data/lib/onlinepayments/sdk/domain/payment_context.rb +38 -0
  130. data/lib/onlinepayments/sdk/domain/payment_creation_output.rb +38 -0
  131. data/lib/onlinepayments/sdk/domain/payment_details_response.rb +65 -0
  132. data/lib/onlinepayments/sdk/domain/payment_error_response.rb +45 -0
  133. data/lib/onlinepayments/sdk/domain/payment_output.rb +82 -0
  134. data/lib/onlinepayments/sdk/domain/payment_product.rb +102 -0
  135. data/lib/onlinepayments/sdk/domain/payment_product130_specific_input.rb +30 -0
  136. data/lib/onlinepayments/sdk/domain/payment_product130_specific_three_d_secure.rb +38 -0
  137. data/lib/onlinepayments/sdk/domain/payment_product302_specific_data.rb +32 -0
  138. data/lib/onlinepayments/sdk/domain/payment_product320_specific_data.rb +36 -0
  139. data/lib/onlinepayments/sdk/domain/payment_product5100_specific_input.rb +26 -0
  140. data/lib/onlinepayments/sdk/domain/payment_product5402_specific_output.rb +26 -0
  141. data/lib/onlinepayments/sdk/domain/payment_product5500_specific_output.rb +34 -0
  142. data/lib/onlinepayments/sdk/domain/payment_product771_specific_output.rb +26 -0
  143. data/lib/onlinepayments/sdk/domain/payment_product840_customer_account.rb +54 -0
  144. data/lib/onlinepayments/sdk/domain/payment_product840_specific_output.rb +53 -0
  145. data/lib/onlinepayments/sdk/domain/payment_product_display_hints.rb +34 -0
  146. data/lib/onlinepayments/sdk/domain/payment_product_field.rb +46 -0
  147. data/lib/onlinepayments/sdk/domain/payment_product_field_data_restrictions.rb +34 -0
  148. data/lib/onlinepayments/sdk/domain/payment_product_field_display_element.rb +38 -0
  149. data/lib/onlinepayments/sdk/domain/payment_product_field_display_hints.rb +70 -0
  150. data/lib/onlinepayments/sdk/domain/payment_product_field_form_element.rb +37 -0
  151. data/lib/onlinepayments/sdk/domain/payment_product_field_tooltip.rb +30 -0
  152. data/lib/onlinepayments/sdk/domain/payment_product_field_validators.rb +90 -0
  153. data/lib/onlinepayments/sdk/domain/payment_product_filter.rb +42 -0
  154. data/lib/onlinepayments/sdk/domain/payment_product_filters_hosted_checkout.rb +37 -0
  155. data/lib/onlinepayments/sdk/domain/payment_product_group.rb +52 -0
  156. data/lib/onlinepayments/sdk/domain/payment_product_networks_response.rb +32 -0
  157. data/lib/onlinepayments/sdk/domain/payment_references.rb +30 -0
  158. data/lib/onlinepayments/sdk/domain/payment_response.rb +54 -0
  159. data/lib/onlinepayments/sdk/domain/payment_status_output.rb +57 -0
  160. data/lib/onlinepayments/sdk/domain/payout_error_response.rb +45 -0
  161. data/lib/onlinepayments/sdk/domain/payout_output.rb +30 -0
  162. data/lib/onlinepayments/sdk/domain/payout_response.rb +46 -0
  163. data/lib/onlinepayments/sdk/domain/payout_result.rb +46 -0
  164. data/lib/onlinepayments/sdk/domain/payout_status_output.rb +34 -0
  165. data/lib/onlinepayments/sdk/domain/personal_information.rb +38 -0
  166. data/lib/onlinepayments/sdk/domain/personal_information_token.rb +30 -0
  167. data/lib/onlinepayments/sdk/domain/personal_name.rb +34 -0
  168. data/lib/onlinepayments/sdk/domain/personal_name_token.rb +30 -0
  169. data/lib/onlinepayments/sdk/domain/product_directory.rb +33 -0
  170. data/lib/onlinepayments/sdk/domain/protection_eligibility.rb +30 -0
  171. data/lib/onlinepayments/sdk/domain/range_validator.rb +30 -0
  172. data/lib/onlinepayments/sdk/domain/redirect_data.rb +30 -0
  173. data/lib/onlinepayments/sdk/domain/redirect_payment_method_specific_input.rb +66 -0
  174. data/lib/onlinepayments/sdk/domain/redirect_payment_method_specific_output.rb +66 -0
  175. data/lib/onlinepayments/sdk/domain/redirect_payment_product809_specific_input.rb +26 -0
  176. data/lib/onlinepayments/sdk/domain/redirect_payment_product840_specific_input.rb +26 -0
  177. data/lib/onlinepayments/sdk/domain/redirection_data.rb +26 -0
  178. data/lib/onlinepayments/sdk/domain/refund_card_method_specific_output.rb +30 -0
  179. data/lib/onlinepayments/sdk/domain/refund_e_wallet_method_specific_output.rb +38 -0
  180. data/lib/onlinepayments/sdk/domain/refund_error_response.rb +45 -0
  181. data/lib/onlinepayments/sdk/domain/refund_mobile_method_specific_output.rb +34 -0
  182. data/lib/onlinepayments/sdk/domain/refund_output.rb +82 -0
  183. data/lib/onlinepayments/sdk/domain/refund_payment_product840_customer_account.rb +34 -0
  184. data/lib/onlinepayments/sdk/domain/refund_payment_product840_specific_output.rb +30 -0
  185. data/lib/onlinepayments/sdk/domain/refund_redirect_method_specific_output.rb +30 -0
  186. data/lib/onlinepayments/sdk/domain/refund_request.rb +38 -0
  187. data/lib/onlinepayments/sdk/domain/refund_response.rb +46 -0
  188. data/lib/onlinepayments/sdk/domain/refunds_response.rb +33 -0
  189. data/lib/onlinepayments/sdk/domain/regular_expression_validator.rb +26 -0
  190. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_input.rb +34 -0
  191. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_input_base.rb +34 -0
  192. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_output.rb +42 -0
  193. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_product771_specific_input.rb +34 -0
  194. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_product771_specific_input_base.rb +34 -0
  195. data/lib/onlinepayments/sdk/domain/session_request.rb +32 -0
  196. data/lib/onlinepayments/sdk/domain/session_response.rb +48 -0
  197. data/lib/onlinepayments/sdk/domain/shipping.rb +58 -0
  198. data/lib/onlinepayments/sdk/domain/shopping_cart.rb +64 -0
  199. data/lib/onlinepayments/sdk/domain/shopping_cart_extension.rb +52 -0
  200. data/lib/onlinepayments/sdk/domain/test_connection.rb +26 -0
  201. data/lib/onlinepayments/sdk/domain/three_d_secure.rb +78 -0
  202. data/lib/onlinepayments/sdk/domain/three_d_secure_base.rb +58 -0
  203. data/lib/onlinepayments/sdk/domain/three_d_secure_data.rb +34 -0
  204. data/lib/onlinepayments/sdk/domain/three_d_secure_results.rb +30 -0
  205. data/lib/onlinepayments/sdk/domain/token_card.rb +34 -0
  206. data/lib/onlinepayments/sdk/domain/token_card_data.rb +30 -0
  207. data/lib/onlinepayments/sdk/domain/token_card_specific_input.rb +30 -0
  208. data/lib/onlinepayments/sdk/domain/token_data.rb +30 -0
  209. data/lib/onlinepayments/sdk/domain/token_e_wallet.rb +34 -0
  210. data/lib/onlinepayments/sdk/domain/token_response.rb +58 -0
  211. data/lib/onlinepayments/sdk/domain/value_mapping_element.rb +37 -0
  212. data/lib/onlinepayments/sdk/endpoint_configuration.rb +127 -0
  213. data/lib/onlinepayments/sdk/exceptions.rb +8 -0
  214. data/lib/onlinepayments/sdk/factory.rb +136 -0
  215. data/lib/onlinepayments/sdk/idempotence_exception.rb +24 -0
  216. data/lib/onlinepayments/sdk/logging/communicator_logger.rb +22 -0
  217. data/lib/onlinepayments/sdk/logging/log_message_builder.rb +56 -0
  218. data/lib/onlinepayments/sdk/logging/logging_capable.rb +17 -0
  219. data/lib/onlinepayments/sdk/logging/logging_util.rb +286 -0
  220. data/lib/onlinepayments/sdk/logging/request_log_message_builder.rb +39 -0
  221. data/lib/onlinepayments/sdk/logging/response_log_message_builder.rb +34 -0
  222. data/lib/onlinepayments/sdk/logging/ruby_communicator_logger.rb +57 -0
  223. data/lib/onlinepayments/sdk/logging/stdout_communicator_logger.rb +34 -0
  224. data/lib/onlinepayments/sdk/logging.rb +10 -0
  225. data/lib/onlinepayments/sdk/marshaller.rb +24 -0
  226. data/lib/onlinepayments/sdk/marshaller_syntax_exception.rb +6 -0
  227. data/lib/onlinepayments/sdk/merchant/hostedcheckout/hosted_checkout_client.rb +86 -0
  228. data/lib/onlinepayments/sdk/merchant/hostedtokenization/hosted_tokenization_client.rb +86 -0
  229. data/lib/onlinepayments/sdk/merchant/mandates/mandates_client.rb +182 -0
  230. data/lib/onlinepayments/sdk/merchant/merchant_client.rb +89 -0
  231. data/lib/onlinepayments/sdk/merchant/payments/payments_client.rb +322 -0
  232. data/lib/onlinepayments/sdk/merchant/payouts/payouts_client.rb +86 -0
  233. data/lib/onlinepayments/sdk/merchant/productgroups/get_product_group_params.rb +57 -0
  234. data/lib/onlinepayments/sdk/merchant/productgroups/get_product_groups_params.rb +57 -0
  235. data/lib/onlinepayments/sdk/merchant/productgroups/product_groups_client.rb +87 -0
  236. data/lib/onlinepayments/sdk/merchant/products/get_payment_product_networks_params.rb +38 -0
  237. data/lib/onlinepayments/sdk/merchant/products/get_payment_product_params.rb +57 -0
  238. data/lib/onlinepayments/sdk/merchant/products/get_payment_products_params.rb +57 -0
  239. data/lib/onlinepayments/sdk/merchant/products/get_product_directory_params.rb +30 -0
  240. data/lib/onlinepayments/sdk/merchant/products/products_client.rb +155 -0
  241. data/lib/onlinepayments/sdk/merchant/services/services_client.rb +82 -0
  242. data/lib/onlinepayments/sdk/merchant/sessions/sessions_client.rb +54 -0
  243. data/lib/onlinepayments/sdk/merchant/tokens/tokens_client.rb +116 -0
  244. data/lib/onlinepayments/sdk/meta_data_provider.rb +150 -0
  245. data/lib/onlinepayments/sdk/modules.rb +62 -0
  246. data/lib/onlinepayments/sdk/not_found_exception.rb +16 -0
  247. data/lib/onlinepayments/sdk/param_request.rb +11 -0
  248. data/lib/onlinepayments/sdk/payment_platform_exception.rb +15 -0
  249. data/lib/onlinepayments/sdk/pooled_connection.rb +21 -0
  250. data/lib/onlinepayments/sdk/proxy_configuration.rb +74 -0
  251. data/lib/onlinepayments/sdk/reference_exception.rb +14 -0
  252. data/lib/onlinepayments/sdk/request_header.rb +50 -0
  253. data/lib/onlinepayments/sdk/request_param.rb +23 -0
  254. data/lib/onlinepayments/sdk/response_exception.rb +47 -0
  255. data/lib/onlinepayments/sdk/response_header.rb +42 -0
  256. data/lib/onlinepayments/sdk/validation_exception.rb +14 -0
  257. data/lib/onlinepayments/sdk/webhooks/api_version_mismatch_exception.rb +20 -0
  258. data/lib/onlinepayments/sdk/webhooks/in_memory_secret_key_store.rb +56 -0
  259. data/lib/onlinepayments/sdk/webhooks/secret_key_not_available_exception.rb +17 -0
  260. data/lib/onlinepayments/sdk/webhooks/secret_key_store.rb +16 -0
  261. data/lib/onlinepayments/sdk/webhooks/signature_validation_exception.rb +19 -0
  262. data/lib/onlinepayments/sdk/webhooks/webhooks.rb +22 -0
  263. data/lib/onlinepayments/sdk/webhooks/webhooks_event.rb +58 -0
  264. data/lib/onlinepayments/sdk/webhooks/webhooks_helper.rb +100 -0
  265. data/lib/onlinepayments/sdk/webhooks/webhooks_helper_builder.rb +25 -0
  266. data/lib/onlinepayments/sdk/webhooks.rb +11 -0
  267. data/lib/onlinepayments/sdk.rb +26 -0
  268. data/onlinepayments-sdk-ruby.gemspec +28 -0
  269. metadata +416 -0
@@ -0,0 +1,39 @@
1
+ module OnlinePayments::SDK
2
+ module Logging
3
+
4
+ # Class that converts data about a request into a properly formatted log message.
5
+ # Formats request id, http method, uri, headers and body into a helpful message.
6
+ class RequestLogMessageBuilder < OnlinePayments::SDK::Logging::LogMessageBuilder
7
+
8
+ def initialize(request_id, method, uri)
9
+ super(request_id)
10
+ @method = method
11
+ @uri = uri
12
+ end
13
+
14
+ # Constructs and returns a log message based on the request data. The log message is a string.
15
+ def get_message
16
+ @body ?
17
+ sprintf(MSG_TEMPLATE_WITH_BODY, @request_id, empty_if_null(@method),
18
+ format_uri, @headers, empty_if_null(@content_type), @body) :
19
+ sprintf(MSG_TEMPLATE_WITHOUT_BODY, @request_id, empty_if_null(@method), format_uri, @headers)
20
+ end
21
+
22
+ private
23
+
24
+ MSG_TEMPLATE_WITHOUT_BODY = "Outgoing request (requestId=\"%s\"):\n"\
25
+ " method: \"%s\"\n"\
26
+ " uri: \"%s\"\n"\
27
+ " headers: \"%s\"".freeze
28
+ MSG_TEMPLATE_WITH_BODY = "#{MSG_TEMPLATE_WITHOUT_BODY}\n"\
29
+ " content-type: \"%s\"\n"\
30
+ " body: \"%s\"".freeze
31
+
32
+ def format_uri
33
+ return '' unless @uri && @uri.path
34
+ return @uri.path unless @uri.query
35
+ "#{@uri.path}?#{@uri.query}"
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,34 @@
1
+ module OnlinePayments::SDK
2
+ module Logging
3
+
4
+ class ResponseLogMessageBuilder < LogMessageBuilder
5
+
6
+ # Class that converts data about a response into a properly formatted log message.
7
+ # Formats request id, status code, headers, body and time between request and response into a helpful message.
8
+ #
9
+ # @param request_id [String] identifier of the request corresponding to this response.
10
+ # @param status_code [Integer] HTTP status code of the response.
11
+ # @param duration [Float] time elapsed between request and response.
12
+ def initialize(request_id, status_code, duration = -1)
13
+ super(request_id)
14
+ @status_code = status_code
15
+ @duration = duration
16
+ end
17
+
18
+ # Constructs and returns a log message based on the request data. The log message is a string.
19
+ def get_message
20
+ msg_template = "Incoming response (requestId=\"%s\"#{(@duration.positive?) ? ", %.3f ms" : ""}):\n" +
21
+ " status-code: \"%s\"\n" +
22
+ " headers: \"%s\"\n" +
23
+ " content-type: \"%s\"\n" +
24
+ " body: \"%s\""
25
+
26
+ @duration.positive? ?
27
+ sprintf(msg_template, @request_id, @duration, @status_code, @headers,
28
+ empty_if_null(@content_type), empty_if_null(@body)) :
29
+ sprintf(msg_template, @request_id, @status_code, @headers,
30
+ empty_if_null(@content_type), empty_if_null(@body))
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,57 @@
1
+ require 'English'
2
+
3
+ module OnlinePayments::SDK
4
+ module Logging
5
+
6
+ # Logging class that Logs messages and errors to a logger.
7
+ # Errors can be logged at a separate level compared to regular messages.
8
+ class RubyCommunicatorLogger < CommunicatorLogger
9
+
10
+ # Creates a new RubyCommunicatorLogger instance.
11
+ #
12
+ # @param logger [Logger] the logger to log messages to. Messages to log will be provided using logger#log(message level, message)
13
+ # @param log_level [String] log level to use for non-error messages.
14
+ # @param error_level [String] error logging level to use.
15
+ def initialize(logger, log_level, error_level = false)
16
+ # implement the interface
17
+ error_level ||= log_level
18
+ raise ArgumentError unless logger
19
+ raise ArgumentError unless log_level
20
+ raise ArgumentError unless error_level
21
+
22
+ @logger = logger
23
+ @log_level = log_level
24
+ @errorLevel = error_level
25
+ end
26
+
27
+ # Logs a single error or non-error message to the logger.
28
+ def log(msg, thrown = nil)
29
+ # use Ruby Logger
30
+ if thrown
31
+ @logger.log(@errorLevel) { msg + $RS + thrown.to_s + $RS + thrown.backtrace.join($RS) }
32
+ else
33
+ @logger.log(@log_level, msg)
34
+ end
35
+ end
36
+
37
+ # Opens or creates a new file in write-only mode with _filename_.
38
+ def self.create_logfile(filename)
39
+ logdev = begin
40
+ open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL))
41
+ rescue Errno::EEXIST
42
+ # file is created by another process
43
+ open_logfile(filename)
44
+ end
45
+ logdev.sync = true
46
+ logdev
47
+ end
48
+
49
+ # Opens or creates a new file in write-only mode with _filename_.
50
+ def self.open_logfile(filename)
51
+ open(filename, (File::WRONLY | File::APPEND))
52
+ rescue Errno::ENOENT
53
+ create_logfile(filename)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,34 @@
1
+ require 'English'
2
+ require 'singleton'
3
+
4
+ module OnlinePayments::SDK
5
+ module Logging
6
+
7
+ # {OnlinePayments::SDK::Logging::CommunicatorLogger} that logs the messages to $stdout.
8
+ class StdoutCommunicatorLogger < CommunicatorLogger
9
+ include Singleton
10
+
11
+ def initialize
12
+ # implement the interface
13
+ end
14
+
15
+ # NOTE: this alias is needed to not break existing method calls depending on old interface
16
+ class << self
17
+ alias_method :INSTANCE, :instance
18
+ end
19
+
20
+ # Logs a single error or non-error message to $stdout.
21
+ def log(msg, thrown = nil)
22
+ $stdout.puts get_date_prefix + msg
23
+ $stdout.puts thrown.to_s if thrown
24
+ $stdout.puts thrown.backtrace.join($RS) if thrown
25
+ end
26
+
27
+ private
28
+
29
+ def get_date_prefix
30
+ Time.now.strftime("%Y-%m-%dT%H:%M:%S ")
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,10 @@
1
+ prefix = 'onlinepayments/sdk/logging'
2
+
3
+ require "#{prefix}/logging_capable"
4
+ require "#{prefix}/log_message_builder"
5
+ require "#{prefix}/request_log_message_builder"
6
+ require "#{prefix}/response_log_message_builder"
7
+ require "#{prefix}/logging_util"
8
+ require "#{prefix}/communicator_logger"
9
+ require "#{prefix}/ruby_communicator_logger"
10
+ require "#{prefix}/stdout_communicator_logger"
@@ -0,0 +1,24 @@
1
+ module OnlinePayments::SDK
2
+
3
+ # Class responsible for marshalling and unmarshalling objects to and from JSON
4
+ class Marshaller
5
+
6
+ # Marshals _request_object_ to JSON format by calling #to_h on it.
7
+ #
8
+ # @param request_object [OnlinePayments::SDK::DataObject] the object to format
9
+ # @return [String] _request_object_ converted to JSON
10
+ def marshal(request_object)
11
+ raise NotImplementedError
12
+ end
13
+
14
+ # Unmarshals a JSON string into an object of type _type_.
15
+ # The new object is initialized by calling .new_from_hash with contents of the JSON as a Hash object.
16
+ #
17
+ # @param response_json [String] The JSON to unmarshal
18
+ # @param type [Type] The class of the object that will be instantiated using _type.new_from_hash_
19
+ # @return The JSON unmarshalled to the given type
20
+ def unmarshal(response_json, type)
21
+ raise NotImplementedError
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,6 @@
1
+ module OnlinePayments::SDK
2
+
3
+ # Raised when an error occurred while marshalling/unmarshalling data to/from JSON
4
+ class MarshallerSyntaxException < RuntimeError
5
+ end
6
+ end
@@ -0,0 +1,86 @@
1
+ #
2
+ # This class was auto-generated.
3
+ #
4
+ require 'onlinepayments/sdk/api_resource'
5
+ require 'onlinepayments/sdk/response_exception'
6
+ require 'onlinepayments/sdk/domain/create_hosted_checkout_request'
7
+ require 'onlinepayments/sdk/domain/create_hosted_checkout_response'
8
+ require 'onlinepayments/sdk/domain/error_response'
9
+ require 'onlinepayments/sdk/domain/get_hosted_checkout_response'
10
+
11
+ module OnlinePayments::SDK
12
+ module Merchant
13
+ module HostedCheckout
14
+
15
+ # HostedCheckout client. Thread-safe.
16
+ class HostedCheckoutClient < OnlinePayments::SDK::ApiResource
17
+
18
+ # @param parent [OnlinePayments::SDK::ApiResource]
19
+ # @param path_context [Hash, nil]
20
+ def initialize(parent, path_context = nil)
21
+ super(parent, path_context)
22
+ end
23
+
24
+ # Resource /v2/!{merchantId}/hostedcheckouts
25
+ # @param body [OnlinePayments::SDK::Domain::CreateHostedCheckoutRequest]
26
+ # @param context [OnlinePayments::SDK::CallContext]
27
+ # @return [OnlinePayments::SDK::Domain::CreateHostedCheckoutResponse]
28
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
29
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
30
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
31
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
32
+ # or there was a conflict (HTTP status code 404, 409 or 410)
33
+ # @raise [OnlinePayments::SDK::PaymentPlatformException] if something went wrong at the payment platform,
34
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
35
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
36
+ # @raise [OnlinePayments::SDK::ApiException]if the payment platform returned any other error
37
+ def create_hosted_checkout(body, context = nil)
38
+ uri = instantiate_uri('/v2/{merchantId}/hostedcheckouts')
39
+ @communicator.post(
40
+ uri,
41
+ client_headers,
42
+ nil,
43
+ body,
44
+ OnlinePayments::SDK::Domain::CreateHostedCheckoutResponse,
45
+ context
46
+ )
47
+ rescue ResponseException => e
48
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
49
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
50
+ raise create_exception(e.status_code, e.body, error_object, context)
51
+ end
52
+
53
+ # Resource /v2/!{merchantId}/hostedcheckouts/!{hostedCheckoutId}
54
+ # @param hosted_checkout_id [String]
55
+ # @param context [OnlinePayments::SDK::CallContext]
56
+ # @return [OnlinePayments::SDK::Domain::GetHostedCheckoutResponse]
57
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
58
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
59
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
60
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
61
+ # or there was a conflict (HTTP status code 404, 409 or 410)
62
+ # @raise [OnlinePayments::SDK::PaymentPlatformException] if something went wrong at the payment platform,
63
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
64
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
65
+ # @raise [OnlinePayments::SDK::ApiException]if the payment platform returned any other error
66
+ def get_hosted_checkout(hosted_checkout_id, context = nil)
67
+ path_context = {
68
+ 'hostedCheckoutId'.freeze => hosted_checkout_id,
69
+ }
70
+ uri = instantiate_uri('/v2/{merchantId}/hostedcheckouts/{hostedCheckoutId}', path_context)
71
+ @communicator.get(
72
+ uri,
73
+ client_headers,
74
+ nil,
75
+ OnlinePayments::SDK::Domain::GetHostedCheckoutResponse,
76
+ context
77
+ )
78
+ rescue ResponseException => e
79
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
80
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
81
+ raise create_exception(e.status_code, e.body, error_object, context)
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,86 @@
1
+ #
2
+ # This class was auto-generated.
3
+ #
4
+ require 'onlinepayments/sdk/api_resource'
5
+ require 'onlinepayments/sdk/response_exception'
6
+ require 'onlinepayments/sdk/domain/create_hosted_tokenization_request'
7
+ require 'onlinepayments/sdk/domain/create_hosted_tokenization_response'
8
+ require 'onlinepayments/sdk/domain/error_response'
9
+ require 'onlinepayments/sdk/domain/get_hosted_tokenization_response'
10
+
11
+ module OnlinePayments::SDK
12
+ module Merchant
13
+ module HostedTokenization
14
+
15
+ # HostedTokenization client. Thread-safe.
16
+ class HostedTokenizationClient < OnlinePayments::SDK::ApiResource
17
+
18
+ # @param parent [OnlinePayments::SDK::ApiResource]
19
+ # @param path_context [Hash, nil]
20
+ def initialize(parent, path_context = nil)
21
+ super(parent, path_context)
22
+ end
23
+
24
+ # Resource /v2/!{merchantId}/hostedtokenizations
25
+ # @param body [OnlinePayments::SDK::Domain::CreateHostedTokenizationRequest]
26
+ # @param context [OnlinePayments::SDK::CallContext]
27
+ # @return [OnlinePayments::SDK::Domain::CreateHostedTokenizationResponse]
28
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
29
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
30
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
31
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
32
+ # or there was a conflict (HTTP status code 404, 409 or 410)
33
+ # @raise [OnlinePayments::SDK::PaymentPlatformException] if something went wrong at the payment platform,
34
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
35
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
36
+ # @raise [OnlinePayments::SDK::ApiException]if the payment platform returned any other error
37
+ def create_hosted_tokenization(body, context = nil)
38
+ uri = instantiate_uri('/v2/{merchantId}/hostedtokenizations')
39
+ @communicator.post(
40
+ uri,
41
+ client_headers,
42
+ nil,
43
+ body,
44
+ OnlinePayments::SDK::Domain::CreateHostedTokenizationResponse,
45
+ context
46
+ )
47
+ rescue ResponseException => e
48
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
49
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
50
+ raise create_exception(e.status_code, e.body, error_object, context)
51
+ end
52
+
53
+ # Resource /v2/!{merchantId}/hostedtokenizations/!{hostedTokenizationId}
54
+ # @param hosted_tokenization_id [String]
55
+ # @param context [OnlinePayments::SDK::CallContext]
56
+ # @return [OnlinePayments::SDK::Domain::GetHostedTokenizationResponse]
57
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
58
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
59
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
60
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
61
+ # or there was a conflict (HTTP status code 404, 409 or 410)
62
+ # @raise [OnlinePayments::SDK::PaymentPlatformException] if something went wrong at the payment platform,
63
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
64
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
65
+ # @raise [OnlinePayments::SDK::ApiException]if the payment platform returned any other error
66
+ def get_hosted_tokenization(hosted_tokenization_id, context = nil)
67
+ path_context = {
68
+ 'hostedTokenizationId'.freeze => hosted_tokenization_id,
69
+ }
70
+ uri = instantiate_uri('/v2/{merchantId}/hostedtokenizations/{hostedTokenizationId}', path_context)
71
+ @communicator.get(
72
+ uri,
73
+ client_headers,
74
+ nil,
75
+ OnlinePayments::SDK::Domain::GetHostedTokenizationResponse,
76
+ context
77
+ )
78
+ rescue ResponseException => e
79
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
80
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
81
+ raise create_exception(e.status_code, e.body, error_object, context)
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,182 @@
1
+ #
2
+ # This class was auto-generated.
3
+ #
4
+ require 'onlinepayments/sdk/api_resource'
5
+ require 'onlinepayments/sdk/response_exception'
6
+ require 'onlinepayments/sdk/domain/create_mandate_request'
7
+ require 'onlinepayments/sdk/domain/create_mandate_response'
8
+ require 'onlinepayments/sdk/domain/error_response'
9
+ require 'onlinepayments/sdk/domain/get_mandate_response'
10
+
11
+ module OnlinePayments::SDK
12
+ module Merchant
13
+ module Mandates
14
+
15
+ # Mandates client. Thread-safe.
16
+ class MandatesClient < OnlinePayments::SDK::ApiResource
17
+
18
+ # @param parent [OnlinePayments::SDK::ApiResource]
19
+ # @param path_context [Hash, nil]
20
+ def initialize(parent, path_context = nil)
21
+ super(parent, path_context)
22
+ end
23
+
24
+ # Resource /v2/!{merchantId}/mandates
25
+ # @param body [OnlinePayments::SDK::Domain::CreateMandateRequest]
26
+ # @param context [OnlinePayments::SDK::CallContext]
27
+ # @return [OnlinePayments::SDK::Domain::CreateMandateResponse]
28
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
29
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
30
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
31
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
32
+ # or there was a conflict (HTTP status code 404, 409 or 410)
33
+ # @raise [OnlinePayments::SDK::PaymentPlatformException] if something went wrong at the payment platform,
34
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
35
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
36
+ # @raise [OnlinePayments::SDK::ApiException]if the payment platform returned any other error
37
+ def create_mandate(body, context = nil)
38
+ uri = instantiate_uri('/v2/{merchantId}/mandates')
39
+ @communicator.post(
40
+ uri,
41
+ client_headers,
42
+ nil,
43
+ body,
44
+ OnlinePayments::SDK::Domain::CreateMandateResponse,
45
+ context
46
+ )
47
+ rescue ResponseException => e
48
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
49
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
50
+ raise create_exception(e.status_code, e.body, error_object, context)
51
+ end
52
+
53
+ # Resource /v2/!{merchantId}/mandates/!{uniqueMandateReference}
54
+ # @param unique_mandate_reference [String]
55
+ # @param context [OnlinePayments::SDK::CallContext]
56
+ # @return [OnlinePayments::SDK::Domain::GetMandateResponse]
57
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
58
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
59
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
60
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
61
+ # or there was a conflict (HTTP status code 404, 409 or 410)
62
+ # @raise [OnlinePayments::SDK::PaymentPlatformException] if something went wrong at the payment platform,
63
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
64
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
65
+ # @raise [OnlinePayments::SDK::ApiException]if the payment platform returned any other error
66
+ def get_mandate(unique_mandate_reference, context = nil)
67
+ path_context = {
68
+ 'uniqueMandateReference'.freeze => unique_mandate_reference,
69
+ }
70
+ uri = instantiate_uri('/v2/{merchantId}/mandates/{uniqueMandateReference}', path_context)
71
+ @communicator.get(
72
+ uri,
73
+ client_headers,
74
+ nil,
75
+ OnlinePayments::SDK::Domain::GetMandateResponse,
76
+ context
77
+ )
78
+ rescue ResponseException => e
79
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
80
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
81
+ raise create_exception(e.status_code, e.body, error_object, context)
82
+ end
83
+
84
+ # Resource /v2/!{merchantId}/mandates/!{uniqueMandateReference}/block
85
+ # @param unique_mandate_reference [String]
86
+ # @param context [OnlinePayments::SDK::CallContext]
87
+ # @return [OnlinePayments::SDK::Domain::GetMandateResponse]
88
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
89
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
90
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
91
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
92
+ # or there was a conflict (HTTP status code 404, 409 or 410)
93
+ # @raise [OnlinePayments::SDK::PaymentPlatformException] if something went wrong at the payment platform,
94
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
95
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
96
+ # @raise [OnlinePayments::SDK::ApiException]if the payment platform returned any other error
97
+ def block_mandate(unique_mandate_reference, context = nil)
98
+ path_context = {
99
+ 'uniqueMandateReference'.freeze => unique_mandate_reference,
100
+ }
101
+ uri = instantiate_uri('/v2/{merchantId}/mandates/{uniqueMandateReference}/block', path_context)
102
+ @communicator.post(
103
+ uri,
104
+ client_headers,
105
+ nil,
106
+ nil,
107
+ OnlinePayments::SDK::Domain::GetMandateResponse,
108
+ context
109
+ )
110
+ rescue ResponseException => e
111
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
112
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
113
+ raise create_exception(e.status_code, e.body, error_object, context)
114
+ end
115
+
116
+ # Resource /v2/!{merchantId}/mandates/!{uniqueMandateReference}/unblock
117
+ # @param unique_mandate_reference [String]
118
+ # @param context [OnlinePayments::SDK::CallContext]
119
+ # @return [OnlinePayments::SDK::Domain::GetMandateResponse]
120
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
121
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
122
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
123
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
124
+ # or there was a conflict (HTTP status code 404, 409 or 410)
125
+ # @raise [OnlinePayments::SDK::PaymentPlatformException] if something went wrong at the payment platform,
126
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
127
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
128
+ # @raise [OnlinePayments::SDK::ApiException]if the payment platform returned any other error
129
+ def unblock_mandate(unique_mandate_reference, context = nil)
130
+ path_context = {
131
+ 'uniqueMandateReference'.freeze => unique_mandate_reference,
132
+ }
133
+ uri = instantiate_uri('/v2/{merchantId}/mandates/{uniqueMandateReference}/unblock', path_context)
134
+ @communicator.post(
135
+ uri,
136
+ client_headers,
137
+ nil,
138
+ nil,
139
+ OnlinePayments::SDK::Domain::GetMandateResponse,
140
+ context
141
+ )
142
+ rescue ResponseException => e
143
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
144
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
145
+ raise create_exception(e.status_code, e.body, error_object, context)
146
+ end
147
+
148
+ # Resource /v2/!{merchantId}/mandates/!{uniqueMandateReference}/revoke
149
+ # @param unique_mandate_reference [String]
150
+ # @param context [OnlinePayments::SDK::CallContext]
151
+ # @return [OnlinePayments::SDK::Domain::GetMandateResponse]
152
+ # @raise [OnlinePayments::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
153
+ # @raise [OnlinePayments::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
154
+ # @raise [OnlinePayments::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
155
+ # @raise [OnlinePayments::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
156
+ # or there was a conflict (HTTP status code 404, 409 or 410)
157
+ # @raise [OnlinePayments::SDK::PaymentPlatformException] if something went wrong at the payment platform,
158
+ # the payment platform was unable to process a message from a downstream partner/acquirer,
159
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
160
+ # @raise [OnlinePayments::SDK::ApiException]if the payment platform returned any other error
161
+ def revoke_mandate(unique_mandate_reference, context = nil)
162
+ path_context = {
163
+ 'uniqueMandateReference'.freeze => unique_mandate_reference,
164
+ }
165
+ uri = instantiate_uri('/v2/{merchantId}/mandates/{uniqueMandateReference}/revoke', path_context)
166
+ @communicator.post(
167
+ uri,
168
+ client_headers,
169
+ nil,
170
+ nil,
171
+ OnlinePayments::SDK::Domain::GetMandateResponse,
172
+ context
173
+ )
174
+ rescue ResponseException => e
175
+ error_type = OnlinePayments::SDK::Domain::ErrorResponse
176
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
177
+ raise create_exception(e.status_code, e.body, error_object, context)
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,89 @@
1
+ #
2
+ # This class was auto-generated.
3
+ #
4
+ require 'onlinepayments/sdk/api_resource'
5
+ require 'onlinepayments/sdk/merchant/hostedcheckout/hosted_checkout_client'
6
+ require 'onlinepayments/sdk/merchant/hostedtokenization/hosted_tokenization_client'
7
+ require 'onlinepayments/sdk/merchant/mandates/mandates_client'
8
+ require 'onlinepayments/sdk/merchant/payments/payments_client'
9
+ require 'onlinepayments/sdk/merchant/payouts/payouts_client'
10
+ require 'onlinepayments/sdk/merchant/productgroups/product_groups_client'
11
+ require 'onlinepayments/sdk/merchant/products/products_client'
12
+ require 'onlinepayments/sdk/merchant/services/services_client'
13
+ require 'onlinepayments/sdk/merchant/sessions/sessions_client'
14
+ require 'onlinepayments/sdk/merchant/tokens/tokens_client'
15
+
16
+ module OnlinePayments::SDK
17
+ module Merchant
18
+
19
+ # Merchant client. Thread-safe.
20
+ class MerchantClient < OnlinePayments::SDK::ApiResource
21
+
22
+ # @param parent [OnlinePayments::SDK::ApiResource]
23
+ # @param path_context [Hash, nil]
24
+ def initialize(parent, path_context = nil)
25
+ super(parent, path_context)
26
+ end
27
+
28
+ # Resource /v2/!{merchantId}/hostedcheckouts
29
+ # @return [OnlinePayments::SDK::Merchant::HostedCheckout::HostedCheckoutClient]
30
+ def hosted_checkout
31
+ OnlinePayments::SDK::Merchant::HostedCheckout::HostedCheckoutClient.new(self, nil)
32
+ end
33
+
34
+ # Resource /v2/!{merchantId}/hostedtokenizations
35
+ # @return [OnlinePayments::SDK::Merchant::HostedTokenization::HostedTokenizationClient]
36
+ def hosted_tokenization
37
+ OnlinePayments::SDK::Merchant::HostedTokenization::HostedTokenizationClient.new(self, nil)
38
+ end
39
+
40
+ # Resource /v2/!{merchantId}/mandates
41
+ # @return [OnlinePayments::SDK::Merchant::Mandates::MandatesClient]
42
+ def mandates
43
+ OnlinePayments::SDK::Merchant::Mandates::MandatesClient.new(self, nil)
44
+ end
45
+
46
+ # Resource /v2/!{merchantId}/payments
47
+ # @return [OnlinePayments::SDK::Merchant::Payments::PaymentsClient]
48
+ def payments
49
+ OnlinePayments::SDK::Merchant::Payments::PaymentsClient.new(self, nil)
50
+ end
51
+
52
+ # Resource /v2/!{merchantId}/payouts
53
+ # @return [OnlinePayments::SDK::Merchant::Payouts::PayoutsClient]
54
+ def payouts
55
+ OnlinePayments::SDK::Merchant::Payouts::PayoutsClient.new(self, nil)
56
+ end
57
+
58
+ # Resource /v2/!{merchantId}/productgroups
59
+ # @return [OnlinePayments::SDK::Merchant::ProductGroups::ProductGroupsClient]
60
+ def product_groups
61
+ OnlinePayments::SDK::Merchant::ProductGroups::ProductGroupsClient.new(self, nil)
62
+ end
63
+
64
+ # Resource /v2/!{merchantId}/products
65
+ # @return [OnlinePayments::SDK::Merchant::Products::ProductsClient]
66
+ def products
67
+ OnlinePayments::SDK::Merchant::Products::ProductsClient.new(self, nil)
68
+ end
69
+
70
+ # Resource /v2/!{merchantId}/services
71
+ # @return [OnlinePayments::SDK::Merchant::Services::ServicesClient]
72
+ def services
73
+ OnlinePayments::SDK::Merchant::Services::ServicesClient.new(self, nil)
74
+ end
75
+
76
+ # Resource /v2/!{merchantId}/sessions
77
+ # @return [OnlinePayments::SDK::Merchant::Sessions::SessionsClient]
78
+ def sessions
79
+ OnlinePayments::SDK::Merchant::Sessions::SessionsClient.new(self, nil)
80
+ end
81
+
82
+ # Resource /v2/!{merchantId}/tokens
83
+ # @return [OnlinePayments::SDK::Merchant::Tokens::TokensClient]
84
+ def tokens
85
+ OnlinePayments::SDK::Merchant::Tokens::TokensClient.new(self, nil)
86
+ end
87
+ end
88
+ end
89
+ end