onlinepayments-sdk-ruby 4.23.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -0
  3. data/LICENSE.txt +0 -0
  4. data/README.md +5 -6
  5. data/Rakefile +0 -0
  6. data/lib/onlinepayments/sdk/api_exception.rb +47 -35
  7. data/lib/onlinepayments/sdk/api_resource.rb +49 -97
  8. data/lib/onlinepayments/sdk/authentication/authenticator.rb +19 -0
  9. data/lib/onlinepayments/sdk/authentication/authorization_type.rb +15 -0
  10. data/lib/onlinepayments/sdk/authentication/v1hmac_authenticator.rb +109 -0
  11. data/lib/onlinepayments/sdk/authentication.rb +1 -0
  12. data/lib/onlinepayments/sdk/authorization_exception.rb +14 -8
  13. data/lib/onlinepayments/sdk/call_context.rb +30 -21
  14. data/lib/onlinepayments/sdk/client.rb +36 -18
  15. data/lib/onlinepayments/sdk/communication/communication_exception.rb +19 -0
  16. data/lib/onlinepayments/sdk/communication/connection.rb +48 -0
  17. data/lib/onlinepayments/sdk/communication/default_connection.rb +427 -0
  18. data/lib/onlinepayments/sdk/communication/metadata_provider.rb +160 -0
  19. data/lib/onlinepayments/sdk/communication/multipart_form_data_object.rb +52 -0
  20. data/lib/onlinepayments/sdk/communication/multipart_form_data_request.rb +13 -0
  21. data/lib/onlinepayments/sdk/communication/not_found_exception.rb +19 -0
  22. data/lib/onlinepayments/sdk/communication/param_request.rb +14 -0
  23. data/lib/onlinepayments/sdk/communication/pooled_connection.rb +26 -0
  24. data/lib/onlinepayments/sdk/communication/request_header.rb +62 -0
  25. data/lib/onlinepayments/sdk/communication/request_param.rb +28 -0
  26. data/lib/onlinepayments/sdk/communication/response_exception.rb +56 -0
  27. data/lib/onlinepayments/sdk/communication/response_header.rb +78 -0
  28. data/lib/onlinepayments/sdk/communication.rb +1 -0
  29. data/lib/onlinepayments/sdk/communicator.rb +475 -268
  30. data/lib/onlinepayments/sdk/communicator_configuration.rb +162 -53
  31. data/lib/onlinepayments/sdk/declined_payment_exception.rb +28 -21
  32. data/lib/onlinepayments/sdk/declined_payout_exception.rb +28 -23
  33. data/lib/onlinepayments/sdk/declined_refund_exception.rb +28 -23
  34. data/lib/onlinepayments/sdk/declined_transaction_exception.rb +16 -10
  35. data/lib/onlinepayments/sdk/domain/account_on_file.rb +44 -35
  36. data/lib/onlinepayments/sdk/domain/account_on_file_attribute.rb +42 -28
  37. data/lib/onlinepayments/sdk/domain/account_on_file_display_hints.rb +29 -24
  38. data/lib/onlinepayments/sdk/domain/acquirer_information.rb +27 -22
  39. data/lib/onlinepayments/sdk/domain/acquirer_selection_information.rb +34 -24
  40. data/lib/onlinepayments/sdk/domain/additional_order_input.rb +43 -38
  41. data/lib/onlinepayments/sdk/domain/address.rb +65 -43
  42. data/lib/onlinepayments/sdk/domain/address_personal.rb +78 -52
  43. data/lib/onlinepayments/sdk/domain/airline_data.rb +204 -123
  44. data/lib/onlinepayments/sdk/domain/airline_flight_leg.rb +158 -95
  45. data/lib/onlinepayments/sdk/domain/airline_passenger.rb +59 -39
  46. data/lib/onlinepayments/sdk/domain/amount_breakdown.rb +27 -20
  47. data/lib/onlinepayments/sdk/domain/amount_of_money.rb +27 -20
  48. data/lib/onlinepayments/sdk/domain/api_error.rb +73 -47
  49. data/lib/onlinepayments/sdk/domain/apple_pay_line_item.rb +72 -0
  50. data/lib/onlinepayments/sdk/domain/apple_pay_recurring_payment_request.rb +61 -0
  51. data/lib/onlinepayments/sdk/domain/bank_account_iban.rb +20 -16
  52. data/lib/onlinepayments/sdk/domain/browser_data.rb +51 -35
  53. data/lib/onlinepayments/sdk/domain/calculate_surcharge_request.rb +27 -24
  54. data/lib/onlinepayments/sdk/domain/calculate_surcharge_response.rb +22 -20
  55. data/lib/onlinepayments/sdk/domain/cancel_payment_request.rb +27 -22
  56. data/lib/onlinepayments/sdk/domain/cancel_payment_response.rb +20 -18
  57. data/lib/onlinepayments/sdk/domain/capture.rb +41 -32
  58. data/lib/onlinepayments/sdk/domain/capture_output.rb +106 -78
  59. data/lib/onlinepayments/sdk/domain/capture_payment_request.rb +43 -26
  60. data/lib/onlinepayments/sdk/domain/capture_response.rb +41 -32
  61. data/lib/onlinepayments/sdk/domain/capture_status_output.rb +20 -16
  62. data/lib/onlinepayments/sdk/domain/captures_response.rb +22 -20
  63. data/lib/onlinepayments/sdk/domain/card.rb +41 -28
  64. data/lib/onlinepayments/sdk/domain/card_essentials.rb +41 -28
  65. data/lib/onlinepayments/sdk/domain/card_fraud_results.rb +34 -24
  66. data/lib/onlinepayments/sdk/domain/card_info.rb +27 -20
  67. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input.rb +199 -128
  68. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input_base.rb +149 -104
  69. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input_for_hosted_checkout.rb +36 -28
  70. data/lib/onlinepayments/sdk/domain/card_payment_method_specific_output.rb +133 -100
  71. data/lib/onlinepayments/sdk/domain/card_payout_method_specific_input.rb +41 -30
  72. data/lib/onlinepayments/sdk/domain/card_recurrence_details.rb +20 -16
  73. data/lib/onlinepayments/sdk/domain/card_source.rb +41 -30
  74. data/lib/onlinepayments/sdk/domain/card_without_cvv.rb +34 -24
  75. data/lib/onlinepayments/sdk/domain/company_information.rb +20 -16
  76. data/lib/onlinepayments/sdk/domain/complete_payment_card_payment_method_specific_input.rb +20 -18
  77. data/lib/onlinepayments/sdk/domain/complete_payment_request.rb +27 -24
  78. data/lib/onlinepayments/sdk/domain/complete_payment_response.rb +35 -31
  79. data/lib/onlinepayments/sdk/domain/contact_details.rb +51 -35
  80. data/lib/onlinepayments/sdk/domain/create_hosted_checkout_request.rb +76 -59
  81. data/lib/onlinepayments/sdk/domain/create_hosted_checkout_response.rb +60 -43
  82. data/lib/onlinepayments/sdk/domain/create_hosted_tokenization_request.rb +57 -42
  83. data/lib/onlinepayments/sdk/domain/create_hosted_tokenization_response.rb +57 -44
  84. data/lib/onlinepayments/sdk/domain/create_mandate_request.rb +71 -48
  85. data/lib/onlinepayments/sdk/domain/create_mandate_response.rb +27 -24
  86. data/lib/onlinepayments/sdk/domain/create_mandate_with_return_url.rb +71 -48
  87. data/lib/onlinepayments/sdk/domain/create_payment_link_request.rb +120 -87
  88. data/lib/onlinepayments/sdk/domain/create_payment_request.rb +82 -60
  89. data/lib/onlinepayments/sdk/domain/create_payment_response.rb +35 -31
  90. data/lib/onlinepayments/sdk/domain/create_payout_request.rb +61 -40
  91. data/lib/onlinepayments/sdk/domain/create_token_request.rb +27 -22
  92. data/lib/onlinepayments/sdk/domain/created_payment_output.rb +27 -22
  93. data/lib/onlinepayments/sdk/domain/created_token_response.rb +50 -38
  94. data/lib/onlinepayments/sdk/domain/credit_card_specific_input_hosted_tokenization.rb +29 -26
  95. data/lib/onlinepayments/sdk/domain/credit_card_validation_rules_hosted_tokenization.rb +27 -20
  96. data/lib/onlinepayments/sdk/domain/currency_conversion.rb +27 -22
  97. data/lib/onlinepayments/sdk/domain/currency_conversion_input.rb +27 -20
  98. data/lib/onlinepayments/sdk/domain/currency_conversion_request.rb +27 -24
  99. data/lib/onlinepayments/sdk/domain/currency_conversion_response.rb +34 -28
  100. data/lib/onlinepayments/sdk/domain/currency_conversion_result.rb +27 -20
  101. data/lib/onlinepayments/sdk/domain/currency_conversion_specific_input.rb +20 -16
  102. data/lib/onlinepayments/sdk/domain/customer.rb +87 -68
  103. data/lib/onlinepayments/sdk/domain/customer_account.rb +77 -55
  104. data/lib/onlinepayments/sdk/domain/customer_account_authentication.rb +34 -20
  105. data/lib/onlinepayments/sdk/domain/customer_bank_account.rb +34 -24
  106. data/lib/onlinepayments/sdk/domain/customer_device.rb +64 -44
  107. data/lib/onlinepayments/sdk/domain/customer_device_output.rb +20 -16
  108. data/lib/onlinepayments/sdk/domain/customer_output.rb +20 -18
  109. data/lib/onlinepayments/sdk/domain/customer_payment_activity.rb +34 -24
  110. data/lib/onlinepayments/sdk/domain/customer_token.rb +35 -31
  111. data/lib/onlinepayments/sdk/domain/data_object.rb +32 -0
  112. data/lib/onlinepayments/sdk/domain/dcc_card_source.rb +41 -30
  113. data/lib/onlinepayments/sdk/domain/dcc_proposal.rb +51 -41
  114. data/lib/onlinepayments/sdk/domain/decrypted_payment_data.rb +51 -35
  115. data/lib/onlinepayments/sdk/domain/directory_entry.rb +34 -24
  116. data/lib/onlinepayments/sdk/domain/discount.rb +20 -16
  117. data/lib/onlinepayments/sdk/domain/empty_validator.rb +7 -6
  118. data/lib/onlinepayments/sdk/domain/error_response.rb +29 -24
  119. data/lib/onlinepayments/sdk/domain/external_cardholder_authentication_data.rb +86 -55
  120. data/lib/onlinepayments/sdk/domain/external_token_linked.rb +35 -24
  121. data/lib/onlinepayments/sdk/domain/feedbacks.rb +30 -0
  122. data/lib/onlinepayments/sdk/domain/fixed_list_validator.rb +22 -20
  123. data/lib/onlinepayments/sdk/domain/fraud_fields.rb +37 -28
  124. data/lib/onlinepayments/sdk/domain/fraud_results.rb +20 -16
  125. data/lib/onlinepayments/sdk/domain/g_pay_three_d_secure.rb +50 -36
  126. data/lib/onlinepayments/sdk/domain/get_hosted_checkout_response.rb +27 -22
  127. data/lib/onlinepayments/sdk/domain/get_hosted_tokenization_response.rb +27 -22
  128. data/lib/onlinepayments/sdk/domain/get_iin_details_request.rb +27 -22
  129. data/lib/onlinepayments/sdk/domain/get_iin_details_response.rb +52 -38
  130. data/lib/onlinepayments/sdk/domain/get_mandate_response.rb +20 -18
  131. data/lib/onlinepayments/sdk/domain/get_payment_product_groups_response.rb +22 -20
  132. data/lib/onlinepayments/sdk/domain/get_payment_products_response.rb +22 -20
  133. data/lib/onlinepayments/sdk/domain/get_privacy_policy_response.rb +20 -16
  134. data/lib/onlinepayments/sdk/domain/gift_card_purchase.rb +27 -22
  135. data/lib/onlinepayments/sdk/domain/hosted_checkout_specific_input.rb +83 -56
  136. data/lib/onlinepayments/sdk/domain/hosted_checkout_specific_output.rb +27 -20
  137. data/lib/onlinepayments/sdk/domain/iin_detail.rb +34 -24
  138. data/lib/onlinepayments/sdk/domain/label_template_element.rb +27 -20
  139. data/lib/onlinepayments/sdk/domain/length_validator.rb +27 -20
  140. data/lib/onlinepayments/sdk/domain/line_item.rb +44 -31
  141. data/lib/onlinepayments/sdk/domain/line_item_invoice_data.rb +20 -16
  142. data/lib/onlinepayments/sdk/domain/loan_recipient.rb +51 -35
  143. data/lib/onlinepayments/sdk/domain/lodging_data.rb +20 -16
  144. data/lib/onlinepayments/sdk/domain/mandate_address.rb +51 -35
  145. data/lib/onlinepayments/sdk/domain/mandate_address_response.rb +51 -35
  146. data/lib/onlinepayments/sdk/domain/mandate_contact_details.rb +20 -16
  147. data/lib/onlinepayments/sdk/domain/mandate_customer.rb +52 -44
  148. data/lib/onlinepayments/sdk/domain/mandate_customer_response.rb +52 -44
  149. data/lib/onlinepayments/sdk/domain/mandate_merchant_action.rb +27 -22
  150. data/lib/onlinepayments/sdk/domain/mandate_personal_information.rb +27 -22
  151. data/lib/onlinepayments/sdk/domain/mandate_personal_information_response.rb +27 -22
  152. data/lib/onlinepayments/sdk/domain/mandate_personal_name.rb +27 -20
  153. data/lib/onlinepayments/sdk/domain/mandate_personal_name_response.rb +27 -20
  154. data/lib/onlinepayments/sdk/domain/mandate_redirect_data.rb +27 -20
  155. data/lib/onlinepayments/sdk/domain/mandate_response.rb +64 -44
  156. data/lib/onlinepayments/sdk/domain/merchant_action.rb +43 -28
  157. data/lib/onlinepayments/sdk/domain/mobile_payment_data.rb +27 -20
  158. data/lib/onlinepayments/sdk/domain/mobile_payment_method_hosted_checkout_specific_input.rb +43 -26
  159. data/lib/onlinepayments/sdk/domain/mobile_payment_method_specific_input.rb +71 -50
  160. data/lib/onlinepayments/sdk/domain/mobile_payment_method_specific_output.rb +58 -45
  161. data/lib/onlinepayments/sdk/domain/mobile_payment_product302_specific_input.rb +32 -0
  162. data/lib/onlinepayments/sdk/domain/mobile_payment_product320_specific_input.rb +20 -18
  163. data/lib/onlinepayments/sdk/domain/mobile_three_d_secure_challenge_parameters.rb +51 -0
  164. data/lib/onlinepayments/sdk/domain/multiple_payment_information.rb +27 -20
  165. data/lib/onlinepayments/sdk/domain/omnichannel_payout_specific_input.rb +20 -16
  166. data/lib/onlinepayments/sdk/domain/operation_output.rb +67 -45
  167. data/lib/onlinepayments/sdk/domain/operation_payment_references.rb +30 -0
  168. data/lib/onlinepayments/sdk/domain/order.rb +75 -66
  169. data/lib/onlinepayments/sdk/domain/order_line_details.rb +79 -47
  170. data/lib/onlinepayments/sdk/domain/order_references.rb +34 -24
  171. data/lib/onlinepayments/sdk/domain/order_status_output.rb +52 -38
  172. data/lib/onlinepayments/sdk/domain/order_type_information.rb +27 -20
  173. data/lib/onlinepayments/sdk/domain/other_details.rb +37 -0
  174. data/lib/onlinepayments/sdk/domain/payment_account_on_file.rb +27 -20
  175. data/lib/onlinepayments/sdk/domain/payment_context.rb +34 -26
  176. data/lib/onlinepayments/sdk/domain/payment_creation_output.rb +41 -28
  177. data/lib/onlinepayments/sdk/domain/payment_details_response.rb +60 -49
  178. data/lib/onlinepayments/sdk/domain/payment_error_response.rb +37 -31
  179. data/lib/onlinepayments/sdk/domain/payment_link_event.rb +34 -24
  180. data/lib/onlinepayments/sdk/domain/payment_link_order_input.rb +34 -28
  181. data/lib/onlinepayments/sdk/domain/payment_link_order_output.rb +34 -28
  182. data/lib/onlinepayments/sdk/domain/payment_link_response.rb +74 -51
  183. data/lib/onlinepayments/sdk/domain/payment_link_specific_input.rb +36 -24
  184. data/lib/onlinepayments/sdk/domain/payment_output.rb +115 -94
  185. data/lib/onlinepayments/sdk/domain/payment_product.rb +117 -85
  186. data/lib/onlinepayments/sdk/domain/payment_product130_specific_input.rb +20 -18
  187. data/lib/onlinepayments/sdk/domain/payment_product130_specific_three_d_secure.rb +41 -28
  188. data/lib/onlinepayments/sdk/domain/payment_product3012.rb +27 -20
  189. data/lib/onlinepayments/sdk/domain/payment_product3012_specific_input.rb +51 -0
  190. data/lib/onlinepayments/sdk/domain/payment_product302_specific_data.rb +22 -20
  191. data/lib/onlinepayments/sdk/domain/payment_product3203_specific_output.rb +27 -24
  192. data/lib/onlinepayments/sdk/domain/payment_product3208_specific_input.rb +20 -16
  193. data/lib/onlinepayments/sdk/domain/payment_product3208_specific_output.rb +20 -16
  194. data/lib/onlinepayments/sdk/domain/payment_product3209_specific_input.rb +20 -16
  195. data/lib/onlinepayments/sdk/domain/payment_product3209_specific_output.rb +20 -16
  196. data/lib/onlinepayments/sdk/domain/payment_product320_specific_data.rb +29 -24
  197. data/lib/onlinepayments/sdk/domain/payment_product5001_specific_output.rb +48 -16
  198. data/lib/onlinepayments/sdk/domain/payment_product5100_specific_input.rb +20 -16
  199. data/lib/onlinepayments/sdk/domain/payment_product5402_specific_output.rb +20 -16
  200. data/lib/onlinepayments/sdk/domain/payment_product5404.rb +27 -20
  201. data/lib/onlinepayments/sdk/domain/payment_product5407.rb +27 -20
  202. data/lib/onlinepayments/sdk/domain/payment_product5500_specific_output.rb +41 -24
  203. data/lib/onlinepayments/sdk/domain/payment_product771_specific_output.rb +20 -16
  204. data/lib/onlinepayments/sdk/domain/payment_product840_customer_account.rb +72 -47
  205. data/lib/onlinepayments/sdk/domain/payment_product840_specific_output.rb +43 -38
  206. data/lib/onlinepayments/sdk/domain/payment_product_display_hints.rb +34 -24
  207. data/lib/onlinepayments/sdk/domain/payment_product_field.rb +41 -32
  208. data/lib/onlinepayments/sdk/domain/payment_product_field_data_restrictions.rb +27 -22
  209. data/lib/onlinepayments/sdk/domain/payment_product_field_display_element.rb +41 -28
  210. data/lib/onlinepayments/sdk/domain/payment_product_field_display_hints.rb +84 -56
  211. data/lib/onlinepayments/sdk/domain/payment_product_field_form_element.rb +30 -24
  212. data/lib/onlinepayments/sdk/domain/payment_product_field_tooltip.rb +28 -20
  213. data/lib/onlinepayments/sdk/domain/payment_product_field_validators.rb +83 -73
  214. data/lib/onlinepayments/sdk/domain/payment_product_filter.rb +32 -29
  215. data/lib/onlinepayments/sdk/domain/payment_product_filter_hosted_tokenization.rb +22 -20
  216. data/lib/onlinepayments/sdk/domain/payment_product_filters_hosted_checkout.rb +27 -24
  217. data/lib/onlinepayments/sdk/domain/payment_product_filters_hosted_tokenization.rb +27 -24
  218. data/lib/onlinepayments/sdk/domain/payment_product_group.rb +44 -37
  219. data/lib/onlinepayments/sdk/domain/payment_product_networks_response.rb +22 -20
  220. data/lib/onlinepayments/sdk/domain/payment_references.rb +27 -20
  221. data/lib/onlinepayments/sdk/domain/payment_response.rb +51 -41
  222. data/lib/onlinepayments/sdk/domain/payment_status_output.rb +66 -46
  223. data/lib/onlinepayments/sdk/domain/payout_error_response.rb +37 -31
  224. data/lib/onlinepayments/sdk/domain/payout_output.rb +27 -22
  225. data/lib/onlinepayments/sdk/domain/payout_response.rb +41 -32
  226. data/lib/onlinepayments/sdk/domain/payout_result.rb +41 -32
  227. data/lib/onlinepayments/sdk/domain/payout_status_output.rb +34 -24
  228. data/lib/onlinepayments/sdk/domain/personal_information.rb +34 -26
  229. data/lib/onlinepayments/sdk/domain/personal_information_token.rb +20 -18
  230. data/lib/onlinepayments/sdk/domain/personal_name.rb +34 -24
  231. data/lib/onlinepayments/sdk/domain/personal_name_token.rb +27 -20
  232. data/lib/onlinepayments/sdk/domain/product_directory.rb +22 -20
  233. data/lib/onlinepayments/sdk/domain/protection_eligibility.rb +27 -20
  234. data/lib/onlinepayments/sdk/domain/range_validator.rb +27 -20
  235. data/lib/onlinepayments/sdk/domain/rate_details.rb +51 -35
  236. data/lib/onlinepayments/sdk/domain/redirect_data.rb +27 -20
  237. data/lib/onlinepayments/sdk/domain/redirect_payment_method_specific_input.rb +139 -88
  238. data/lib/onlinepayments/sdk/domain/redirect_payment_method_specific_output.rb +95 -75
  239. data/lib/onlinepayments/sdk/domain/redirect_payment_product3203_specific_input.rb +20 -16
  240. data/lib/onlinepayments/sdk/domain/redirect_payment_product3302_specific_input.rb +44 -0
  241. data/lib/onlinepayments/sdk/domain/redirect_payment_product3306_specific_input.rb +20 -16
  242. data/lib/onlinepayments/sdk/domain/redirect_payment_product5001_specific_input.rb +20 -16
  243. data/lib/onlinepayments/sdk/domain/redirect_payment_product5300_specific_input.rb +74 -0
  244. data/lib/onlinepayments/sdk/domain/redirect_payment_product5406_specific_input.rb +20 -18
  245. data/lib/onlinepayments/sdk/domain/redirect_payment_product5408_specific_input.rb +27 -22
  246. data/lib/onlinepayments/sdk/domain/redirect_payment_product5410_specific_input.rb +32 -0
  247. data/lib/onlinepayments/sdk/domain/redirect_payment_product809_specific_input.rb +20 -16
  248. data/lib/onlinepayments/sdk/domain/redirect_payment_product840_specific_input.rb +41 -20
  249. data/lib/onlinepayments/sdk/domain/redirection_data.rb +20 -16
  250. data/lib/onlinepayments/sdk/domain/refund_card_method_specific_output.rb +34 -26
  251. data/lib/onlinepayments/sdk/domain/refund_e_wallet_method_specific_output.rb +34 -26
  252. data/lib/onlinepayments/sdk/domain/refund_error_response.rb +37 -31
  253. data/lib/onlinepayments/sdk/domain/refund_mobile_method_specific_output.rb +34 -24
  254. data/lib/onlinepayments/sdk/domain/refund_output.rb +89 -64
  255. data/lib/onlinepayments/sdk/domain/refund_payment_product840_customer_account.rb +34 -24
  256. data/lib/onlinepayments/sdk/domain/refund_payment_product840_specific_output.rb +20 -18
  257. data/lib/onlinepayments/sdk/domain/refund_redirect_method_specific_output.rb +27 -20
  258. data/lib/onlinepayments/sdk/domain/refund_request.rb +43 -24
  259. data/lib/onlinepayments/sdk/domain/refund_response.rb +41 -32
  260. data/lib/onlinepayments/sdk/domain/refunds_response.rb +22 -20
  261. data/lib/onlinepayments/sdk/domain/regular_expression_validator.rb +20 -16
  262. data/lib/onlinepayments/sdk/domain/send_test_request.rb +30 -0
  263. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_input.rb +27 -22
  264. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_input_base.rb +27 -22
  265. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_output.rb +34 -28
  266. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_product771_specific_input.rb +27 -22
  267. data/lib/onlinepayments/sdk/domain/sepa_direct_debit_payment_product771_specific_input_base.rb +27 -22
  268. data/lib/onlinepayments/sdk/domain/session_request.rb +22 -20
  269. data/lib/onlinepayments/sdk/domain/session_response.rb +53 -39
  270. data/lib/onlinepayments/sdk/domain/shipping.rb +76 -52
  271. data/lib/onlinepayments/sdk/domain/shipping_method.rb +41 -28
  272. data/lib/onlinepayments/sdk/domain/shopping_cart.rb +62 -48
  273. data/lib/onlinepayments/sdk/domain/shopping_cart_extension.rb +51 -43
  274. data/lib/onlinepayments/sdk/domain/show_form_data.rb +35 -31
  275. data/lib/onlinepayments/sdk/domain/subsequent_card_payment_method_specific_input.rb +60 -39
  276. data/lib/onlinepayments/sdk/domain/subsequent_payment_product5001_specific_input.rb +20 -16
  277. data/lib/onlinepayments/sdk/domain/subsequent_payment_request.rb +35 -31
  278. data/lib/onlinepayments/sdk/domain/subsequent_payment_response.rb +20 -18
  279. data/lib/onlinepayments/sdk/domain/surcharge.rb +59 -48
  280. data/lib/onlinepayments/sdk/domain/surcharge_calculation_card.rb +27 -20
  281. data/lib/onlinepayments/sdk/domain/surcharge_for_payment_link.rb +20 -16
  282. data/lib/onlinepayments/sdk/domain/surcharge_rate.rb +41 -28
  283. data/lib/onlinepayments/sdk/domain/surcharge_specific_input.rb +27 -22
  284. data/lib/onlinepayments/sdk/domain/surcharge_specific_output.rb +34 -28
  285. data/lib/onlinepayments/sdk/domain/test_connection.rb +20 -16
  286. data/lib/onlinepayments/sdk/domain/three_d_secure.rb +98 -63
  287. data/lib/onlinepayments/sdk/domain/three_d_secure_base.rb +78 -52
  288. data/lib/onlinepayments/sdk/domain/three_d_secure_data.rb +34 -24
  289. data/lib/onlinepayments/sdk/domain/three_d_secure_results.rb +107 -67
  290. data/lib/onlinepayments/sdk/domain/token_card.rb +27 -22
  291. data/lib/onlinepayments/sdk/domain/token_card_data.rb +27 -18
  292. data/lib/onlinepayments/sdk/domain/token_card_specific_input.rb +20 -18
  293. data/lib/onlinepayments/sdk/domain/token_data.rb +27 -18
  294. data/lib/onlinepayments/sdk/domain/token_e_wallet.rb +28 -22
  295. data/lib/onlinepayments/sdk/domain/token_response.rb +58 -45
  296. data/lib/onlinepayments/sdk/domain/transaction.rb +20 -18
  297. data/lib/onlinepayments/sdk/domain/uploadable_file.rb +33 -0
  298. data/lib/onlinepayments/sdk/domain/validate_credentials_request.rb +37 -0
  299. data/lib/onlinepayments/sdk/domain/validate_credentials_response.rb +30 -0
  300. data/lib/onlinepayments/sdk/domain/value_mapping_element.rb +29 -24
  301. data/lib/onlinepayments/sdk/domain.rb +4 -0
  302. data/lib/onlinepayments/sdk/exception_factory.rb +76 -0
  303. data/lib/onlinepayments/sdk/factory.rb +163 -118
  304. data/lib/onlinepayments/sdk/idempotence_exception.rb +23 -19
  305. data/lib/onlinepayments/sdk/json/default_marshaller.rb +34 -0
  306. data/lib/onlinepayments/sdk/json/marshaller.rb +27 -0
  307. data/lib/onlinepayments/sdk/json/marshaller_syntax_exception.rb +9 -0
  308. data/lib/onlinepayments/sdk/json.rb +1 -0
  309. data/lib/onlinepayments/sdk/logging/communicator_logger.rb +18 -16
  310. data/lib/onlinepayments/sdk/logging/log_message_builder.rb +80 -47
  311. data/lib/onlinepayments/sdk/logging/logging_capable.rb +1 -1
  312. data/lib/onlinepayments/sdk/logging/obfuscation/body_obfuscator.rb +113 -0
  313. data/lib/onlinepayments/sdk/logging/obfuscation/header_obfuscator.rb +54 -0
  314. data/lib/onlinepayments/sdk/logging/obfuscation/obfuscation_capable.rb +21 -0
  315. data/lib/onlinepayments/sdk/logging/obfuscation/obfuscation_rule.rb +47 -0
  316. data/lib/onlinepayments/sdk/logging/obfuscation.rb +1 -0
  317. data/lib/onlinepayments/sdk/logging/request_log_message_builder.rb +40 -29
  318. data/lib/onlinepayments/sdk/logging/response_log_message_builder.rb +30 -23
  319. data/lib/onlinepayments/sdk/logging/ruby_communicator_logger.rb +49 -45
  320. data/lib/onlinepayments/sdk/logging/stdout_communicator_logger.rb +20 -23
  321. data/lib/onlinepayments/sdk/logging.rb +1 -10
  322. data/lib/onlinepayments/sdk/merchant/captures/captures_client.rb +57 -0
  323. data/lib/onlinepayments/sdk/merchant/captures.rb +4 -0
  324. data/lib/onlinepayments/sdk/merchant/complete/complete_client.rb +60 -0
  325. data/lib/onlinepayments/sdk/merchant/complete.rb +4 -0
  326. data/lib/onlinepayments/sdk/merchant/hostedcheckout/hosted_checkout_client.rb +72 -71
  327. data/lib/onlinepayments/sdk/merchant/hostedcheckout.rb +4 -0
  328. data/lib/onlinepayments/sdk/merchant/hostedtokenization/hosted_tokenization_client.rb +72 -71
  329. data/lib/onlinepayments/sdk/merchant/hostedtokenization.rb +4 -0
  330. data/lib/onlinepayments/sdk/merchant/mandates/mandates_client.rb +165 -164
  331. data/lib/onlinepayments/sdk/merchant/mandates.rb +4 -0
  332. data/lib/onlinepayments/sdk/merchant/merchant_client.rb +116 -64
  333. data/lib/onlinepayments/sdk/merchant/paymentlinks/payment_links_client.rb +102 -101
  334. data/lib/onlinepayments/sdk/merchant/paymentlinks.rb +4 -0
  335. data/lib/onlinepayments/sdk/merchant/payments/payments_client.rb +233 -332
  336. data/lib/onlinepayments/sdk/merchant/payments.rb +4 -0
  337. data/lib/onlinepayments/sdk/merchant/payouts/payouts_client.rb +73 -71
  338. data/lib/onlinepayments/sdk/merchant/payouts.rb +4 -0
  339. data/lib/onlinepayments/sdk/merchant/privacypolicy/get_privacy_policy_params.rb +32 -0
  340. data/lib/onlinepayments/sdk/merchant/privacypolicy/privacy_policy_client.rb +54 -0
  341. data/lib/onlinepayments/sdk/merchant/privacypolicy.rb +4 -0
  342. data/lib/onlinepayments/sdk/merchant/productgroups/get_product_group_params.rb +50 -47
  343. data/lib/onlinepayments/sdk/merchant/productgroups/get_product_groups_params.rb +50 -47
  344. data/lib/onlinepayments/sdk/merchant/productgroups/product_groups_client.rb +72 -72
  345. data/lib/onlinepayments/sdk/merchant/productgroups.rb +4 -0
  346. data/lib/onlinepayments/sdk/merchant/products/get_payment_product_networks_params.rb +27 -25
  347. data/lib/onlinepayments/sdk/merchant/products/get_payment_product_params.rb +50 -47
  348. data/lib/onlinepayments/sdk/merchant/products/get_payment_products_params.rb +50 -47
  349. data/lib/onlinepayments/sdk/merchant/products/get_product_directory_params.rb +21 -19
  350. data/lib/onlinepayments/sdk/merchant/products/products_client.rb +134 -136
  351. data/lib/onlinepayments/sdk/merchant/products.rb +4 -0
  352. data/lib/onlinepayments/sdk/merchant/refunds/refunds_client.rb +57 -0
  353. data/lib/onlinepayments/sdk/merchant/refunds.rb +4 -0
  354. data/lib/onlinepayments/sdk/merchant/services/services_client.rb +124 -155
  355. data/lib/onlinepayments/sdk/merchant/services.rb +4 -0
  356. data/lib/onlinepayments/sdk/merchant/sessions/sessions_client.rb +42 -41
  357. data/lib/onlinepayments/sdk/merchant/sessions.rb +4 -0
  358. data/lib/onlinepayments/sdk/merchant/tokens/tokens_client.rb +101 -100
  359. data/lib/onlinepayments/sdk/merchant/tokens.rb +4 -0
  360. data/lib/onlinepayments/sdk/merchant/webhooks/webhooks_client.rb +83 -0
  361. data/lib/onlinepayments/sdk/merchant/webhooks.rb +4 -0
  362. data/lib/onlinepayments/sdk/merchant.rb +4 -0
  363. data/lib/onlinepayments/sdk/platform_exception.rb +19 -0
  364. data/lib/onlinepayments/sdk/proxy_configuration.rb +60 -60
  365. data/lib/onlinepayments/sdk/reference_exception.rb +14 -9
  366. data/lib/onlinepayments/sdk/validation_exception.rb +14 -9
  367. data/lib/onlinepayments/sdk/webhooks/api_version_mismatch_exception.rb +17 -15
  368. data/lib/onlinepayments/sdk/webhooks/in_memory_secret_key_store.rb +46 -43
  369. data/lib/onlinepayments/sdk/webhooks/secret_key_not_available_exception.rb +16 -12
  370. data/lib/onlinepayments/sdk/webhooks/secret_key_store.rb +13 -11
  371. data/lib/onlinepayments/sdk/webhooks/signature_validation_exception.rb +15 -14
  372. data/lib/onlinepayments/sdk/webhooks/signature_validator.rb +81 -0
  373. data/lib/onlinepayments/sdk/webhooks/webhooks_event.rb +84 -53
  374. data/lib/onlinepayments/sdk/webhooks/webhooks_helper.rb +28 -90
  375. data/lib/onlinepayments/sdk/webhooks.rb +1 -11
  376. data/lib/onlinepayments/sdk.rb +4 -26
  377. data/onlinepayments-sdk-ruby.gemspec +3 -2
  378. metadata +89 -35
  379. data/lib/onlinepayments/sdk/authenticator.rb +0 -16
  380. data/lib/onlinepayments/sdk/communication_exception.rb +0 -16
  381. data/lib/onlinepayments/sdk/connection.rb +0 -41
  382. data/lib/onlinepayments/sdk/data_object.rb +0 -31
  383. data/lib/onlinepayments/sdk/defaultimpl/authorization_type.rb +0 -24
  384. data/lib/onlinepayments/sdk/defaultimpl/default_authenticator.rb +0 -108
  385. data/lib/onlinepayments/sdk/defaultimpl/default_connection.rb +0 -365
  386. data/lib/onlinepayments/sdk/defaultimpl/default_marshaller.rb +0 -32
  387. data/lib/onlinepayments/sdk/defaultimpl.rb +0 -6
  388. data/lib/onlinepayments/sdk/endpoint_configuration.rb +0 -127
  389. data/lib/onlinepayments/sdk/exceptions.rb +0 -8
  390. data/lib/onlinepayments/sdk/logging/logging_util.rb +0 -286
  391. data/lib/onlinepayments/sdk/marshaller.rb +0 -24
  392. data/lib/onlinepayments/sdk/marshaller_syntax_exception.rb +0 -6
  393. data/lib/onlinepayments/sdk/merchant/services/get_privacy_policy_params.rb +0 -30
  394. data/lib/onlinepayments/sdk/meta_data_provider.rb +0 -150
  395. data/lib/onlinepayments/sdk/modules.rb +0 -62
  396. data/lib/onlinepayments/sdk/multipart_form_data_object.rb +0 -44
  397. data/lib/onlinepayments/sdk/multipart_form_data_request.rb +0 -9
  398. data/lib/onlinepayments/sdk/not_found_exception.rb +0 -16
  399. data/lib/onlinepayments/sdk/param_request.rb +0 -11
  400. data/lib/onlinepayments/sdk/payment_platform_exception.rb +0 -15
  401. data/lib/onlinepayments/sdk/pooled_connection.rb +0 -21
  402. data/lib/onlinepayments/sdk/request_header.rb +0 -50
  403. data/lib/onlinepayments/sdk/request_param.rb +0 -23
  404. data/lib/onlinepayments/sdk/response_exception.rb +0 -47
  405. data/lib/onlinepayments/sdk/response_header.rb +0 -42
  406. data/lib/onlinepayments/sdk/uploadable_file.rb +0 -30
  407. data/lib/onlinepayments/sdk/webhooks/webhooks.rb +0 -22
  408. data/lib/onlinepayments/sdk/webhooks/webhooks_helper_builder.rb +0 -25
