connect-sdk-ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (377) 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/connect-sdk-ruby.gemspec +28 -0
  7. data/examples/merchant/example_configuration.yml +6 -0
  8. data/examples/merchant/hostedcheckouts/create_hosted_checkout_example.rb +53 -0
  9. data/examples/merchant/hostedcheckouts/get_hosted_checkout_example.rb +22 -0
  10. data/examples/merchant/payments/approve_payment_example.rb +42 -0
  11. data/examples/merchant/payments/cancel_approval_payment_example.rb +22 -0
  12. data/examples/merchant/payments/cancel_payment_example.rb +22 -0
  13. data/examples/merchant/payments/create_payment_example.rb +177 -0
  14. data/examples/merchant/payments/get_payment_example.rb +22 -0
  15. data/examples/merchant/payments/process_challenged_payment_example.rb +22 -0
  16. data/examples/merchant/payments/refund_payment_example.rb +85 -0
  17. data/examples/merchant/payments/tokenize_payment_example.rb +27 -0
  18. data/examples/merchant/payouts/approve_payout_example.rb +27 -0
  19. data/examples/merchant/payouts/cancel_approval_payout_example.rb +22 -0
  20. data/examples/merchant/payouts/cancel_payout_example.rb +22 -0
  21. data/examples/merchant/payouts/create_payout_example.rb +96 -0
  22. data/examples/merchant/payouts/get_payout_example.rb +22 -0
  23. data/examples/merchant/productgroups/get_payment_product_group_example.rb +32 -0
  24. data/examples/merchant/productgroups/get_payment_product_groups_example.rb +32 -0
  25. data/examples/merchant/products/get_directory_example.rb +28 -0
  26. data/examples/merchant/products/get_payment_product_example.rb +32 -0
  27. data/examples/merchant/products/get_payment_products_example.rb +32 -0
  28. data/examples/merchant/refunds/approve_refund_example.rb +27 -0
  29. data/examples/merchant/refunds/cancel_approval_refund_example.rb +22 -0
  30. data/examples/merchant/refunds/cancel_refund_example.rb +22 -0
  31. data/examples/merchant/refunds/get_refund_example.rb +22 -0
  32. data/examples/merchant/riskassessments/risk_assessment_bank_account_example.rb +54 -0
  33. data/examples/merchant/riskassessments/risk_assessment_cards_example.rb +114 -0
  34. data/examples/merchant/services/convert_amount_example.rb +29 -0
  35. data/examples/merchant/services/convert_bank_account_example.rb +34 -0
  36. data/examples/merchant/services/iin_details_example.rb +27 -0
  37. data/examples/merchant/services/test_connection_example.rb +22 -0
  38. data/examples/merchant/sessions/create_session_example.rb +34 -0
  39. data/examples/merchant/tokens/approve_sepa_direct_debit_token_example.rb +29 -0
  40. data/examples/merchant/tokens/create_token_example.rb +82 -0
  41. data/examples/merchant/tokens/delete_token_example.rb +27 -0
  42. data/examples/merchant/tokens/get_token_example.rb +22 -0
  43. data/examples/merchant/tokens/update_token_example.rb +76 -0
  44. data/lib/ingenico/connect/sdk.rb +27 -0
  45. data/lib/ingenico/connect/sdk/api_exception.rb +52 -0
  46. data/lib/ingenico/connect/sdk/api_resource.rb +126 -0
  47. data/lib/ingenico/connect/sdk/authenticator.rb +15 -0
  48. data/lib/ingenico/connect/sdk/authorization_exception.rb +13 -0
  49. data/lib/ingenico/connect/sdk/call_context.rb +26 -0
  50. data/lib/ingenico/connect/sdk/client.rb +92 -0
  51. data/lib/ingenico/connect/sdk/communication_exception.rb +15 -0
  52. data/lib/ingenico/connect/sdk/communicator.rb +277 -0
  53. data/lib/ingenico/connect/sdk/communicator_configuration.rb +98 -0
  54. data/lib/ingenico/connect/sdk/connection.rb +31 -0
  55. data/lib/ingenico/connect/sdk/data_object.rb +43 -0
  56. data/lib/ingenico/connect/sdk/declined_payment_exception.rb +44 -0
  57. data/lib/ingenico/connect/sdk/declined_payout_exception.rb +44 -0
  58. data/lib/ingenico/connect/sdk/declined_refund_exception.rb +46 -0
  59. data/lib/ingenico/connect/sdk/declined_transaction_exception.rb +16 -0
  60. data/lib/ingenico/connect/sdk/defaultimpl.rb +6 -0
  61. data/lib/ingenico/connect/sdk/defaultimpl/authorization_type.rb +18 -0
  62. data/lib/ingenico/connect/sdk/defaultimpl/default_authenticator.rb +106 -0
  63. data/lib/ingenico/connect/sdk/defaultimpl/default_connection.rb +242 -0
  64. data/lib/ingenico/connect/sdk/defaultimpl/default_marshaller.rb +35 -0
  65. data/lib/ingenico/connect/sdk/domain/definitions/abstract_order_status.rb +32 -0
  66. data/lib/ingenico/connect/sdk/domain/definitions/abstract_payment_method_specific_input.rb +32 -0
  67. data/lib/ingenico/connect/sdk/domain/definitions/additional_order_input_airline_data.rb +36 -0
  68. data/lib/ingenico/connect/sdk/domain/definitions/address.rb +81 -0
  69. data/lib/ingenico/connect/sdk/domain/definitions/airline_data.rb +165 -0
  70. data/lib/ingenico/connect/sdk/domain/definitions/airline_flight_leg.rb +102 -0
  71. data/lib/ingenico/connect/sdk/domain/definitions/amount_of_money.rb +39 -0
  72. data/lib/ingenico/connect/sdk/domain/definitions/bank_account.rb +32 -0
  73. data/lib/ingenico/connect/sdk/domain/definitions/bank_account_bban.rb +67 -0
  74. data/lib/ingenico/connect/sdk/domain/definitions/bank_account_iban.rb +32 -0
  75. data/lib/ingenico/connect/sdk/domain/definitions/card.rb +32 -0
  76. data/lib/ingenico/connect/sdk/domain/definitions/card_essentials.rb +39 -0
  77. data/lib/ingenico/connect/sdk/domain/definitions/card_fraud_results.rb +50 -0
  78. data/lib/ingenico/connect/sdk/domain/definitions/card_without_cvv.rb +39 -0
  79. data/lib/ingenico/connect/sdk/domain/definitions/company_information.rb +32 -0
  80. data/lib/ingenico/connect/sdk/domain/definitions/contact_details_base.rb +39 -0
  81. data/lib/ingenico/connect/sdk/domain/definitions/customer_base.rb +50 -0
  82. data/lib/ingenico/connect/sdk/domain/definitions/fraud_fields.rb +115 -0
  83. data/lib/ingenico/connect/sdk/domain/definitions/fraud_results.rb +32 -0
  84. data/lib/ingenico/connect/sdk/domain/definitions/fraud_results_retail_decisions.rb +46 -0
  85. data/lib/ingenico/connect/sdk/domain/definitions/key_value_pair.rb +39 -0
  86. data/lib/ingenico/connect/sdk/domain/definitions/order_status_output.rb +67 -0
  87. data/lib/ingenico/connect/sdk/domain/definitions/payment_product_filter.rb +51 -0
  88. data/lib/ingenico/connect/sdk/domain/definitions/personal_name_base.rb +46 -0
  89. data/lib/ingenico/connect/sdk/domain/definitions/result_do_risk_assessment.rb +61 -0
  90. data/lib/ingenico/connect/sdk/domain/definitions/retail_decisions_cc_fraud_check_output.rb +46 -0
  91. data/lib/ingenico/connect/sdk/domain/definitions/validation_bank_account_check.rb +46 -0
  92. data/lib/ingenico/connect/sdk/domain/definitions/validation_bank_account_output.rb +67 -0
  93. data/lib/ingenico/connect/sdk/domain/errors/api_error.rb +60 -0
  94. data/lib/ingenico/connect/sdk/domain/errors/error_response.rb +46 -0
  95. data/lib/ingenico/connect/sdk/domain/hostedcheckout/create_hosted_checkout_request.rb +102 -0
  96. data/lib/ingenico/connect/sdk/domain/hostedcheckout/create_hosted_checkout_response.rb +59 -0
  97. data/lib/ingenico/connect/sdk/domain/hostedcheckout/created_payment_output.rb +72 -0
  98. data/lib/ingenico/connect/sdk/domain/hostedcheckout/displayed_data.rb +53 -0
  99. data/lib/ingenico/connect/sdk/domain/hostedcheckout/get_hosted_checkout_response.rb +43 -0
  100. data/lib/ingenico/connect/sdk/domain/hostedcheckout/hosted_checkout_specific_input.rb +78 -0
  101. data/lib/ingenico/connect/sdk/domain/hostedcheckout/payment_product_filters_hosted_checkout.rb +53 -0
  102. data/lib/ingenico/connect/sdk/domain/metadata/shopping_cart_extension.rb +48 -0
  103. data/lib/ingenico/connect/sdk/domain/payment/abstract_payment_method_specific_output.rb +32 -0
  104. data/lib/ingenico/connect/sdk/domain/payment/additional_order_input.rb +72 -0
  105. data/lib/ingenico/connect/sdk/domain/payment/address_personal.rb +36 -0
  106. data/lib/ingenico/connect/sdk/domain/payment/approve_payment_card_payment_method_specific_output.rb +32 -0
  107. data/lib/ingenico/connect/sdk/domain/payment/approve_payment_non_sepa_direct_debit_payment_method_specific_input.rb +16 -0
  108. data/lib/ingenico/connect/sdk/domain/payment/approve_payment_payment_method_specific_input.rb +39 -0
  109. data/lib/ingenico/connect/sdk/domain/payment/approve_payment_request.rb +65 -0
  110. data/lib/ingenico/connect/sdk/domain/payment/approve_payment_sepa_direct_debit_payment_method_specific_input.rb +16 -0
  111. data/lib/ingenico/connect/sdk/domain/payment/bank_transfer_payment_method_specific_input.rb +16 -0
  112. data/lib/ingenico/connect/sdk/domain/payment/bank_transfer_payment_method_specific_input_base.rb +32 -0
  113. data/lib/ingenico/connect/sdk/domain/payment/bank_transfer_payment_method_specific_output.rb +16 -0
  114. data/lib/ingenico/connect/sdk/domain/payment/cancel_approval_payment_response.rb +36 -0
  115. data/lib/ingenico/connect/sdk/domain/payment/cancel_payment_card_payment_method_specific_output.rb +32 -0
  116. data/lib/ingenico/connect/sdk/domain/payment/cancel_payment_response.rb +47 -0
  117. data/lib/ingenico/connect/sdk/domain/payment/card_payment_method_specific_input.rb +61 -0
  118. data/lib/ingenico/connect/sdk/domain/payment/card_payment_method_specific_input_base.rb +60 -0
  119. data/lib/ingenico/connect/sdk/domain/payment/card_payment_method_specific_output.rb +65 -0
  120. data/lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_input.rb +47 -0
  121. data/lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_input_base.rb +16 -0
  122. data/lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_output.rb +16 -0
  123. data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1503_specific_input.rb +32 -0
  124. data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1504_specific_input.rb +32 -0
  125. data/lib/ingenico/connect/sdk/domain/payment/contact_details.rb +39 -0
  126. data/lib/ingenico/connect/sdk/domain/payment/create_payment_request.rb +131 -0
  127. data/lib/ingenico/connect/sdk/domain/payment/create_payment_response.rb +16 -0
  128. data/lib/ingenico/connect/sdk/domain/payment/create_payment_result.rb +58 -0
  129. data/lib/ingenico/connect/sdk/domain/payment/customer.rb +83 -0
  130. data/lib/ingenico/connect/sdk/domain/payment/external_cardholder_authentication_data.rb +60 -0
  131. data/lib/ingenico/connect/sdk/domain/payment/invoice_payment_method_specific_input.rb +32 -0
  132. data/lib/ingenico/connect/sdk/domain/payment/invoice_payment_method_specific_output.rb +16 -0
  133. data/lib/ingenico/connect/sdk/domain/payment/level3_summary_data.rb +46 -0
  134. data/lib/ingenico/connect/sdk/domain/payment/line_item.rb +58 -0
  135. data/lib/ingenico/connect/sdk/domain/payment/line_item_invoice_data.rb +60 -0
  136. data/lib/ingenico/connect/sdk/domain/payment/line_item_level3_interchange_information.rb +81 -0
  137. data/lib/ingenico/connect/sdk/domain/payment/merchant_action.rb +64 -0
  138. data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_method_specific_input.rb +71 -0
  139. data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_method_specific_output.rb +36 -0
  140. data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_product705_specific_input.rb +50 -0
  141. data/lib/ingenico/connect/sdk/domain/payment/order.rb +83 -0
  142. data/lib/ingenico/connect/sdk/domain/payment/order_approve_payment.rb +47 -0
  143. data/lib/ingenico/connect/sdk/domain/payment/order_invoice_data.rb +59 -0
  144. data/lib/ingenico/connect/sdk/domain/payment/order_output.rb +47 -0
  145. data/lib/ingenico/connect/sdk/domain/payment/order_references.rb +57 -0
  146. data/lib/ingenico/connect/sdk/domain/payment/order_references_approve_payment.rb +32 -0
  147. data/lib/ingenico/connect/sdk/domain/payment/order_type_information.rb +39 -0
  148. data/lib/ingenico/connect/sdk/domain/payment/payment.rb +54 -0
  149. data/lib/ingenico/connect/sdk/domain/payment/payment_approval_response.rb +47 -0
  150. data/lib/ingenico/connect/sdk/domain/payment/payment_creation_output.rb +39 -0
  151. data/lib/ingenico/connect/sdk/domain/payment/payment_creation_references.rb +39 -0
  152. data/lib/ingenico/connect/sdk/domain/payment/payment_error_response.rb +57 -0
  153. data/lib/ingenico/connect/sdk/domain/payment/payment_output.rb +116 -0
  154. data/lib/ingenico/connect/sdk/domain/payment/payment_product836_specific_output.rb +32 -0
  155. data/lib/ingenico/connect/sdk/domain/payment/payment_product840_customer_account.rb +88 -0
  156. data/lib/ingenico/connect/sdk/domain/payment/payment_product840_specific_output.rb +47 -0
  157. data/lib/ingenico/connect/sdk/domain/payment/payment_references.rb +67 -0
  158. data/lib/ingenico/connect/sdk/domain/payment/payment_response.rb +16 -0
  159. data/lib/ingenico/connect/sdk/domain/payment/payment_status_output.rb +39 -0
  160. data/lib/ingenico/connect/sdk/domain/payment/personal_information.rb +50 -0
  161. data/lib/ingenico/connect/sdk/domain/payment/personal_name.rb +32 -0
  162. data/lib/ingenico/connect/sdk/domain/payment/redirect_data.rb +39 -0
  163. data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input.rb +72 -0
  164. data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input_base.rb +39 -0
  165. data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_output.rb +58 -0
  166. data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product809_specific_input.rb +39 -0
  167. data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product816_specific_input.rb +36 -0
  168. data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product882_specific_input.rb +32 -0
  169. data/lib/ingenico/connect/sdk/domain/payment/refund_bank_method_specific_output.rb +16 -0
  170. data/lib/ingenico/connect/sdk/domain/payment/refund_card_method_specific_output.rb +16 -0
  171. data/lib/ingenico/connect/sdk/domain/payment/refund_e_wallet_method_specific_output.rb +36 -0
  172. data/lib/ingenico/connect/sdk/domain/payment/refund_method_specific_output.rb +39 -0
  173. data/lib/ingenico/connect/sdk/domain/payment/refund_output.rb +72 -0
  174. data/lib/ingenico/connect/sdk/domain/payment/refund_payment_product840_customer_account.rb +46 -0
  175. data/lib/ingenico/connect/sdk/domain/payment/refund_payment_product840_specific_output.rb +36 -0
  176. data/lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_method_specific_input.rb +60 -0
  177. data/lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_method_specific_output.rb +36 -0
  178. data/lib/ingenico/connect/sdk/domain/payment/three_d_secure_results.rb +46 -0
  179. data/lib/ingenico/connect/sdk/domain/payment/tokenize_payment_request.rb +32 -0
  180. data/lib/ingenico/connect/sdk/domain/payout/approve_payout_request.rb +32 -0
  181. data/lib/ingenico/connect/sdk/domain/payout/create_payout_request.rb +101 -0
  182. data/lib/ingenico/connect/sdk/domain/payout/payout_customer.rb +76 -0
  183. data/lib/ingenico/connect/sdk/domain/payout/payout_error_response.rb +57 -0
  184. data/lib/ingenico/connect/sdk/domain/payout/payout_references.rb +46 -0
  185. data/lib/ingenico/connect/sdk/domain/payout/payout_response.rb +16 -0
  186. data/lib/ingenico/connect/sdk/domain/payout/payout_result.rb +54 -0
  187. data/lib/ingenico/connect/sdk/domain/product/account_on_file.rb +64 -0
  188. data/lib/ingenico/connect/sdk/domain/product/account_on_file_attribute.rb +39 -0
  189. data/lib/ingenico/connect/sdk/domain/product/account_on_file_display_hints.rb +46 -0
  190. data/lib/ingenico/connect/sdk/domain/product/directory.rb +39 -0
  191. data/lib/ingenico/connect/sdk/domain/product/directory_entry.rb +59 -0
  192. data/lib/ingenico/connect/sdk/domain/product/empty_validator.rb +16 -0
  193. data/lib/ingenico/connect/sdk/domain/product/fixed_list_validator.rb +38 -0
  194. data/lib/ingenico/connect/sdk/domain/product/label_template_element.rb +39 -0
  195. data/lib/ingenico/connect/sdk/domain/product/length_validator.rb +39 -0
  196. data/lib/ingenico/connect/sdk/domain/product/payment_product.rb +134 -0
  197. data/lib/ingenico/connect/sdk/domain/product/payment_product_display_hints.rb +46 -0
  198. data/lib/ingenico/connect/sdk/domain/product/payment_product_field.rb +61 -0
  199. data/lib/ingenico/connect/sdk/domain/product/payment_product_field_data_restrictions.rb +43 -0
  200. data/lib/ingenico/connect/sdk/domain/product/payment_product_field_display_hints.rb +96 -0
  201. data/lib/ingenico/connect/sdk/domain/product/payment_product_field_form_element.rb +46 -0
  202. data/lib/ingenico/connect/sdk/domain/product/payment_product_field_tooltip.rb +39 -0
  203. data/lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb +100 -0
  204. data/lib/ingenico/connect/sdk/domain/product/payment_product_group.rb +71 -0
  205. data/lib/ingenico/connect/sdk/domain/product/payment_product_group_response.rb +16 -0
  206. data/lib/ingenico/connect/sdk/domain/product/payment_product_groups.rb +39 -0
  207. data/lib/ingenico/connect/sdk/domain/product/payment_product_response.rb +16 -0
  208. data/lib/ingenico/connect/sdk/domain/product/payment_products.rb +39 -0
  209. data/lib/ingenico/connect/sdk/domain/product/range_validator.rb +39 -0
  210. data/lib/ingenico/connect/sdk/domain/product/regular_expression_validator.rb +32 -0
  211. data/lib/ingenico/connect/sdk/domain/product/value_mapping_element.rb +39 -0
  212. data/lib/ingenico/connect/sdk/domain/refund/approve_refund_request.rb +32 -0
  213. data/lib/ingenico/connect/sdk/domain/refund/bank_account_bban_refund.rb +39 -0
  214. data/lib/ingenico/connect/sdk/domain/refund/bank_refund_method_specific_input.rb +54 -0
  215. data/lib/ingenico/connect/sdk/domain/refund/refund_customer.rb +58 -0
  216. data/lib/ingenico/connect/sdk/domain/refund/refund_error_response.rb +57 -0
  217. data/lib/ingenico/connect/sdk/domain/refund/refund_references.rb +32 -0
  218. data/lib/ingenico/connect/sdk/domain/refund/refund_request.rb +76 -0
  219. data/lib/ingenico/connect/sdk/domain/refund/refund_response.rb +16 -0
  220. data/lib/ingenico/connect/sdk/domain/refund/refund_result.rb +54 -0
  221. data/lib/ingenico/connect/sdk/domain/riskassessments/customer_risk_assessment.rb +65 -0
  222. data/lib/ingenico/connect/sdk/domain/riskassessments/order_risk_assessment.rb +58 -0
  223. data/lib/ingenico/connect/sdk/domain/riskassessments/personal_information_risk_assessment.rb +36 -0
  224. data/lib/ingenico/connect/sdk/domain/riskassessments/personal_name_risk_assessment.rb +16 -0
  225. data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment.rb +54 -0
  226. data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment_bank_account.rb +47 -0
  227. data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment_card.rb +36 -0
  228. data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment_response.rb +39 -0
  229. data/lib/ingenico/connect/sdk/domain/services/bank_data.rb +53 -0
  230. data/lib/ingenico/connect/sdk/domain/services/bank_details.rb +47 -0
  231. data/lib/ingenico/connect/sdk/domain/services/bank_details_request.rb +16 -0
  232. data/lib/ingenico/connect/sdk/domain/services/bank_details_response.rb +69 -0
  233. data/lib/ingenico/connect/sdk/domain/services/convert_amount.rb +32 -0
  234. data/lib/ingenico/connect/sdk/domain/services/get_iin_details_request.rb +43 -0
  235. data/lib/ingenico/connect/sdk/domain/services/get_iin_details_response.rb +60 -0
  236. data/lib/ingenico/connect/sdk/domain/services/iin_detail.rb +39 -0
  237. data/lib/ingenico/connect/sdk/domain/services/payment_context.rb +50 -0
  238. data/lib/ingenico/connect/sdk/domain/services/swift.rb +95 -0
  239. data/lib/ingenico/connect/sdk/domain/services/test_connection.rb +32 -0
  240. data/lib/ingenico/connect/sdk/domain/sessions/payment_product_filters_client_session.rb +46 -0
  241. data/lib/ingenico/connect/sdk/domain/sessions/session_request.rb +49 -0
  242. data/lib/ingenico/connect/sdk/domain/sessions/session_response.rb +59 -0
  243. data/lib/ingenico/connect/sdk/domain/token/abstract_token.rb +32 -0
  244. data/lib/ingenico/connect/sdk/domain/token/approve_token_request.rb +16 -0
  245. data/lib/ingenico/connect/sdk/domain/token/contact_details_token.rb +16 -0
  246. data/lib/ingenico/connect/sdk/domain/token/create_token_request.rb +76 -0
  247. data/lib/ingenico/connect/sdk/domain/token/create_token_response.rb +39 -0
  248. data/lib/ingenico/connect/sdk/domain/token/creditor.rb +102 -0
  249. data/lib/ingenico/connect/sdk/domain/token/customer_token.rb +47 -0
  250. data/lib/ingenico/connect/sdk/domain/token/customer_token_with_contact_details.rb +36 -0
  251. data/lib/ingenico/connect/sdk/domain/token/debtor.rb +102 -0
  252. data/lib/ingenico/connect/sdk/domain/token/mandate_approval.rb +46 -0
  253. data/lib/ingenico/connect/sdk/domain/token/mandate_non_sepa_direct_debit.rb +36 -0
  254. data/lib/ingenico/connect/sdk/domain/token/mandate_sepa_direct_debit.rb +36 -0
  255. data/lib/ingenico/connect/sdk/domain/token/mandate_sepa_direct_debit_with_mandate_id.rb +32 -0
  256. data/lib/ingenico/connect/sdk/domain/token/mandate_sepa_direct_debit_without_creditor.rb +79 -0
  257. data/lib/ingenico/connect/sdk/domain/token/personal_information_token.rb +36 -0
  258. data/lib/ingenico/connect/sdk/domain/token/personal_name_token.rb +16 -0
  259. data/lib/ingenico/connect/sdk/domain/token/token_card.rb +47 -0
  260. data/lib/ingenico/connect/sdk/domain/token/token_card_data.rb +50 -0
  261. data/lib/ingenico/connect/sdk/domain/token/token_e_wallet.rb +47 -0
  262. data/lib/ingenico/connect/sdk/domain/token/token_e_wallet_data.rb +32 -0
  263. data/lib/ingenico/connect/sdk/domain/token/token_non_sepa_direct_debit.rb +47 -0
  264. data/lib/ingenico/connect/sdk/domain/token/token_non_sepa_direct_debit_payment_product705_specific_data.rb +43 -0
  265. data/lib/ingenico/connect/sdk/domain/token/token_response.rb +83 -0
  266. data/lib/ingenico/connect/sdk/domain/token/token_sepa_direct_debit.rb +47 -0
  267. data/lib/ingenico/connect/sdk/domain/token/token_sepa_direct_debit_without_creditor.rb +47 -0
  268. data/lib/ingenico/connect/sdk/domain/token/update_token_request.rb +76 -0
  269. data/lib/ingenico/connect/sdk/endpoint_configuration.rb +139 -0
  270. data/lib/ingenico/connect/sdk/exceptions.rb +8 -0
  271. data/lib/ingenico/connect/sdk/factory.rb +200 -0
  272. data/lib/ingenico/connect/sdk/global_collect_exception.rb +15 -0
  273. data/lib/ingenico/connect/sdk/idempotence_exception.rb +24 -0
  274. data/lib/ingenico/connect/sdk/logging.rb +10 -0
  275. data/lib/ingenico/connect/sdk/logging/communicator_logger.rb +19 -0
  276. data/lib/ingenico/connect/sdk/logging/log_message_builder.rb +61 -0
  277. data/lib/ingenico/connect/sdk/logging/logging_capable.rb +19 -0
  278. data/lib/ingenico/connect/sdk/logging/logging_util.rb +298 -0
  279. data/lib/ingenico/connect/sdk/logging/request_log_message_builder.rb +42 -0
  280. data/lib/ingenico/connect/sdk/logging/response_log_message_builder.rb +34 -0
  281. data/lib/ingenico/connect/sdk/logging/ruby_communicator_logger.rb +58 -0
  282. data/lib/ingenico/connect/sdk/logging/stdout_communicator_logger.rb +36 -0
  283. data/lib/ingenico/connect/sdk/marshaller.rb +19 -0
  284. data/lib/ingenico/connect/sdk/marshaller_syntax_exception.rb +6 -0
  285. data/lib/ingenico/connect/sdk/merchant/hostedcheckouts/hostedcheckouts_client.rb +88 -0
  286. data/lib/ingenico/connect/sdk/merchant/merchant_client.rb +110 -0
  287. data/lib/ingenico/connect/sdk/merchant/payments/payments_client.rb +319 -0
  288. data/lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb +197 -0
  289. data/lib/ingenico/connect/sdk/merchant/productgroups/find_productgroups_params.rb +55 -0
  290. data/lib/ingenico/connect/sdk/merchant/productgroups/get_productgroup_params.rb +55 -0
  291. data/lib/ingenico/connect/sdk/merchant/productgroups/productgroups_client.rb +90 -0
  292. data/lib/ingenico/connect/sdk/merchant/products/directory_params.rb +31 -0
  293. data/lib/ingenico/connect/sdk/merchant/products/find_products_params.rb +55 -0
  294. data/lib/ingenico/connect/sdk/merchant/products/get_product_params.rb +55 -0
  295. data/lib/ingenico/connect/sdk/merchant/products/products_client.rb +124 -0
  296. data/lib/ingenico/connect/sdk/merchant/refunds/refunds_client.rb +154 -0
  297. data/lib/ingenico/connect/sdk/merchant/riskassessments/riskassessments_client.rb +85 -0
  298. data/lib/ingenico/connect/sdk/merchant/services/convert_amount_params.rb +35 -0
  299. data/lib/ingenico/connect/sdk/merchant/services/services_client.rb +149 -0
  300. data/lib/ingenico/connect/sdk/merchant/sessions/sessions_client.rb +55 -0
  301. data/lib/ingenico/connect/sdk/merchant/tokens/delete_token_params.rb +27 -0
  302. data/lib/ingenico/connect/sdk/merchant/tokens/tokens_client.rb +192 -0
  303. data/lib/ingenico/connect/sdk/meta_data_provider.rb +152 -0
  304. data/lib/ingenico/connect/sdk/modules.rb +130 -0
  305. data/lib/ingenico/connect/sdk/not_found_exception.rb +19 -0
  306. data/lib/ingenico/connect/sdk/param_request.rb +33 -0
  307. data/lib/ingenico/connect/sdk/pooled_connection.rb +21 -0
  308. data/lib/ingenico/connect/sdk/proxy_configuration.rb +75 -0
  309. data/lib/ingenico/connect/sdk/reference_exception.rb +14 -0
  310. data/lib/ingenico/connect/sdk/request_header.rb +25 -0
  311. data/lib/ingenico/connect/sdk/request_param.rb +24 -0
  312. data/lib/ingenico/connect/sdk/response.rb +62 -0
  313. data/lib/ingenico/connect/sdk/response_exception.rb +54 -0
  314. data/lib/ingenico/connect/sdk/response_header.rb +25 -0
  315. data/lib/ingenico/connect/sdk/session.rb +39 -0
  316. data/lib/ingenico/connect/sdk/validation_exception.rb +14 -0
  317. data/spec/comparable_extension.rb +29 -0
  318. data/spec/fixtures/resources/defaultimpl/convertAmount.json +3 -0
  319. data/spec/fixtures/resources/defaultimpl/createPayment.failure.invalidCardNumber.json +11 -0
  320. data/spec/fixtures/resources/defaultimpl/createPayment.failure.rejected.json +48 -0
  321. data/spec/fixtures/resources/defaultimpl/createPayment.json +40 -0
  322. data/spec/fixtures/resources/defaultimpl/idempotence_duplicate_failure.json +8 -0
  323. data/spec/fixtures/resources/defaultimpl/idempotence_rejected.json +46 -0
  324. data/spec/fixtures/resources/defaultimpl/idempotence_success.json +39 -0
  325. data/spec/fixtures/resources/defaultimpl/notFound.html +1 -0
  326. data/spec/fixtures/resources/defaultimpl/testConnection.json +3 -0
  327. data/spec/fixtures/resources/defaultimpl/unknownServerError.json +10 -0
  328. data/spec/fixtures/resources/logging/bodyNoObfuscation.json +17 -0
  329. data/spec/fixtures/resources/logging/bodyWithBinObfuscated.json +3 -0
  330. data/spec/fixtures/resources/logging/bodyWithBinOriginal.json +3 -0
  331. data/spec/fixtures/resources/logging/bodyWithCardObfuscated.json +21 -0
  332. data/spec/fixtures/resources/logging/bodyWithCardOriginal.json +21 -0
  333. data/spec/fixtures/resources/logging/bodyWithIbanObfuscated.json +19 -0
  334. data/spec/fixtures/resources/logging/bodyWithIbanOriginal.json +19 -0
  335. data/spec/fixtures/resources/payment/duplicate_request.json +8 -0
  336. data/spec/fixtures/resources/payment/invalid_authorization.json +9 -0
  337. data/spec/fixtures/resources/payment/invalid_request.json +11 -0
  338. data/spec/fixtures/resources/payment/method_not_allowed.html +1 -0
  339. data/spec/fixtures/resources/payment/not_found.html +1 -0
  340. data/spec/fixtures/resources/payment/pending_approval.json +39 -0
  341. data/spec/fixtures/resources/payment/rejected.json +46 -0
  342. data/spec/fixtures/resources/properties.proxy.yml +13 -0
  343. data/spec/fixtures/resources/properties.yml +7 -0
  344. data/spec/integration/connection_pooling_spec.rb +78 -0
  345. data/spec/integration/convert_amount_spec.rb +25 -0
  346. data/spec/integration/idempotence_spec.rb +59 -0
  347. data/spec/integration/multiline_header_spec.rb +30 -0
  348. data/spec/integration/payment_product_groups_spec.rb +23 -0
  349. data/spec/integration/payment_products_spec.rb +22 -0
  350. data/spec/integration/risk_assessments_spec.rb +37 -0
  351. data/spec/integration/sdk_proxy_spec.rb +89 -0
  352. data/spec/integration/token_spec.rb +42 -0
  353. data/spec/integration_setup.rb +50 -0
  354. data/spec/lib/client_spec.rb +69 -0
  355. data/spec/lib/communicator_configuration_spec.rb +179 -0
  356. data/spec/lib/communicator_spec.rb +31 -0
  357. data/spec/lib/defaultimpl/default_authenticator_spec.rb +74 -0
  358. data/spec/lib/defaultimpl/default_connection_idempotence_spec.rb +142 -0
  359. data/spec/lib/defaultimpl/default_connection_logger_spec.rb +526 -0
  360. data/spec/lib/defaultimpl/default_connection_spec.rb +334 -0
  361. data/spec/lib/defaultimpl/default_marshaller_spec.rb +36 -0
  362. data/spec/lib/factory_spec.rb +41 -0
  363. data/spec/lib/logging/header_obfuscator_spec.rb +51 -0
  364. data/spec/lib/logging/logging_util_spec.rb +143 -0
  365. data/spec/lib/logging/obfuscator_spec.rb +52 -0
  366. data/spec/lib/logging/ruby_communicator_logger_spec.rb +84 -0
  367. data/spec/lib/logging/stdout_communicator_logger_spec.rb +64 -0
  368. data/spec/lib/logging/value_obfuscator_spec.rb +95 -0
  369. data/spec/lib/meta_data_provider_spec.rb +71 -0
  370. data/spec/lib/payments_client_spec.rb +157 -0
  371. data/spec/lib/requestparams/delete_params_spec.rb +21 -0
  372. data/spec/lib/requestparams/directory_params_spec.rb +27 -0
  373. data/spec/lib/requestparams/find_params_spec.rb +58 -0
  374. data/spec/lib/requestparams/get_params_spec.rb +59 -0
  375. data/spec/lib/requestparams/param_request_spec.rb +57 -0
  376. data/spec/spec_helper.rb +23 -0
  377. metadata +565 -0
