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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f9904df39ea9086dd36f1fda45a260a42546ea32
4
+ data.tar.gz: 5a9958176cceaba5701b659be2df0b9952fe5ef0
5
+ SHA512:
6
+ metadata.gz: bc6c5983080c1199c1ff60c5e6bcce7a5f381f80b73c9490121b5277f1ec31f9aa06b6ab0dd0465e369d3b8644611f69b21d531caf8beb448671de197eefb9a9
7
+ data.tar.gz: 2c4be282e92d5e19a87a14751d37382b0e3d29a215ff2008768dc2bcc90a735545ad2638dc071f3444b75113ad86e4f07db4b108ada3e6c94fe6c3e78b9221c0
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Global Collect Services B.V.
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,140 @@
1
+ # Ingenico Connect Ruby SDK
2
+
3
+ ## Introduction
4
+
5
+ The Ruby SDK helps you to communicate with the [Ingenico Connect](http://www.ingenico.com/epayments) Server API. Its primary features are:
6
+
7
+ * convenient Ruby library for the API calls and responses
8
+ * marshalls Ruby request objects to HTTP requests
9
+ * unmarshalls HTTP responses to Ruby response objects or Ruby exceptions
10
+ * handling of all the details concerning authentication
11
+ * handling of required meta data
12
+
13
+ Its use is demonstrated by an example for each possible call. The examples execute a call using the provided API keys.
14
+
15
+ See the [Ingenico Connect Developer Hub](https://developer.globalcollect.com/documentation/sdk/server/ruby/) for more information on how to use the SDK.
16
+
17
+ ## Structure of this repository
18
+
19
+ This repository consists out of four main components:
20
+
21
+ 1. The source code of the SDK itself: `/lib/ingenico/connect/sdk/`
22
+ 2. The source code of the SDK unit tests: `/spec/lib/`
23
+ 3. The source code of the SDK integration tests: `/spec/integration/`
24
+ 4. Usage examples: `/examples/`
25
+
26
+ Note that the source code of the unit tests, integration tests and the examples can only be found on GitHub.
27
+
28
+ ## Requirements
29
+
30
+ Ruby 2.2 and higher versions are required. Ruby 2.1.10 is also supported but is not suggested because official support has ended and security maintenance will end soon.
31
+ In addition, the following package is required:
32
+
33
+ * [httpclient](https://github.com/nahi/httpclient) 2.8 or higher
34
+
35
+ ## Installation
36
+
37
+ ### Using RubyGems
38
+
39
+ To install the SDK using `gem`, execute the following command:
40
+
41
+ gem install connect-sdk-ruby
42
+
43
+ ### Using a pre-built gem
44
+
45
+ 1. Download the latest version of the Ruby SDK from GitHub. Choose the `connect-sdk-ruby-x.y.z.gem` file from the [releases](https://github.com/Ingenico-ePayments/connect-sdk-ruby/releases) page, where `x.y.z` is the version number.
46
+ 2. Navigate into the folder where the gem file is downloaded to, and execute the following command:
47
+
48
+ ```
49
+ gem install connect-sdk-ruby-x.y.z.gem
50
+ ```
51
+ 3. Feel free to delete the gem file at this point, it is no longer required.
52
+
53
+ ### From source
54
+
55
+ 1. Download the latest version of the Ruby SDK from GitHub. Choose the `connect-sdk-ruby-x.y.z.zip` file from the [releases](https://github.com/Ingenico-ePayments/connect-sdk-ruby/releases) page, where `x.y.z` is the version number.
56
+ 2. Unzip the file, navigate into the folder where the file is unzipped to, and execute the following commands:
57
+
58
+ ```
59
+ gem build connect-sdk-ruby.gemspec
60
+ gem install connect-sdk-ruby-x.y.z.gem
61
+ ```
62
+ 3. Feel free to delete the unzipped archive, the zip file and the gem file at this point, they are no longer required.
63
+
64
+ ## Uninstalling
65
+
66
+ After the Ruby SDK has been installed, it can be uninstalled using the
67
+ following command:
68
+
69
+ gem uninstall connect-sdk-ruby
70
+
71
+ The required packages can be uninstalled in the same way.
72
+
73
+ ## Usage
74
+
75
+ After the Ruby SDK has been installed, it can be required in Ruby program as follows:
76
+
77
+ require 'ingenico/connect/sdk'
78
+
79
+ ## Running tests
80
+
81
+ There are two types of tests: unit tests and integration tests. The unit tests will work out-of-the-box; for the integration tests some configuration is required.
82
+ First, some environment variables need to be set:
83
+
84
+ * `connect.api.apiKeyId` for the API key id to use. This can be retrieved from the Configuration Center.
85
+ * `connect.api.secretApiKey` for the secret API key to use. This can be retrieved from the Configuration Center.
86
+ * `connect.api.merchantId` for your merchant ID.
87
+
88
+ In addition, to run the proxy integration tests, the proxy URI, username and password should be set in the `spec/fixtures/resources/properties.proxy.yml` file.
89
+
90
+ In order to run the unit and integration tests, some additional dependencies are required:
91
+
92
+ * [rake](https://ruby.github.io/rake/) 10.4 or higher
93
+ * [rspec](https://github.com/rspec/rspec) 3.5 or higher
94
+ * [webmock](https://github.com/bblimke/webmock) 2.1 or higher
95
+ * [sinatra](https://github.com/sinatra/sinatra) 1.4 or higher
96
+
97
+ They can be installed using the following command:
98
+
99
+ gem install rake rspec webmock sinatra
100
+
101
+ *Note: if rake is already installed as part of the Ruby installation, this will cause a conflict error. This can safely be ignored.*
102
+
103
+ The following commands can now be executed from the root directory of the SDK folder (/) to execute the tests:
104
+
105
+ * Unit tests:
106
+
107
+ ```
108
+ rake unit
109
+ ```
110
+
111
+ * Integration tests:
112
+
113
+ ```
114
+ rake integration
115
+ ```
116
+
117
+ * Both unit and integration tests:
118
+
119
+ ```
120
+ rake spec
121
+ ```
122
+
123
+ ## Generating documentation
124
+
125
+ Documentation can be generated with YARD. YARD can be installed as a gem. The gems required to generate documentation are:
126
+
127
+ * [rake](https://ruby.github.io/rake/) 10.4 or higher
128
+ * [yard](https://github.com/lsegal/yard) 0.9.5 or higher
129
+
130
+ They can be installed using the following command:
131
+
132
+ gem install rake yard
133
+
134
+ *Note: if rake is already installed as part of the Ruby installation, this will cause a conflict error. This can safely be ignored.*
135
+
136
+ Once YARD and rake are installed, documentation can be generated with the following command (ran from the root folder):
137
+
138
+ rake yard
139
+
140
+ Documentation will be generated in the `/doc` folder. The file `/doc/index.html` is the main documentation file.
@@ -0,0 +1,34 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |t| # supports automated testing using the command *rake* *spec*
5
+ t.rspec_opts = '--color --format documentation'
6
+ end
7
+
8
+ RSpec::Core::RakeTask.new(:unit) do |t| # supports automated testing using unit tests using the command *rake* *unit*
9
+ t.rspec_opts = '--color --format documentation'
10
+ t.exclude_pattern = 'spec/integration/**'
11
+ end
12
+
13
+ RSpec::Core::RakeTask.new(:integration) do |t| # supports automated testing of integration using the command *rake* *integration*
14
+ t.rspec_opts = '--color --format documentation'
15
+ t.pattern = 'spec/integration/**_spec.rb'
16
+ end
17
+
18
+ task :default => :spec
19
+ rescue LoadError
20
+ puts '[*] error -- development dependency is not installed'
21
+ end
22
+
23
+ begin
24
+ require 'yard'
25
+
26
+ YARD::Rake::YardocTask.new(:yard) do |t| # supports generating documentation using the command *rake* *yard*
27
+ # t.files = ['lib/**/*.rb', OTHER_PATHS] # optional
28
+ t.options = ['--no-private']
29
+ end
30
+
31
+ task :doc => :yard # alternative alias to generate documentation
32
+ rescue LoadError
33
+ puts '[*] error -- development dependency is not installed'
34
+ end
@@ -0,0 +1,28 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'connect-sdk-ruby'
3
+ spec.version = '1.0.0'
4
+ spec.authors = ['Ingenico ePayments']
5
+ spec.email = ['github@epay.ingenico.com']
6
+ spec.summary = %q{SDK to communicate with the GlobalCollect platform using the Ingenico Connect Server API}
7
+ spec.description = %q{SDK to communicate with the GlobalCollect platform using the Ingenico Connect Server API}
8
+ spec.homepage = %q{https://github.com/Ingenico-ePayments/connect-sdk-ruby}
9
+ spec.license = 'MIT'
10
+
11
+ # exclude hidden files like .gitignore
12
+ spec.files = Dir['lib/**/*'] + Dir['examples/**/*'] + Dir['spec/**/*'] +
13
+ ['connect-sdk-ruby.gemspec', 'Gemfile', 'LICENSE.txt', 'Rakefile', 'README.md']
14
+ spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.required_ruby_version = '~> 2.0'
19
+
20
+ spec.add_dependency 'httpclient', '~> 2.8'
21
+
22
+ spec.add_development_dependency 'yard', '~> 0.9'
23
+ spec.add_development_dependency 'rspec', '~> 3.5'
24
+ spec.add_development_dependency 'webmock', '~> 2.1'
25
+ spec.add_development_dependency 'sinatra', '~> 1.4'
26
+ spec.add_development_dependency 'rake', '~> 10.4'
27
+ # spec.metadata['yard.run'] = 'yri' # compiles yard doc on install
28
+ end
@@ -0,0 +1,6 @@
1
+ --- # YAML settings used in testing the SDK
2
+ connect.api.endpoint.host: api-sandbox.globalcollect.com
3
+ connect.api.authorizationType: v1HMAC
4
+ connect.api.connectTimeout: -1
5
+ connect.api.socketTimeout: -1
6
+ connect.api.maxConnections: 100
@@ -0,0 +1,53 @@
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/factory'
6
+ require 'ingenico/connect/sdk/domain/definitions/address'
7
+ require 'ingenico/connect/sdk/domain/definitions/amount_of_money'
8
+ require 'ingenico/connect/sdk/domain/hostedcheckout/create_hosted_checkout_request'
9
+ require 'ingenico/connect/sdk/domain/hostedcheckout/hosted_checkout_specific_input'
10
+ require 'ingenico/connect/sdk/domain/payment/customer'
11
+ require 'ingenico/connect/sdk/domain/payment/order'
12
+
13
+ Definitions = Ingenico::Connect::SDK::Domain::Definitions
14
+ Hostedcheckout = Ingenico::Connect::SDK::Domain::Hostedcheckout
15
+ Payment = Ingenico::Connect::SDK::Domain::Payment
16
+
17
+ def example
18
+ get_client do |client|
19
+ hosted_checkout_specific_input = Hostedcheckout::HostedCheckoutSpecificInput.new
20
+ hosted_checkout_specific_input.locale = 'en_GB'
21
+ hosted_checkout_specific_input.variant = 'testVariant'
22
+
23
+ amount_of_money = Definitions::AmountOfMoney.new
24
+ amount_of_money.amount = 2345
25
+ amount_of_money.currency_code = 'USD'
26
+
27
+ billing_address = Definitions::Address.new
28
+ billing_address.country_code = 'US'
29
+
30
+ customer = Payment::Customer.new
31
+ customer.billing_address = billing_address
32
+
33
+ order = Payment::Order.new
34
+ order.amount_of_money = amount_of_money
35
+ order.customer = customer
36
+
37
+ body = Hostedcheckout::CreateHostedCheckoutRequest.new
38
+ body.hosted_checkout_specific_input = hosted_checkout_specific_input
39
+ body.order = order
40
+
41
+ response = client.merchant('merchantId').hostedcheckouts().create(body)
42
+ end
43
+ end
44
+
45
+ def get_client
46
+ api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
47
+ secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
48
+ configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
49
+ yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
50
+ ensure
51
+ # Free networking resources when done
52
+ client.close unless client.nil?
53
+ end
@@ -0,0 +1,22 @@
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/factory'
6
+
7
+
8
+ def example
9
+ get_client do |client|
10
+ response = client.merchant('merchantId').hostedcheckouts().get('hostedCheckoutId')
11
+ end
12
+ end
13
+
14
+ def get_client
15
+ api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
16
+ secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
17
+ configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
18
+ yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
19
+ ensure
20
+ # Free networking resources when done
21
+ client.close unless client.nil?
22
+ end
@@ -0,0 +1,42 @@
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/factory'
6
+ require 'ingenico/connect/sdk/domain/payment/approve_payment_request'
7
+ require 'ingenico/connect/sdk/domain/payment/approve_payment_non_sepa_direct_debit_payment_method_specific_input'
8
+ require 'ingenico/connect/sdk/domain/payment/order_approve_payment'
9
+ require 'ingenico/connect/sdk/domain/payment/order_references_approve_payment'
10
+
11
+ Payment = Ingenico::Connect::SDK::Domain::Payment
12
+
13
+ def example
14
+ get_client do |client|
15
+ direct_debit_payment_method_specific_input = Payment::ApprovePaymentNonSepaDirectDebitPaymentMethodSpecificInput.new
16
+ direct_debit_payment_method_specific_input.date_collect = '20150201'
17
+ direct_debit_payment_method_specific_input.token = 'bfa8a7e4-4530-455a-858d-204ba2afb77e'
18
+
19
+ references = Payment::OrderReferencesApprovePayment.new
20
+ references.merchant_reference = 'AcmeOrder0001'
21
+
22
+ order = Payment::OrderApprovePayment.new
23
+ order.references = references
24
+
25
+ body = Payment::ApprovePaymentRequest.new
26
+ body.amount = 2980
27
+ body.direct_debit_payment_method_specific_input = direct_debit_payment_method_specific_input
28
+ body.order = order
29
+
30
+ response = client.merchant('merchantId').payments().approve('paymentId', body)
31
+ end
32
+ end
33
+
34
+ def get_client
35
+ api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
36
+ secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
37
+ configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
38
+ yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
39
+ ensure
40
+ # Free networking resources when done
41
+ client.close unless client.nil?
42
+ end
@@ -0,0 +1,22 @@
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/factory'
6
+
7
+
8
+ def example
9
+ get_client do |client|
10
+ response = client.merchant('merchantId').payments().cancelapproval('paymentId')
11
+ end
12
+ end
13
+
14
+ def get_client
15
+ api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
16
+ secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
17
+ configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
18
+ yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
19
+ ensure
20
+ # Free networking resources when done
21
+ client.close unless client.nil?
22
+ end
@@ -0,0 +1,22 @@
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/factory'
6
+
7
+
8
+ def example
9
+ get_client do |client|
10
+ response = client.merchant('merchantId').payments().cancel('paymentId')
11
+ end
12
+ end
13
+
14
+ def get_client
15
+ api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
16
+ secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
17
+ configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
18
+ yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
19
+ ensure
20
+ # Free networking resources when done
21
+ client.close unless client.nil?
22
+ end
@@ -0,0 +1,177 @@
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_exception'
6
+ require 'ingenico/connect/sdk/declined_payment_exception'
7
+ require 'ingenico/connect/sdk/factory'
8
+ require 'ingenico/connect/sdk/domain/definitions/address'
9
+ require 'ingenico/connect/sdk/domain/definitions/amount_of_money'
10
+ require 'ingenico/connect/sdk/domain/definitions/card'
11
+ require 'ingenico/connect/sdk/domain/definitions/company_information'
12
+ require 'ingenico/connect/sdk/domain/payment/create_payment_request'
13
+ require 'ingenico/connect/sdk/domain/payment/address_personal'
14
+ require 'ingenico/connect/sdk/domain/payment/card_payment_method_specific_input'
15
+ require 'ingenico/connect/sdk/domain/payment/contact_details'
16
+ require 'ingenico/connect/sdk/domain/payment/customer'
17
+ require 'ingenico/connect/sdk/domain/payment/line_item'
18
+ require 'ingenico/connect/sdk/domain/payment/line_item_invoice_data'
19
+ require 'ingenico/connect/sdk/domain/payment/order'
20
+ require 'ingenico/connect/sdk/domain/payment/order_invoice_data'
21
+ require 'ingenico/connect/sdk/domain/payment/order_references'
22
+ require 'ingenico/connect/sdk/domain/payment/personal_information'
23
+ require 'ingenico/connect/sdk/domain/payment/personal_name'
24
+
25
+ Definitions = Ingenico::Connect::SDK::Domain::Definitions
26
+ Payment = Ingenico::Connect::SDK::Domain::Payment
27
+
28
+ def example
29
+ get_client do |client|
30
+ card = Definitions::Card.new
31
+ card.card_number = '4567350000427977'
32
+ card.cardholder_name = 'Wile E. Coyote'
33
+ card.cvv = '123'
34
+ card.expiry_date = '1220'
35
+
36
+ card_payment_method_specific_input = Payment::CardPaymentMethodSpecificInput.new
37
+ card_payment_method_specific_input.card = card
38
+ card_payment_method_specific_input.payment_product_id = 1
39
+ card_payment_method_specific_input.skip_authentication = false
40
+
41
+ amount_of_money = Definitions::AmountOfMoney.new
42
+ amount_of_money.amount = 2980
43
+ amount_of_money.currency_code = 'EUR'
44
+
45
+ billing_address = Definitions::Address.new
46
+ billing_address.additional_info = 'b'
47
+ billing_address.city = 'Monument Valley'
48
+ billing_address.country_code = 'US'
49
+ billing_address.house_number = '13'
50
+ billing_address.state = 'Utah'
51
+ billing_address.street = 'Desertroad'
52
+ billing_address.zip = '84536'
53
+
54
+ company_information = Definitions::CompanyInformation.new
55
+ company_information.name = 'Acme Labs'
56
+
57
+ contact_details = Payment::ContactDetails.new
58
+ contact_details.email_address = 'wile.e.coyote@acmelabs.com'
59
+ contact_details.email_message_type = 'html'
60
+ contact_details.fax_number = '+1234567891'
61
+ contact_details.phone_number = '+1234567890'
62
+
63
+ name = Payment::PersonalName.new
64
+ name.first_name = 'Wile'
65
+ name.surname = 'Coyote'
66
+ name.surname_prefix = 'E.'
67
+ name.title = 'Mr.'
68
+
69
+ personal_information = Payment::PersonalInformation.new
70
+ personal_information.date_of_birth = '19490917'
71
+ personal_information.gender = 'M'
72
+ personal_information.name = name
73
+
74
+ shipping_name = Payment::PersonalName.new
75
+ shipping_name.first_name = 'Road'
76
+ shipping_name.surname = 'Runner'
77
+ shipping_name.title = 'Miss'
78
+
79
+ shipping_address = Payment::AddressPersonal.new
80
+ shipping_address.additional_info = 'Suite II'
81
+ shipping_address.city = 'Monument Valley'
82
+ shipping_address.country_code = 'US'
83
+ shipping_address.house_number = '1'
84
+ shipping_address.name = shipping_name
85
+ shipping_address.state = 'Utah'
86
+ shipping_address.street = 'Desertroad'
87
+ shipping_address.zip = '84536'
88
+
89
+ customer = Payment::Customer.new
90
+ customer.billing_address = billing_address
91
+ customer.company_information = company_information
92
+ customer.contact_details = contact_details
93
+ customer.locale = 'en_US'
94
+ customer.merchant_customer_id = '1234'
95
+ customer.personal_information = personal_information
96
+ customer.shipping_address = shipping_address
97
+ customer.vat_number = '1234AB5678CD'
98
+
99
+ items = []
100
+
101
+ item1_amount_of_money = Definitions::AmountOfMoney.new
102
+ item1_amount_of_money.amount = 2500
103
+ item1_amount_of_money.currency_code = 'EUR'
104
+
105
+ item1_invoice_data = Payment::LineItemInvoiceData.new
106
+ item1_invoice_data.description = 'ACME Super Outfit'
107
+ item1_invoice_data.nr_of_items = '1'
108
+ item1_invoice_data.price_per_item = 2500
109
+
110
+ item1 = Payment::LineItem.new
111
+ item1.amount_of_money = item1_amount_of_money
112
+ item1.invoice_data = item1_invoice_data
113
+
114
+ items << item1
115
+
116
+ item2_amount_of_money = Definitions::AmountOfMoney.new
117
+ item2_amount_of_money.amount = 480
118
+ item2_amount_of_money.currency_code = 'EUR'
119
+
120
+ item2_invoice_data = Payment::LineItemInvoiceData.new
121
+ item2_invoice_data.description = 'Asperin'
122
+ item2_invoice_data.nr_of_items = '12'
123
+ item2_invoice_data.price_per_item = 40
124
+
125
+ item2 = Payment::LineItem.new
126
+ item2.amount_of_money = item2_amount_of_money
127
+ item2.invoice_data = item2_invoice_data
128
+
129
+ items << item2
130
+
131
+ invoice_data = Payment::OrderInvoiceData.new
132
+ invoice_data.invoice_date = '20140306191500'
133
+ invoice_data.invoice_number = '000000123'
134
+
135
+ references = Payment::OrderReferences.new
136
+ references.descriptor = 'Fast and Furry-ous'
137
+ references.invoice_data = invoice_data
138
+ references.merchant_order_id = 123456
139
+ references.merchant_reference = 'AcmeOrder0001'
140
+
141
+ order = Payment::Order.new
142
+ order.amount_of_money = amount_of_money
143
+ order.customer = customer
144
+ order.items = items
145
+ order.references = references
146
+
147
+ body = Payment::CreatePaymentRequest.new
148
+ body.card_payment_method_specific_input = card_payment_method_specific_input
149
+ body.order = order
150
+
151
+ begin
152
+ response = client.merchant('merchantId').payments().create(body)
153
+ rescue Ingenico::Connect::SDK::DeclinedPaymentException => e
154
+ handle_declined_payment(e.create_payment_result)
155
+ rescue Ingenico::Connect::SDK::ApiException => e
156
+ handle_api_errors(e.errors)
157
+ end
158
+ end
159
+ end
160
+
161
+ def get_client
162
+ api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
163
+ secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
164
+ configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
165
+ yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
166
+ ensure
167
+ # Free networking resources when done
168
+ client.close unless client.nil?
169
+ end
170
+
171
+ def handle_declined_payment(create_payment_result)
172
+ # handle the result here
173
+ end
174
+
175
+ def handle_api_errors(errors)
176
+ # handle the errors here
177
+ end