@@ -1,59 +1,168 @@
1
- module OnlinePayments::SDK
1
+ require 'onlinepayments/sdk/authentication/authorization_type'
2
2
 
3
- # A CommunicatorConfiguration stores all data used to initialize an {OnlinePayments::SDK::Communicator}.
4
- #
5
- # @attr [String] api_endpoint Base URL to the Online Payments platform
6
- # @attr [String] api_key_id Identifier of the _secret_api_key_ used in authentication.
7
- # @attr [String] secret_api_key Secret key used in authentication
8
- # @attr [String] authorization_type String representing the authentication algorithm used
9
- class CommunicatorConfiguration < EndpointConfiguration
10
-
11
- # Creates a new CommunicatorConfiguration instance.
12
- #
13
- # If a _properties_ object is given, it will be parsed like a hash in order to read these attributes.
14
- # If a value is given in both the _properties_ hash and as a separate parameter,
15
- # the separate parameter will take precedence over the value in the properties.
3
+ module OnlinePayments
4
+ module SDK
5
+ # A CommunicatorConfiguration stores all data used to initialize an {OnlinePayments::SDK::Communicator}.
16
6
  #
17
- # @param properties [Hash] hash that may contain any of the other parameters.
18
- # @param api_endpoint [String] the base URL to the Online Payments platform.
19
- # @param api_key_id [String] the identifier of the _secret_api_key_ used to authenticate requests.
20
- # @param secret_api_key [String] the key used to authenticate requests sent to the Online Payments platform.
21
- # @param authorization_type [String] string describing the authorization protocol to follow.
22
- # @param connect_timeout [Integer] the number of seconds before a connection attempt with the Online Payments platform times out.
23
- # @param socket_timeout [Integer] the number of seconds before a timeout occurs when transmitting data to or from the Online Payments platform.
24
- # @param max_connections [Integer] the number of connections with the Online Payments platform that are kept alive in the connection pool.
25
- # These connections will be reused when possible.
26
- # @param proxy_configuration [OnlinePayments::SDK::ProxyConfiguration] stores the URL to a proxy to be used in all communication,
27
- # or nil if no proxy should be used.
28
- # @param integrator [String] name of the integrator
29
- # @param shopping_cart_extension [OnlinePayments::SDK::Domain::ShoppingCartExtension] stores shopping cart-related metadata.
30
- # @see EndpointConfiguration#initialize
31
- def initialize(properties: nil, api_endpoint: nil, api_key_id: nil,
32
- secret_api_key: nil, authorization_type: nil,
33
- connect_timeout: nil, socket_timeout: nil,
34
- max_connections: nil, proxy_configuration: nil,
35
- integrator: nil, shopping_cart_extension: nil)
36
- if properties
37
- super(properties, 'onlinePayments.api')
38
- @authorization_type = properties['onlinePayments.api.authorizationType'] ?
39
- DefaultImpl::AuthorizationType.get_authorization(properties['onlinePayments.api.authorizationType']) :
40
- DefaultImpl::AuthorizationType::V1HMAC
7
+ # @attr [String] api_endpoint Base URL to the Online Payments platform
8
+ # @attr [String] api_key_id Identifier of the _secret_api_key_ used in authentication.
9
+ # @attr [String] secret_api_key Secret key used in authentication
10
+ # @attr [String] authorization_type String representing the authentication algorithm used
11
+ # @attr [Integer] connect_timeout The number of seconds before a connection attempt with the Online Payments platform times out.
12
+ # @attr [Integer] socket_timeout The number of seconds before a timeout occurs when transmitting data to or from the Online Payments platform.
13
+ # @attr [Integer] max_connections The number of connections with the Online Payments platform that are kept alive in the connection pool.
14
+ # These connections will be reused when possible.
15
+ # @attr [OnlinePayments::SDK::ProxyConfiguration] proxy_configuration Proxy settings.
16
+ # @attr [String] integrator Name of the integrator
17
+ # @attr [OnlinePayments::SDK::Domain::ShoppingCartExtension] shopping_cart_extension Shopping cart-related metadata.
18
+ class CommunicatorConfiguration
19
+ private
20
+
21
+ DEFAULT_MAX_CONNECTIONS = 10
22
+
23
+ public
24
+
25
+ # The default number of connections that are kept alive in the connection pool.
26
+ # Used if _maxConnections_ is not present in the properties.
27
+ # @return [Integer]
28
+ def self.default_max_connections
29
+ DEFAULT_MAX_CONNECTIONS
41
30
  end