@@ -0,0 +1,149 @@
1
+ #
2
+ # This class was auto-generated from the API references found at
3
+ # https://developer.globalcollect.com/documentation/api/server/
4
+ #
5
+ require 'ingenico/connect/sdk/api_resource'
6
+ require 'ingenico/connect/sdk/response_exception'
7
+ require 'ingenico/connect/sdk/domain/errors/error_response'
8
+ require 'ingenico/connect/sdk/domain/services/bank_details_response'
9
+ require 'ingenico/connect/sdk/domain/services/convert_amount'
10
+ require 'ingenico/connect/sdk/domain/services/get_iin_details_response'
11
+ require 'ingenico/connect/sdk/domain/services/test_connection'
12
+
13
+ module Ingenico::Connect::SDK
14
+ module Merchant
15
+ module Services
16
+
17
+ # Services client. Thread-safe.
18
+ class ServicesClient < Ingenico::Connect::SDK::ApiResource
19
+
20
+ # parent:: {Ingenico::Connect::SDK::ApiResource}
21
+ # path_context:: Hash of String to String
22
+ def initialize(parent, path_context)
23
+ super(parent, path_context)
24
+ end
25
+
26
+ # Resource /{{merchantId}}/services/convert/amount
27
+ #
28
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__services_convert_amount_get Convert amount}
29
+ # query:: {Ingenico::Connect::SDK::Merchant::Services::ConvertAmountParams}
30
+ # context:: {Ingenico::Connect::SDK::CallContext}
31
+ # Returns:: {Ingenico::Connect::SDK::Domain::Services::ConvertAmount}
32
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
33
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
34
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
35
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
36
+ # or there was a conflict (HTTP status code 404, 409 or 410)
37
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
38
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
39
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
40
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
41
+ def convert_amount(query, context=nil)
42
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/services/convert/amount', nil)
43
+ return @communicator.get(
44
+ uri,
45
+ client_headers,
46
+ query,
47
+ Ingenico::Connect::SDK::Domain::Services::ConvertAmount,
48
+ context)
49
+ rescue ResponseException => e
50
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
51
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
52
+ raise create_exception(e.status_code, e.body, error_object, context)
53
+ end
54
+
55
+ # Resource /{{merchantId}}/services/convert/bankaccount
56
+ #
57
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__services_convert_bankaccount_post Convert Bankaccount}
58
+ # body:: {Ingenico::Connect::SDK::Domain::Services::BankDetailsRequest}
59
+ # context:: {Ingenico::Connect::SDK::CallContext}
60
+ # Returns:: {Ingenico::Connect::SDK::Domain::Services::BankDetailsResponse}
61
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
62
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
63
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
64
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
65
+ # or there was a conflict (HTTP status code 404, 409 or 410)
66
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
67
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
68
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
69
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
70
+ def bankaccount(body, context=nil)
71
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/services/convert/bankaccount', nil)
72
+ return @communicator.post(
73
+ uri,
74
+ client_headers,
75
+ nil,
76
+ body,
77
+ Ingenico::Connect::SDK::Domain::Services::BankDetailsResponse,
78
+ context)
79
+ rescue ResponseException => e
80
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
81
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
82
+ raise create_exception(e.status_code, e.body, error_object, context)
83
+ end
84
+
85
+ # Resource /{{merchantId}}/services/getIINdetails
86
+ #
87
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__services_getIINdetails_post Get IIN details}
88
+ # body:: {Ingenico::Connect::SDK::Domain::Services::GetIINDetailsRequest}
89
+ # context:: {Ingenico::Connect::SDK::CallContext}
90
+ # Returns:: {Ingenico::Connect::SDK::Domain::Services::GetIINDetailsResponse}
91
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
92
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
93
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
94
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
95
+ # or there was a conflict (HTTP status code 404, 409 or 410)
96
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
97
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
98
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
99
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
100
+ def get_iin_details(body, context=nil)
101
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/services/getIINdetails', nil)
102
+ return @communicator.post(
103
+ uri,
104
+ client_headers,
105
+ nil,
106
+ body,
107
+ Ingenico::Connect::SDK::Domain::Services::GetIINDetailsResponse,
108
+ context)
109
+ rescue ResponseException => e
110
+ error_type = {
111
+ 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
112
+ }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
113
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
114
+ raise create_exception(e.status_code, e.body, error_object, context)
115
+ end
116
+
117
+ # Resource /{{merchantId}}/services/testconnection
118
+ #
119
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__services_testconnection_get Test connection}
120
+ # context:: {Ingenico::Connect::SDK::CallContext}
121
+ # Returns:: {Ingenico::Connect::SDK::Domain::Services::TestConnection}
122
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
123
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
124
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
125
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
126
+ # or there was a conflict (HTTP status code 404, 409 or 410)
127
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
128
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
129
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
130
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
131
+ def testconnection(context=nil)
132
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/services/testconnection', nil)
133
+ return @communicator.get(
134
+ uri,
135
+ client_headers,
136
+ nil,
137
+ Ingenico::Connect::SDK::Domain::Services::TestConnection,
138
+ context)
139
+ rescue ResponseException => e
140
+ error_type = {
141
+ 403 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
142
+ }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
143
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
144
+ raise create_exception(e.status_code, e.body, error_object, context)
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,55 @@
1
+ #
2
+ # This class was auto-generated from the API references found at
3
+ # https://developer.globalcollect.com/documentation/api/server/
4
+ #
5
+ require 'ingenico/connect/sdk/api_resource'
6
+ require 'ingenico/connect/sdk/response_exception'
7
+ require 'ingenico/connect/sdk/domain/errors/error_response'
8
+ require 'ingenico/connect/sdk/domain/sessions/session_response'
9
+
10
+ module Ingenico::Connect::SDK
11
+ module Merchant
12
+ module Sessions
13
+
14
+ # Sessions client. Thread-safe.
15
+ class SessionsClient < Ingenico::Connect::SDK::ApiResource
16
+
17
+ # parent:: {Ingenico::Connect::SDK::ApiResource}
18
+ # path_context:: Hash of String to String
19
+ def initialize(parent, path_context)
20
+ super(parent, path_context)
21
+ end
22
+
23
+ # Resource /{{merchantId}}/sessions
24
+ #
25
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__sessions_post Create Session}
26
+ # body:: {Ingenico::Connect::SDK::Domain::Sessions::SessionRequest}
27
+ # context:: {Ingenico::Connect::SDK::CallContext}
28
+ # Returns:: {Ingenico::Connect::SDK::Domain::Sessions::SessionResponse}
29
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
30
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
31
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
32
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
33
+ # or there was a conflict (HTTP status code 404, 409 or 410)
34
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
35
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
36
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
37
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
38
+ def create(body, context=nil)
39
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/sessions', nil)
40
+ return @communicator.post(
41
+ uri,
42
+ client_headers,
43
+ nil,
44
+ body,
45
+ Ingenico::Connect::SDK::Domain::Sessions::SessionResponse,
46
+ context)
47
+ rescue ResponseException => e
48
+ error_type = Ingenico::Connect::SDK::Domain::Errors::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
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,27 @@
1
+ #
2
+ # This class was auto-generated from the API references found at
3
+ # https://developer.globalcollect.com/documentation/api/server/
4
+ #
5
+ require 'ingenico/connect/sdk/param_request'
6
+
7
+ module Ingenico::Connect::SDK
8
+ module Merchant
9
+ module Tokens
10
+
11
+ # Query parameters for {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__delete Delete token}
12
+ class DeleteTokenParams < Ingenico::Connect::SDK::ParamRequest
13
+
14
+ # String
15
+ attr_accessor :mandate_cancel_date
16
+ attr_accessor :mandate_cancel_date
17
+
18
+ # Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
19
+ def to_request_parameters
20
+ result = []
21
+ add_parameter(result, 'mandateCancelDate', @mandate_cancel_date)
22
+ result
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,192 @@
1
+ #
2
+ # This class was auto-generated from the API references found at
3
+ # https://developer.globalcollect.com/documentation/api/server/
4
+ #
5
+ require 'ingenico/connect/sdk/api_resource'
6
+ require 'ingenico/connect/sdk/response_exception'
7
+ require 'ingenico/connect/sdk/domain/errors/error_response'
8
+ require 'ingenico/connect/sdk/domain/token/create_token_response'
9
+ require 'ingenico/connect/sdk/domain/token/token_response'
10
+
11
+ module Ingenico::Connect::SDK
12
+ module Merchant
13
+ module Tokens
14
+
15
+ # Tokens client. Thread-safe.
16
+ class TokensClient < Ingenico::Connect::SDK::ApiResource
17
+
18
+ # parent:: {Ingenico::Connect::SDK::ApiResource}
19
+ # path_context:: Hash of String to String
20
+ def initialize(parent, path_context)
21
+ super(parent, path_context)
22
+ end
23
+
24
+ # Resource /{{merchantId}}/tokens
25
+ #
26
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens_post Create token}
27
+ # body:: {Ingenico::Connect::SDK::Domain::Token::CreateTokenRequest}
28
+ # context:: {Ingenico::Connect::SDK::CallContext}
29
+ # Returns:: {Ingenico::Connect::SDK::Domain::Token::CreateTokenResponse}
30
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
31
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
32
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
33
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
34
+ # or there was a conflict (HTTP status code 404, 409 or 410)
35
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
36
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
37
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
38
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
39
+ def create(body, context=nil)
40
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/tokens', nil)
41
+ return @communicator.post(
42
+ uri,
43
+ client_headers,
44
+ nil,
45
+ body,
46
+ Ingenico::Connect::SDK::Domain::Token::CreateTokenResponse,
47
+ context)
48
+ rescue ResponseException => e
49
+ error_type = {
50
+ 403 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
51
+ }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
52
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
53
+ raise create_exception(e.status_code, e.body, error_object, context)
54
+ end
55
+
56
+ # Resource /{{merchantId}}/tokens/{{tokenId}}
57
+ #
58
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__delete Delete token}
59
+ # token_id:: String
60
+ # query:: {Ingenico::Connect::SDK::Merchant::Tokens::DeleteParams}
61
+ # context:: {Ingenico::Connect::SDK::CallContext}
62
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
63
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
64
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
65
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
66
+ # or there was a conflict (HTTP status code 404, 409 or 410)
67
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
68
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
69
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
70
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
71
+ def delete(token_id, query, context=nil)
72
+ path_context = {
73
+ 'tokenId' => token_id,
74
+ }
75
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/tokens/{tokenId}', path_context)
76
+ return @communicator.delete(
77
+ uri,
78
+ client_headers,
79
+ query,
80
+ nil,
81
+ context)
82
+ rescue ResponseException => e
83
+ error_type = {
84
+ 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
85
+ }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
86
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
87
+ raise create_exception(e.status_code, e.body, error_object, context)
88
+ end
89
+
90
+ # Resource /{{merchantId}}/tokens/{{tokenId}}
91
+ #
92
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__get Get token}
93
+ # token_id:: String
94
+ # context:: {Ingenico::Connect::SDK::CallContext}
95
+ # Returns:: {Ingenico::Connect::SDK::Domain::Token::TokenResponse}
96
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
97
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
98
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
99
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
100
+ # or there was a conflict (HTTP status code 404, 409 or 410)
101
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
102
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
103
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
104
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
105
+ def get(token_id, context=nil)
106
+ path_context = {
107
+ 'tokenId' => token_id,
108
+ }
109
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/tokens/{tokenId}', path_context)
110
+ return @communicator.get(
111
+ uri,
112
+ client_headers,
113
+ nil,
114
+ Ingenico::Connect::SDK::Domain::Token::TokenResponse,
115
+ context)
116
+ rescue ResponseException => e
117
+ error_type = {
118
+ 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
119
+ }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
120
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
121
+ raise create_exception(e.status_code, e.body, error_object, context)
122
+ end
123
+
124
+ # Resource /{{merchantId}}/tokens/{{tokenId}}
125
+ #
126
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__put Update token}
127
+ # token_id:: String
128
+ # body:: {Ingenico::Connect::SDK::Domain::Token::UpdateTokenRequest}
129
+ # context:: {Ingenico::Connect::SDK::CallContext}
130
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
131
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
132
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
133
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
134
+ # or there was a conflict (HTTP status code 404, 409 or 410)
135
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
136
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
137
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
138
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
139
+ def update(token_id, body, context=nil)
140
+ path_context = {
141
+ 'tokenId' => token_id,
142
+ }
143
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/tokens/{tokenId}', path_context)
144
+ return @communicator.put(
145
+ uri,
146
+ client_headers,
147
+ nil,
148
+ body,
149
+ nil,
150
+ context)
151
+ rescue ResponseException => e
152
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
153
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
154
+ raise create_exception(e.status_code, e.body, error_object, context)
155
+ end
156
+
157
+ # Resource /{{merchantId}}/tokens/{{tokenId}}/approvesepadirectdebit
158
+ #
159
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__approvesepadirectdebit_post Approve SEPA DD mandate}
160
+ # token_id:: String
161
+ # body:: {Ingenico::Connect::SDK::Domain::Token::ApproveTokenRequest}
162
+ # context:: {Ingenico::Connect::SDK::CallContext}
163
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
164
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
165
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
166
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
167
+ # or there was a conflict (HTTP status code 404, 409 or 410)
168
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
169
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
170
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
171
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
172
+ def approvesepadirectdebit(token_id, body, context=nil)
173
+ path_context = {
174
+ 'tokenId' => token_id,
175
+ }
176
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/tokens/{tokenId}/approvesepadirectdebit', path_context)
177
+ return @communicator.post(
178
+ uri,
179
+ client_headers,
180
+ nil,
181
+ body,
182
+ nil,
183
+ context)
184
+ rescue ResponseException => e
185
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
186
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
187
+ raise create_exception(e.status_code, e.body, error_object, context)
188
+ end
189
+ end
190
+ end
191
+ end
192
+ end
@@ -0,0 +1,152 @@
1
+ require 'ingenico/connect/sdk/domain/metadata/shopping_cart_extension'
2
+ require 'base64'
3
+
4
+ module Ingenico::Connect::SDK
5
+
6
+ # Manages metadata about the server using the SDK
7
+ class MetaDataProvider
8
+ @@SDK_VERSION = '1.0.0'
9
+ @@SERVER_META_INFO_HEADER = 'X-GCS-ServerMetaInfo'
10
+ @@PROHIBITED_HEADERS = [@@SERVER_META_INFO_HEADER, 'X-GCS-Idempotence-Key',
11
+ 'Date', 'Content-Type', 'Authorization'].sort!.freeze
12
+ @@CHARSET = 'utf-8'
13
+
14
+ # Stores metadata about the server so it can be sent to the GlobalCollect platform
15
+ class ServerMetaInfo < DataObject
16
+ @platform_identifier = nil
17
+ @sdk_identifier = nil
18
+ @sdk_creator = nil
19
+ @integrator = nil
20
+ @shopping_cart_extension = nil
21
+
22
+ # String containing system information (Operating system and Ruby version).
23
+ attr_accessor :platform_identifier
24
+
25
+ # String containing this SDK version.
26
+ attr_accessor :sdk_identifier
27
+
28
+ attr_accessor :sdk_creator
29
+
30
+ attr_accessor :integrator
31
+
32
+ attr_accessor :shopping_cart_extension
33
+
34
+ # Returns the values of all attributes as a hash.
35
+ def to_h
36
+ hash = super
37
+ add_to_hash(hash, 'platformIdentifier', platform_identifier)
38
+ add_to_hash(hash, 'sdkIdentifier', sdk_identifier)
39
+ add_to_hash(hash, 'sdkCreator', sdk_creator)
40
+ add_to_hash(hash, 'integrator', integrator)
41
+ add_to_hash(hash, 'shoppingCartExtension', shopping_cart_extension)
42
+ hash
43
+ end
44
+
45
+ # Initializes the ServerMetaInfo object with properties stored in the parameter hash
46
+ def from_hash(hash)
47
+ super
48
+ @platform_identifier = hash['platformIdentifier'] if hash.has_key?('platformIdentifier')
49
+ @sdk_identifier = hash['sdkIdentifier'] if hash.has_key?('sdkIdentifier')
50
+ @sdk_creator = hash['sdkCreator'] if hash.has_key?('sdkCreator')
51
+ @integrator = hash['integrator'] if hash.has_key?('integrator')
52
+ if hash.has_key?('shoppingCartExtension')
53
+ @shopping_cart_extension = Domain::Metadata::ShoppingCartExtension.new_from_hash(hash['shoppingCartExtension'])
54
+ end
55
+ end
56
+ end
57
+
58
+ # Create a new MetaDataProvider instance that can be used to access platform-related information
59
+ #
60
+ # integrator:: String
61
+ # shopping_cart_extension:: String
62
+ # additional_request_headers:: {Ingenico::Connect::SDK::RequestHeader} list of additional headers to include in all requests made.
63
+ # The following headers are not allowed due to conflicts with already added headers:
64
+ # 'X-GCS-Idempotence-Key', 'Date', 'Content-Type', 'Authorization'
65
+ # and 'X-GCS-ServerMetaInfo'
66
+ def initialize(integrator, shopping_cart_extension: nil, additional_request_headers: [].freeze)
67
+
68
+ MetaDataProvider.validate_additional_request_headers(additional_request_headers)
69
+ server_meta_info = ServerMetaInfo.new
70
+ server_meta_info.platform_identifier = get_platform_identifier
71
+ server_meta_info.sdk_identifier = get_sdk_identifier
72
+ server_meta_info.sdk_creator = 'Ingenico'
73
+ server_meta_info.integrator = integrator
74
+ server_meta_info.shopping_cart_extension = shopping_cart_extension unless shopping_cart_extension.nil?
75
+ server_meta_info_string = DefaultImpl::DefaultMarshaller.INSTANCE.marshal(server_meta_info)
76
+ server_meta_info_header = RequestHeader.new(
77
+ @@SERVER_META_INFO_HEADER, Base64.strict_encode64(
78
+ server_meta_info_string.force_encoding('iso-8859-1').encode(@@CHARSET)))
79
+ if additional_request_headers.nil? || additional_request_headers.empty?
80
+ @meta_data_headers = [server_meta_info_header].freeze
81
+ else
82
+ request_headers = [server_meta_info_header]
83
+ request_headers += additional_request_headers
84
+ @meta_data_headers = request_headers.freeze
85
+ end
86
+ end
87
+
88
+ # Checks that none of the {Ingenico::Connect::SDK::RequestHeaders} in _additional_request_headers_ is equal to any of the forbidden headers.
89
+ # The forbidden headers are:
90
+ #'X-GCS-Idempotence-Key', 'Date', 'Content-Type', 'Authorization' and 'X-GCS-ServerMetaInfo'
91
+ # If a header is found that is equal to one of the forbidden headers an ArgumentError is raised.
92
+ def self.validate_additional_request_headers(additional_request_headers)
93
+ unless additional_request_headers.nil?
94
+ additional_request_headers.each { |additional_request_header|
95
+ validate_additional_request_header(additional_request_header)
96
+ }
97
+ end
98
+ end
99
+
100
+ # Checks that the {Ingenico::Connect::SDK::RequestHeaders} _additional_request_header_ is equal to any of the forbidden headers.
101
+ # The forbidden headers are:
102
+ #'X-GCS-Idempotence-Key', 'Date', 'Content-Type', 'Authorization' and 'X-GCS-ServerMetaInfo'
103
+ # If the header is equal to one of the forbidden headers an ArgumentError is raised.
104
+ def self.validate_additional_request_header(additional_request_header)
105
+ if MetaDataProvider.PROHIBITED_HEADERS.include? additional_request_header.name
106
+ raise ArgumentError.new('request header not allowed' + additional_request_header.name)
107
+ end
108
+ end
109
+
110
+ protected
111
+
112
+ # String containing information of the system using the SDK.
113
+ # It contains data like Operating System version and Ruby version
114
+ def get_platform_identifier
115
+ config = RbConfig::CONFIG['host_os']
116
+ if config.include? 'mingw'
117
+ s = 'Windows'
118
+ elsif config.include? 'linux'
119
+ s = 'Linux'
120
+ else
121
+ s = 'Mac OS X'
122
+ end
123
+ s += '/' + RUBY_DESCRIPTION
124
+ end
125
+
126
+ # String describing the version of the SDK being used
127
+ def get_sdk_identifier
128
+ 'RubyServerSDK/v' + @@SDK_VERSION
129
+ end
130
+
131
+ public
132
+
133
+ # Version of this SDK being used
134
+ def self.SDK_VERSION
135
+ @@SDK_VERSION
136
+ end
137
+
138
+ # A {Ingenico::Connect::SDK::RequestHeader} that contains serialized and encoded {Ingenico::Connect::SDK::MetaDataProvider::ServerMetaInfo}.
139
+ def self.SERVER_META_INFO_HEADER
140
+ @@SERVER_META_INFO_HEADER
141
+ end
142
+
143
+ # A list of header names that should not be used by any added headers.
144
+ # These headers are reserved for specific purposes.
145
+ def self.PROHIBITED_HEADERS
146
+ @@PROHIBITED_HEADERS
147
+ end
148
+
149
+ # A {Ingenico::Connect::SDK::RequestHeader} list of headers that should be used in all requests.
150
+ attr_reader :meta_data_headers
151
+ end
152
+ end