42
- @api_endpoint = api_endpoint if api_endpoint
43
- @api_key_id = api_key_id if api_key_id
44
- @secret_api_key = secret_api_key if secret_api_key
45
- @authorization_type = DefaultImpl::AuthorizationType.get_authorization(authorization_type) if authorization_type
46
- @connect_timeout = connect_timeout if connect_timeout
47
- @socket_timeout = socket_timeout if socket_timeout
48
- @max_connections = max_connections if max_connections
49
- @proxy_configuration = proxy_configuration if proxy_configuration
50
- @integrator = integrator if integrator
51
- @shopping_cart_extension = shopping_cart_extension if shopping_cart_extension
52
- end
53
31
 
54
- attr_accessor :api_endpoint
55
- attr_accessor :api_key_id
56
- attr_accessor :secret_api_key
57
- attr_accessor :authorization_type
32
+ # Creates a new CommunicatorConfiguration instance.
33
+ #
34
+ # If a _properties_ object is given, it will be parsed like a hash in order to read these attributes.
35
+ # If a value is given in both the _properties_ hash and as a separate parameter,
36
+ # the separate parameter will take precedence over the value in the properties.
37
+ #
38
+ # @param properties [Hash, nil] hash that may contain any of the other parameters.
39
+ # @param api_endpoint [String, nil] the base URL to the Online Payments platform.
40
+ # @param api_key_id [String, nil] the identifier of the _secret_api_key_ used to authenticate requests.
41
+ # @param secret_api_key [String, nil] the key used to authenticate requests sent to the Online Payments platform.
42
+ # @param authorization_type [String, nil] string describing the authorization protocol to follow.
43
+ # @param connect_timeout [Integer, nil] the number of seconds before a connection attempt with the Online Payments platform times out.
44
+ # @param socket_timeout [Integer, nil] the number of seconds before a timeout occurs when transmitting data to or from the Online Payments platform.
45
+ # @param max_connections [Integer, nil] the number of connections with the Online Payments platform that are kept alive in the connection pool.
46
+ # These connections will be reused when possible.
47
+ # @param proxy_configuration [OnlinePayments::SDK::ProxyConfiguration, nil] stores the URL to a proxy to be used in all communication,
48
+ # or _nil_ if no proxy should be used.
49
+ # @param integrator [String, nil] name of the integrator
50
+ # @param shopping_cart_extension [OnlinePayments::SDK::Domain::ShoppingCartExtension, nil] stores shopping cart-related metadata.
51
+ def initialize(properties: nil, api_endpoint: nil,
52
+ api_key_id: nil, secret_api_key: nil,
53
+ authorization_type: nil,
54
+ connect_timeout: nil, socket_timeout: nil,
55
+ max_connections: nil, proxy_configuration: nil,
56
+ integrator: nil, shopping_cart_extension: nil)
57
+ unless properties.nil?
58
+ @api_endpoint = get_endpoint(properties)
59
+ @authorization_type = Authentication::AuthorizationType.get_authorization(properties['onlinePayments.api.authorizationType'])
60
+ @connect_timeout = properties['onlinePayments.api.connectTimeout']
61
+ @socket_timeout = properties['onlinePayments.api.socketTimeout']
62
+ @max_connections = get_property(properties, 'onlinePayments.api.maxConnections', DEFAULT_MAX_CONNECTIONS)
63
+
64
+ proxy_uri = properties['onlinePayments.api.proxy.uri']
65
+ proxy_user = properties['onlinePayments.api.proxy.username']
66
+ proxy_pass = properties['onlinePayments.api.proxy.password']
67
+ unless proxy_uri.nil?
68
+ @proxy_configuration = ProxyConfiguration.new(address: URI(proxy_uri),
69
+ username: proxy_user,
70
+ password: proxy_pass)
71
+ end
72
+ @integrator = properties['onlinePayments.api.integrator']
73
+ @shopping_cart_extension = get_shopping_cart_extension(properties)
74
+ end
75
+
76
+ if api_endpoint
77
+ @api_endpoint = api_endpoint
78
+ end
79
+ if api_key_id
80
+ @api_key_id = api_key_id
81
+ end
82
+ if secret_api_key
83
+ @secret_api_key = secret_api_key
84
+ end
85
+ if authorization_type
86
+ @authorization_type = authorization_type
87
+ end
88
+ if connect_timeout
89
+ @connect_timeout = connect_timeout
90
+ end
91
+ if socket_timeout
92
+ @socket_timeout = socket_timeout
93
+ end
94
+ if max_connections
95
+ @max_connections = max_connections
96
+ end
97
+ if proxy_configuration
98
+ @proxy_configuration = proxy_configuration
99
+ end
100
+ if integrator
101
+ @integrator = integrator
102
+ end
103
+ if shopping_cart_extension
104
+ @shopping_cart_extension = shopping_cart_extension
105
+ end
106
+ end
107
+
108
+ attr_accessor :api_endpoint
109
+
110
+ attr_accessor :api_key_id
111
+ attr_accessor :secret_api_key
112
+ attr_accessor :authorization_type
113
+
114
+ attr_accessor :connect_timeout
115
+ attr_accessor :socket_timeout
116
+ attr_accessor :max_connections
117
+
118
+ attr_accessor :proxy_configuration
119
+
120
+ attr_accessor :integrator
121
+ attr_accessor :shopping_cart_extension
122
+
123
+ private
124
+
125
+ def get_property(properties, key, default_value)
126
+ property_value = properties[key]
127
+ if property_value.nil?
128
+ default_value
129
+ else
130
+ property_value
131
+ end
132
+ end
133
+
134
+ def get_endpoint(properties)
135
+ host = properties['onlinePayments.api.endpoint.host']
136
+ scheme = properties['onlinePayments.api.endpoint.scheme']
137
+ port = properties['onlinePayments.api.endpoint.port']
138
+ if scheme.nil?
139
+ scheme = 'https'
140
+ end
141
+ if port.nil?
142
+ port = -1
143
+ end
144
+ create_uri(scheme, host, port)
145
+ end
146
+
147
+ def create_uri(scheme, host, port)
148
+ if port == -1
149
+ "#{scheme}://#{host}"
150
+ else
151
+ "#{scheme}://#{host}:#{port.to_s}"
152
+ end
153
+ end
154
+
155
+ def get_shopping_cart_extension(properties)
156
+ creator = properties['onlinePayments.api.shoppingCartExtension.creator']
157
+ name = properties['onlinePayments.api.shoppingCartExtension.name']
158
+ version = properties['onlinePayments.api.shoppingCartExtension.version']
159
+ extension_id = properties['onlinePayments.api.shoppingCartExtension.extensionId']
160
+ if creator.nil? && name.nil? && version.nil? && extension_id.nil?
161
+ nil
162
+ else
163
+ Domain::ShoppingCartExtension.new(creator, name, version, extension_id)
164
+ end
165
+ end
166
+ end
58
167
  end
59
168
  end
@@ -1,29 +1,36 @@
1
- module OnlinePayments::SDK
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ require_relative 'declined_transaction_exception'
2
5
 
3
- # Indicates that a payment is declined by the Online Payments platform or one of its downstream partners/acquirers.
4
- class DeclinedPaymentException < DeclinedTransactionException
6
+ module OnlinePayments
7
+ module SDK
8
+ # Represents an error response from a create payment call.
9
+ class DeclinedPaymentException < DeclinedTransactionException
5
10
 
6
- # Create a new DeclinedPaymentException.
7
- # @see ApiException#initialize
8
- def initialize(status_code, response_body, errors)
9
- super(status_code, response_body, errors&.error_id, errors&.errors, build_message(errors))
10
- @errors = errors
11
- end
11
+ # Create a new DeclinedPaymentException.
12
+ # @see ApiException#initialize
13
+ def initialize(status_code, response_body, response)
14
+ super(status_code, response_body, response&.error_id, response&.errors, build_message(response))
15
+ @response = response
16
+ end
12
17
 
13
- # The declined payment result returned by the Online Payments platform.
14
- # @return [OnlinePayments::SDK::Domain::CreatePaymentResult, nil]
15
- def payment_result
16
- @errors&.payment_result
17
- end
18
+ # The result of creating a payment
19
+ # @return [OnlinePayments::SDK::Domain::CreatePaymentResponse, nil]
20
+ def payment_result
21
+ @response&.payment_result
22
+ end
18
23
 
19
- private
24
+ private
20
25
 
21
- def build_message(errors)
22
- payment = errors&.payment_result&.payment
23
- if payment
24
- "declined payment '#{payment.id}' with status '#{payment.status}'"
25
- else
26
- 'the Online Payments platform returned a declined payment response'
26
+ # @param response [OnlinePayments::SDK::Domain::PaymentErrorResponse, nil]
27
+ def build_message(response)
28
+ payment = response&.payment_result&.payment
29
+ if payment.nil?
30
+ 'the payment platform returned a declined payment response'
31
+ else
32
+ "declined payment '#{payment.id}' with status '#{payment.status}'"
33
+ end
27
34
  end
28
35
  end
29
36
  end
@@ -1,31 +1,36 @@
1
- require 'onlinepayments/sdk/declined_transaction_exception'
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ require_relative 'declined_transaction_exception'
2
5
 
3
- module OnlinePayments::SDK
6
+ module OnlinePayments
7
+ module SDK
8
+ # Represents an error response from a payout call.
9
+ class DeclinedPayoutException < DeclinedTransactionException
4
10
 
5
- # Indicates that a payout is declined by the Online Payments platform or one of its downstream partners/acquirers.
6
- class DeclinedPayoutException < DeclinedTransactionException
7
-
8
- # Create a new DeclinedPayoutException
9
- # @see ApiException#initialize
10
- def initialize(status_code, response_body, errors)
11
- super(status_code, response_body, errors&.error_id, errors&.errors, build_message(errors))
12
- @errors = errors
13
- end
11
+ # Create a new DeclinedPayoutException.
12
+ # @see ApiException#initialize
13
+ def initialize(status_code, response_body, response)
14
+ super(status_code, response_body, response&.error_id, response&.errors, build_message(response))
15
+ @response = response
16
+ end
14
17
 
15
- # The declined payout result as returned by the Online Payments platform.
16
- # @return [OnlinePayments::SDK::Domain::PayoutResult, nil]
17
- def payout_result
18
- @errors&.payout_result
19
- end
18
+ # The result of creating a payout
19
+ # @return [OnlinePayments::SDK::Domain::PayoutResult, nil]
20
+ def payout_result
21
+ @response&.payout_result
22
+ end
20
23
 
21
- private
24
+ private
22
25
 
23
- def build_message(errors)
24
- payout = errors&.payout_result
25
- if payout
26
- "declined payout '#{payout.id}' with status '#{payout.status}'"
27
- else
28
- 'the Online Payments platform returned a declined payout response'
26
+ # @param response [OnlinePayments::SDK::Domain::PayoutErrorResponse, nil]
27
+ def build_message(response)
28
+ payout_result = response&.payout_result
29
+ if payout_result.nil?
30
+ 'the payment platform returned a declined payout response'
31
+ else
32
+ "declined payout '#{payout_result.id}' with status '#{payout_result.status}'"
33
+ end
29
34
  end
30
35
  end
31
36
  end
@@ -1,31 +1,36 @@
1
- require 'onlinepayments/sdk/declined_transaction_exception'
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ require_relative 'declined_transaction_exception'
2
5
 
3
- module OnlinePayments::SDK
6
+ module OnlinePayments
7
+ module SDK
8
+ # Represents an error response from a refund call.
9
+ class DeclinedRefundException < DeclinedTransactionException
4
10
 
5
- # Indicates that a refund is declined by the Online Payments platform or one of its downstream partners/acquirers.
6
- class DeclinedRefundException < DeclinedTransactionException
7
-
8
- # Create a new DeclinedRefundException
9
- # @see ApiException#initialize
10
- def initialize(status_code, response_body, errors)
11
- super(status_code, response_body, errors&.error_id, errors&.errors, build_message(errors))
12
- @errors = errors
13
- end
11
+ # Create a new DeclinedRefundException.
12
+ # @see ApiException#initialize
13
+ def initialize(status_code, response_body, response)
14
+ super(status_code, response_body, response&.error_id, response&.errors, build_message(response))
15
+ @response = response
16
+ end
14
17
 
15
- # The declined refund result as returned by the Online Payments platform.
16
- # @return [OnlinePayments::SDK::Domain::RefundResult, nil]
17
- def refund_result
18
- @errors&.refund_result
19
- end
18
+ # The result of creating a refund
19
+ # @return [OnlinePayments::SDK::Domain::RefundResponse, nil]
20
+ def refund_result
21
+ @response&.refund_result
22
+ end
20
23
 
21
- private
24
+ private
22
25
 
23
- def build_message(errors)
24
- refund = errors&.refund_result
25
- if refund
26
- "declined refund '#{refund.id}' with status '#{refund.status}'"
27
- else
28
- 'the Online Payments platform returned a declined refund response'
26
+ # @param response [OnlinePayments::SDK::Domain::RefundErrorResponse, nil]
27
+ def build_message(response)
28
+ refund_result = response&.refund_result
29
+ if refund_result.nil?
30
+ 'the payment platform returned a declined refund response'
31
+ else
32
+ "declined refund '#{refund_result.id}' with status '#{refund_result.status}'"
33
+ end
29
34
  end
30
35
  end
31
36
  end
@@ -1,15 +1,21 @@
1
- module OnlinePayments::SDK
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ require_relative 'api_exception'
2
5
 
3
- # Indicates that a transaction is declined by the Online Payments platform or one of its downstream partners/acquirers.
4
- class DeclinedTransactionException < ApiException
6
+ module OnlinePayments
7
+ module SDK
8
+ # Represents an error response from a create payment, payout or refund call.
9
+ class DeclinedTransactionException < ApiException
5
10
 
6
- # Create a new DeclinedTransactionException.
7
- # @see ApiException#initialize
8
- def initialize(status_code, response_body, error_id, errors, message = nil)
9
- if message
10
- super(status_code, response_body, error_id, errors, message)
11
- else
12
- super(status_code, response_body, error_id, errors)
11
+ # Create a new DeclinedTransactionException.
12
+ # @see ApiException#initialize
13
+ def initialize(status_code, response_body, error_id, errors, message = nil)
14
+ if message
15
+ super(status_code, response_body, error_id, errors, message)
16
+ else
17
+ super(status_code, response_body, error_id, errors)
18
+ end
13
19
  end
14
20
  end
15
21
  end
@@ -1,48 +1,57 @@
1
1
  #
2
- # This class was auto-generated.
2
+ # This file was automatically generated.
3
3
  #
4
- require 'onlinepayments/sdk/data_object'
5
4
  require 'onlinepayments/sdk/domain/account_on_file_attribute'
6
5
  require 'onlinepayments/sdk/domain/account_on_file_display_hints'
6
+ require 'onlinepayments/sdk/domain/data_object'
7
7
 
8
- module OnlinePayments::SDK
9
- module Domain
8
+ module OnlinePayments
9
+ module SDK
10
+ module Domain
11
+ # @attr [Array<OnlinePayments::SDK::Domain::AccountOnFileAttribute>] attributes
12
+ # @attr [OnlinePayments::SDK::Domain::AccountOnFileDisplayHints] display_hints
13
+ # @attr [Integer] id
14
+ # @attr [Integer] payment_product_id
15
+ class AccountOnFile < OnlinePayments::SDK::Domain::DataObject
10
16
 
11
- # @attr [Array<OnlinePayments::SDK::Domain::AccountOnFileAttribute>] attributes
12
- # @attr [OnlinePayments::SDK::Domain::AccountOnFileDisplayHints] display_hints
13
- # @attr [Integer] id
14
- # @attr [Integer] payment_product_id
15
- class AccountOnFile < OnlinePayments::SDK::DataObject
16
- attr_accessor :attributes
17
- attr_accessor :display_hints
18
- attr_accessor :id
19
- attr_accessor :payment_product_id
17
+ attr_accessor :attributes
20
18
 
21
- # @return (Hash)
22
- def to_h
23
- hash = super
24
- hash['attributes'] = @attributes.collect(&:to_h) if @attributes
25
- hash['displayHints'] = @display_hints.to_h if @display_hints
26
- hash['id'] = @id unless @id.nil?
27
- hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil?
28
- hash
29
- end
19
+ attr_accessor :display_hints
30
20
 
31
- def from_hash(hash)
32
- super
33
- if hash.key? 'attributes'
34
- raise TypeError, "value '%s' is not an Array" % [hash['attributes']] unless hash['attributes'].is_a? Array
35
- @attributes = []
36
- hash['attributes'].each do |e|
37
- @attributes << OnlinePayments::SDK::Domain::AccountOnFileAttribute.new_from_hash(e)
38
- end
21
+ attr_accessor :id
22
+
23
+ attr_accessor :payment_product_id
24
+
25
+ # @return (Hash)
26
+ def to_h
27
+ hash = super
28
+ hash['attributes'] = @attributes.collect{|val| val.to_h} unless @attributes.nil?
29
+ hash['displayHints'] = @display_hints.to_h unless @display_hints.nil?
30
+ hash['id'] = @id unless @id.nil?
31
+ hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil?
32
+ hash
39
33
  end
40
- if hash.key? 'displayHints'
41
- raise TypeError, "value '%s' is not a Hash" % [hash['displayHints']] unless hash['displayHints'].is_a? Hash
42
- @display_hints = OnlinePayments::SDK::Domain::AccountOnFileDisplayHints.new_from_hash(hash['displayHints'])
34
+
35
+ def from_hash(hash)
36
+ super
37
+ if hash.has_key? 'attributes'
38
+ raise TypeError, "value '%s' is not an Array" % [hash['attributes']] unless hash['attributes'].is_a? Array
39
+ @attributes = []
40
+ hash['attributes'].each do |e|
41
+ @attributes << OnlinePayments::SDK::Domain::AccountOnFileAttribute.new_from_hash(e)
42
+ end
43
+ end
44
+ if hash.has_key? 'displayHints'
45
+ raise TypeError, "value '%s' is not a Hash" % [hash['displayHints']] unless hash['displayHints'].is_a? Hash
46
+ @display_hints = OnlinePayments::SDK::Domain::AccountOnFileDisplayHints.new_from_hash(hash['displayHints'])
47
+ end
48
+ if hash.has_key? 'id'
49
+ @id = hash['id']
50
+ end
51
+ if hash.has_key? 'paymentProductId'
52
+ @payment_product_id = hash['paymentProductId']
53
+ end
43
54
  end
44
- @id = hash['id'] if hash.key? 'id'
45
- @payment_product_id = hash['paymentProductId'] if hash.key? 'paymentProductId'
46
55
  end
47
56
  end
48
57
  end
@@ -1,37 +1,51 @@
1
1
  #
2
- # This class was auto-generated.
2
+ # This file was automatically generated.
3
3
  #
4
- require 'onlinepayments/sdk/data_object'
4
+ require 'onlinepayments/sdk/domain/data_object'
5
5
 
6
- module OnlinePayments::SDK
7
- module Domain
6
+ module OnlinePayments
7
+ module SDK
8
+ module Domain
9
+ # @attr [String] key
10
+ # @attr [String] must_write_reason
11
+ # @attr [String] status
12
+ # @attr [String] value
13
+ class AccountOnFileAttribute < OnlinePayments::SDK::Domain::DataObject
8
14
 
9
- # @attr [String] key
10
- # @attr [String] must_write_reason
11
- # @attr [String] status
12
- # @attr [String] value
13
- class AccountOnFileAttribute < OnlinePayments::SDK::DataObject
14
- attr_accessor :key
15
- attr_accessor :must_write_reason
16
- attr_accessor :status
17
- attr_accessor :value
15
+ attr_accessor :key
18
16
 
19
- # @return (Hash)
20
- def to_h
21
- hash = super
22
- hash['key'] = @key unless @key.nil?
23
- hash['mustWriteReason'] = @must_write_reason unless @must_write_reason.nil?
24
- hash['status'] = @status unless @status.nil?
25
- hash['value'] = @value unless @value.nil?
26
- hash
27
- end
17
+ # @deprecated Deprecated
18
+ attr_accessor :must_write_reason
19
+
20
+ attr_accessor :status
21
+
22
+ attr_accessor :value
23
+
24
+ # @return (Hash)
25
+ def to_h
26
+ hash = super
27
+ hash['key'] = @key unless @key.nil?
28
+ hash['mustWriteReason'] = @must_write_reason unless @must_write_reason.nil?
29
+ hash['status'] = @status unless @status.nil?
30
+ hash['value'] = @value unless @value.nil?
31
+ hash
32
+ end
28
33
 
29
- def from_hash(hash)
30
- super
31
- @key = hash['key'] if hash.key? 'key'
32
- @must_write_reason = hash['mustWriteReason'] if hash.key? 'mustWriteReason'
33
- @status = hash['status'] if hash.key? 'status'
34
- @value = hash['value'] if hash.key? 'value'
34
+ def from_hash(hash)
35
+ super
36
+ if hash.has_key? 'key'
37
+ @key = hash['key']
38
+ end
39
+ if hash.has_key? 'mustWriteReason'
40
+ @must_write_reason = hash['mustWriteReason']
41
+ end
42
+ if hash.has_key? 'status'
43
+ @status = hash['status']
44
+ end
45
+ if hash.has_key? 'value'
46
+ @value = hash['value']
47
+ end
48
+ end
35
49
  end
36
50
  end
37
51
  end