connect-sdk-ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +140 -0
- data/Rakefile +34 -0
- data/connect-sdk-ruby.gemspec +28 -0
- data/examples/merchant/example_configuration.yml +6 -0
- data/examples/merchant/hostedcheckouts/create_hosted_checkout_example.rb +53 -0
- data/examples/merchant/hostedcheckouts/get_hosted_checkout_example.rb +22 -0
- data/examples/merchant/payments/approve_payment_example.rb +42 -0
- data/examples/merchant/payments/cancel_approval_payment_example.rb +22 -0
- data/examples/merchant/payments/cancel_payment_example.rb +22 -0
- data/examples/merchant/payments/create_payment_example.rb +177 -0
- data/examples/merchant/payments/get_payment_example.rb +22 -0
- data/examples/merchant/payments/process_challenged_payment_example.rb +22 -0
- data/examples/merchant/payments/refund_payment_example.rb +85 -0
- data/examples/merchant/payments/tokenize_payment_example.rb +27 -0
- data/examples/merchant/payouts/approve_payout_example.rb +27 -0
- data/examples/merchant/payouts/cancel_approval_payout_example.rb +22 -0
- data/examples/merchant/payouts/cancel_payout_example.rb +22 -0
- data/examples/merchant/payouts/create_payout_example.rb +96 -0
- data/examples/merchant/payouts/get_payout_example.rb +22 -0
- data/examples/merchant/productgroups/get_payment_product_group_example.rb +32 -0
- data/examples/merchant/productgroups/get_payment_product_groups_example.rb +32 -0
- data/examples/merchant/products/get_directory_example.rb +28 -0
- data/examples/merchant/products/get_payment_product_example.rb +32 -0
- data/examples/merchant/products/get_payment_products_example.rb +32 -0
- data/examples/merchant/refunds/approve_refund_example.rb +27 -0
- data/examples/merchant/refunds/cancel_approval_refund_example.rb +22 -0
- data/examples/merchant/refunds/cancel_refund_example.rb +22 -0
- data/examples/merchant/refunds/get_refund_example.rb +22 -0
- data/examples/merchant/riskassessments/risk_assessment_bank_account_example.rb +54 -0
- data/examples/merchant/riskassessments/risk_assessment_cards_example.rb +114 -0
- data/examples/merchant/services/convert_amount_example.rb +29 -0
- data/examples/merchant/services/convert_bank_account_example.rb +34 -0
- data/examples/merchant/services/iin_details_example.rb +27 -0
- data/examples/merchant/services/test_connection_example.rb +22 -0
- data/examples/merchant/sessions/create_session_example.rb +34 -0
- data/examples/merchant/tokens/approve_sepa_direct_debit_token_example.rb +29 -0
- data/examples/merchant/tokens/create_token_example.rb +82 -0
- data/examples/merchant/tokens/delete_token_example.rb +27 -0
- data/examples/merchant/tokens/get_token_example.rb +22 -0
- data/examples/merchant/tokens/update_token_example.rb +76 -0
- data/lib/ingenico/connect/sdk.rb +27 -0
- data/lib/ingenico/connect/sdk/api_exception.rb +52 -0
- data/lib/ingenico/connect/sdk/api_resource.rb +126 -0
- data/lib/ingenico/connect/sdk/authenticator.rb +15 -0
- data/lib/ingenico/connect/sdk/authorization_exception.rb +13 -0
- data/lib/ingenico/connect/sdk/call_context.rb +26 -0
- data/lib/ingenico/connect/sdk/client.rb +92 -0
- data/lib/ingenico/connect/sdk/communication_exception.rb +15 -0
- data/lib/ingenico/connect/sdk/communicator.rb +277 -0
- data/lib/ingenico/connect/sdk/communicator_configuration.rb +98 -0
- data/lib/ingenico/connect/sdk/connection.rb +31 -0
- data/lib/ingenico/connect/sdk/data_object.rb +43 -0
- data/lib/ingenico/connect/sdk/declined_payment_exception.rb +44 -0
- data/lib/ingenico/connect/sdk/declined_payout_exception.rb +44 -0
- data/lib/ingenico/connect/sdk/declined_refund_exception.rb +46 -0
- data/lib/ingenico/connect/sdk/declined_transaction_exception.rb +16 -0
- data/lib/ingenico/connect/sdk/defaultimpl.rb +6 -0
- data/lib/ingenico/connect/sdk/defaultimpl/authorization_type.rb +18 -0
- data/lib/ingenico/connect/sdk/defaultimpl/default_authenticator.rb +106 -0
- data/lib/ingenico/connect/sdk/defaultimpl/default_connection.rb +242 -0
- data/lib/ingenico/connect/sdk/defaultimpl/default_marshaller.rb +35 -0
- data/lib/ingenico/connect/sdk/domain/definitions/abstract_order_status.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/definitions/abstract_payment_method_specific_input.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/definitions/additional_order_input_airline_data.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/definitions/address.rb +81 -0
- data/lib/ingenico/connect/sdk/domain/definitions/airline_data.rb +165 -0
- data/lib/ingenico/connect/sdk/domain/definitions/airline_flight_leg.rb +102 -0
- data/lib/ingenico/connect/sdk/domain/definitions/amount_of_money.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/definitions/bank_account.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/definitions/bank_account_bban.rb +67 -0
- data/lib/ingenico/connect/sdk/domain/definitions/bank_account_iban.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/definitions/card.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/definitions/card_essentials.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/definitions/card_fraud_results.rb +50 -0
- data/lib/ingenico/connect/sdk/domain/definitions/card_without_cvv.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/definitions/company_information.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/definitions/contact_details_base.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/definitions/customer_base.rb +50 -0
- data/lib/ingenico/connect/sdk/domain/definitions/fraud_fields.rb +115 -0
- data/lib/ingenico/connect/sdk/domain/definitions/fraud_results.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/definitions/fraud_results_retail_decisions.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/definitions/key_value_pair.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/definitions/order_status_output.rb +67 -0
- data/lib/ingenico/connect/sdk/domain/definitions/payment_product_filter.rb +51 -0
- data/lib/ingenico/connect/sdk/domain/definitions/personal_name_base.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/definitions/result_do_risk_assessment.rb +61 -0
- data/lib/ingenico/connect/sdk/domain/definitions/retail_decisions_cc_fraud_check_output.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/definitions/validation_bank_account_check.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/definitions/validation_bank_account_output.rb +67 -0
- data/lib/ingenico/connect/sdk/domain/errors/api_error.rb +60 -0
- data/lib/ingenico/connect/sdk/domain/errors/error_response.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/create_hosted_checkout_request.rb +102 -0
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/create_hosted_checkout_response.rb +59 -0
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/created_payment_output.rb +72 -0
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/displayed_data.rb +53 -0
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/get_hosted_checkout_response.rb +43 -0
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/hosted_checkout_specific_input.rb +78 -0
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/payment_product_filters_hosted_checkout.rb +53 -0
- data/lib/ingenico/connect/sdk/domain/metadata/shopping_cart_extension.rb +48 -0
- data/lib/ingenico/connect/sdk/domain/payment/abstract_payment_method_specific_output.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/additional_order_input.rb +72 -0
- data/lib/ingenico/connect/sdk/domain/payment/address_personal.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/payment/approve_payment_card_payment_method_specific_output.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/approve_payment_non_sepa_direct_debit_payment_method_specific_input.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/approve_payment_payment_method_specific_input.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/approve_payment_request.rb +65 -0
- data/lib/ingenico/connect/sdk/domain/payment/approve_payment_sepa_direct_debit_payment_method_specific_input.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/bank_transfer_payment_method_specific_input.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/bank_transfer_payment_method_specific_input_base.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/bank_transfer_payment_method_specific_output.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/cancel_approval_payment_response.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/payment/cancel_payment_card_payment_method_specific_output.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/cancel_payment_response.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/payment/card_payment_method_specific_input.rb +61 -0
- data/lib/ingenico/connect/sdk/domain/payment/card_payment_method_specific_input_base.rb +60 -0
- data/lib/ingenico/connect/sdk/domain/payment/card_payment_method_specific_output.rb +65 -0
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_input.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_input_base.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_output.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1503_specific_input.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1504_specific_input.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/contact_details.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/create_payment_request.rb +131 -0
- data/lib/ingenico/connect/sdk/domain/payment/create_payment_response.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/create_payment_result.rb +58 -0
- data/lib/ingenico/connect/sdk/domain/payment/customer.rb +83 -0
- data/lib/ingenico/connect/sdk/domain/payment/external_cardholder_authentication_data.rb +60 -0
- data/lib/ingenico/connect/sdk/domain/payment/invoice_payment_method_specific_input.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/invoice_payment_method_specific_output.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/level3_summary_data.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/payment/line_item.rb +58 -0
- data/lib/ingenico/connect/sdk/domain/payment/line_item_invoice_data.rb +60 -0
- data/lib/ingenico/connect/sdk/domain/payment/line_item_level3_interchange_information.rb +81 -0
- data/lib/ingenico/connect/sdk/domain/payment/merchant_action.rb +64 -0
- data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_method_specific_input.rb +71 -0
- data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_method_specific_output.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_product705_specific_input.rb +50 -0
- data/lib/ingenico/connect/sdk/domain/payment/order.rb +83 -0
- data/lib/ingenico/connect/sdk/domain/payment/order_approve_payment.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/payment/order_invoice_data.rb +59 -0
- data/lib/ingenico/connect/sdk/domain/payment/order_output.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/payment/order_references.rb +57 -0
- data/lib/ingenico/connect/sdk/domain/payment/order_references_approve_payment.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/order_type_information.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment.rb +54 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_approval_response.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_creation_output.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_creation_references.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_error_response.rb +57 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_output.rb +116 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_product836_specific_output.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_product840_customer_account.rb +88 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_product840_specific_output.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_references.rb +67 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_response.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/payment_status_output.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/personal_information.rb +50 -0
- data/lib/ingenico/connect/sdk/domain/payment/personal_name.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_data.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input.rb +72 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input_base.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_output.rb +58 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product809_specific_input.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product816_specific_input.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product882_specific_input.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/refund_bank_method_specific_output.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/refund_card_method_specific_output.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payment/refund_e_wallet_method_specific_output.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/payment/refund_method_specific_output.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/refund_output.rb +72 -0
- data/lib/ingenico/connect/sdk/domain/payment/refund_payment_product840_customer_account.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/payment/refund_payment_product840_specific_output.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_method_specific_input.rb +60 -0
- data/lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_method_specific_output.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/payment/three_d_secure_results.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/payment/tokenize_payment_request.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payout/approve_payout_request.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payout/create_payout_request.rb +101 -0
- data/lib/ingenico/connect/sdk/domain/payout/payout_customer.rb +76 -0
- data/lib/ingenico/connect/sdk/domain/payout/payout_error_response.rb +57 -0
- data/lib/ingenico/connect/sdk/domain/payout/payout_references.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/payout/payout_response.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/payout/payout_result.rb +54 -0
- data/lib/ingenico/connect/sdk/domain/product/account_on_file.rb +64 -0
- data/lib/ingenico/connect/sdk/domain/product/account_on_file_attribute.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/product/account_on_file_display_hints.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/product/directory.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/product/directory_entry.rb +59 -0
- data/lib/ingenico/connect/sdk/domain/product/empty_validator.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/product/fixed_list_validator.rb +38 -0
- data/lib/ingenico/connect/sdk/domain/product/label_template_element.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/product/length_validator.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product.rb +134 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_display_hints.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field.rb +61 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_data_restrictions.rb +43 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_display_hints.rb +96 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_form_element.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_tooltip.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb +100 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_group.rb +71 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_group_response.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_groups.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_product_response.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/product/payment_products.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/product/range_validator.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/product/regular_expression_validator.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/product/value_mapping_element.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/refund/approve_refund_request.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/refund/bank_account_bban_refund.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/refund/bank_refund_method_specific_input.rb +54 -0
- data/lib/ingenico/connect/sdk/domain/refund/refund_customer.rb +58 -0
- data/lib/ingenico/connect/sdk/domain/refund/refund_error_response.rb +57 -0
- data/lib/ingenico/connect/sdk/domain/refund/refund_references.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/refund/refund_request.rb +76 -0
- data/lib/ingenico/connect/sdk/domain/refund/refund_response.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/refund/refund_result.rb +54 -0
- data/lib/ingenico/connect/sdk/domain/riskassessments/customer_risk_assessment.rb +65 -0
- data/lib/ingenico/connect/sdk/domain/riskassessments/order_risk_assessment.rb +58 -0
- data/lib/ingenico/connect/sdk/domain/riskassessments/personal_information_risk_assessment.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/riskassessments/personal_name_risk_assessment.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment.rb +54 -0
- data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment_bank_account.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment_card.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment_response.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/services/bank_data.rb +53 -0
- data/lib/ingenico/connect/sdk/domain/services/bank_details.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/services/bank_details_request.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/services/bank_details_response.rb +69 -0
- data/lib/ingenico/connect/sdk/domain/services/convert_amount.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/services/get_iin_details_request.rb +43 -0
- data/lib/ingenico/connect/sdk/domain/services/get_iin_details_response.rb +60 -0
- data/lib/ingenico/connect/sdk/domain/services/iin_detail.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/services/payment_context.rb +50 -0
- data/lib/ingenico/connect/sdk/domain/services/swift.rb +95 -0
- data/lib/ingenico/connect/sdk/domain/services/test_connection.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/sessions/payment_product_filters_client_session.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/sessions/session_request.rb +49 -0
- data/lib/ingenico/connect/sdk/domain/sessions/session_response.rb +59 -0
- data/lib/ingenico/connect/sdk/domain/token/abstract_token.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/token/approve_token_request.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/token/contact_details_token.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/token/create_token_request.rb +76 -0
- data/lib/ingenico/connect/sdk/domain/token/create_token_response.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/token/creditor.rb +102 -0
- data/lib/ingenico/connect/sdk/domain/token/customer_token.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/token/customer_token_with_contact_details.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/token/debtor.rb +102 -0
- data/lib/ingenico/connect/sdk/domain/token/mandate_approval.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/token/mandate_non_sepa_direct_debit.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/token/mandate_sepa_direct_debit.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/token/mandate_sepa_direct_debit_with_mandate_id.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/token/mandate_sepa_direct_debit_without_creditor.rb +79 -0
- data/lib/ingenico/connect/sdk/domain/token/personal_information_token.rb +36 -0
- data/lib/ingenico/connect/sdk/domain/token/personal_name_token.rb +16 -0
- data/lib/ingenico/connect/sdk/domain/token/token_card.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/token/token_card_data.rb +50 -0
- data/lib/ingenico/connect/sdk/domain/token/token_e_wallet.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/token/token_e_wallet_data.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/token/token_non_sepa_direct_debit.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/token/token_non_sepa_direct_debit_payment_product705_specific_data.rb +43 -0
- data/lib/ingenico/connect/sdk/domain/token/token_response.rb +83 -0
- data/lib/ingenico/connect/sdk/domain/token/token_sepa_direct_debit.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/token/token_sepa_direct_debit_without_creditor.rb +47 -0
- data/lib/ingenico/connect/sdk/domain/token/update_token_request.rb +76 -0
- data/lib/ingenico/connect/sdk/endpoint_configuration.rb +139 -0
- data/lib/ingenico/connect/sdk/exceptions.rb +8 -0
- data/lib/ingenico/connect/sdk/factory.rb +200 -0
- data/lib/ingenico/connect/sdk/global_collect_exception.rb +15 -0
- data/lib/ingenico/connect/sdk/idempotence_exception.rb +24 -0
- data/lib/ingenico/connect/sdk/logging.rb +10 -0
- data/lib/ingenico/connect/sdk/logging/communicator_logger.rb +19 -0
- data/lib/ingenico/connect/sdk/logging/log_message_builder.rb +61 -0
- data/lib/ingenico/connect/sdk/logging/logging_capable.rb +19 -0
- data/lib/ingenico/connect/sdk/logging/logging_util.rb +298 -0
- data/lib/ingenico/connect/sdk/logging/request_log_message_builder.rb +42 -0
- data/lib/ingenico/connect/sdk/logging/response_log_message_builder.rb +34 -0
- data/lib/ingenico/connect/sdk/logging/ruby_communicator_logger.rb +58 -0
- data/lib/ingenico/connect/sdk/logging/stdout_communicator_logger.rb +36 -0
- data/lib/ingenico/connect/sdk/marshaller.rb +19 -0
- data/lib/ingenico/connect/sdk/marshaller_syntax_exception.rb +6 -0
- data/lib/ingenico/connect/sdk/merchant/hostedcheckouts/hostedcheckouts_client.rb +88 -0
- data/lib/ingenico/connect/sdk/merchant/merchant_client.rb +110 -0
- data/lib/ingenico/connect/sdk/merchant/payments/payments_client.rb +319 -0
- data/lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb +197 -0
- data/lib/ingenico/connect/sdk/merchant/productgroups/find_productgroups_params.rb +55 -0
- data/lib/ingenico/connect/sdk/merchant/productgroups/get_productgroup_params.rb +55 -0
- data/lib/ingenico/connect/sdk/merchant/productgroups/productgroups_client.rb +90 -0
- data/lib/ingenico/connect/sdk/merchant/products/directory_params.rb +31 -0
- data/lib/ingenico/connect/sdk/merchant/products/find_products_params.rb +55 -0
- data/lib/ingenico/connect/sdk/merchant/products/get_product_params.rb +55 -0
- data/lib/ingenico/connect/sdk/merchant/products/products_client.rb +124 -0
- data/lib/ingenico/connect/sdk/merchant/refunds/refunds_client.rb +154 -0
- data/lib/ingenico/connect/sdk/merchant/riskassessments/riskassessments_client.rb +85 -0
- data/lib/ingenico/connect/sdk/merchant/services/convert_amount_params.rb +35 -0
- data/lib/ingenico/connect/sdk/merchant/services/services_client.rb +149 -0
- data/lib/ingenico/connect/sdk/merchant/sessions/sessions_client.rb +55 -0
- data/lib/ingenico/connect/sdk/merchant/tokens/delete_token_params.rb +27 -0
- data/lib/ingenico/connect/sdk/merchant/tokens/tokens_client.rb +192 -0
- data/lib/ingenico/connect/sdk/meta_data_provider.rb +152 -0
- data/lib/ingenico/connect/sdk/modules.rb +130 -0
- data/lib/ingenico/connect/sdk/not_found_exception.rb +19 -0
- data/lib/ingenico/connect/sdk/param_request.rb +33 -0
- data/lib/ingenico/connect/sdk/pooled_connection.rb +21 -0
- data/lib/ingenico/connect/sdk/proxy_configuration.rb +75 -0
- data/lib/ingenico/connect/sdk/reference_exception.rb +14 -0
- data/lib/ingenico/connect/sdk/request_header.rb +25 -0
- data/lib/ingenico/connect/sdk/request_param.rb +24 -0
- data/lib/ingenico/connect/sdk/response.rb +62 -0
- data/lib/ingenico/connect/sdk/response_exception.rb +54 -0
- data/lib/ingenico/connect/sdk/response_header.rb +25 -0
- data/lib/ingenico/connect/sdk/session.rb +39 -0
- data/lib/ingenico/connect/sdk/validation_exception.rb +14 -0
- data/spec/comparable_extension.rb +29 -0
- data/spec/fixtures/resources/defaultimpl/convertAmount.json +3 -0
- data/spec/fixtures/resources/defaultimpl/createPayment.failure.invalidCardNumber.json +11 -0
- data/spec/fixtures/resources/defaultimpl/createPayment.failure.rejected.json +48 -0
- data/spec/fixtures/resources/defaultimpl/createPayment.json +40 -0
- data/spec/fixtures/resources/defaultimpl/idempotence_duplicate_failure.json +8 -0
- data/spec/fixtures/resources/defaultimpl/idempotence_rejected.json +46 -0
- data/spec/fixtures/resources/defaultimpl/idempotence_success.json +39 -0
- data/spec/fixtures/resources/defaultimpl/notFound.html +1 -0
- data/spec/fixtures/resources/defaultimpl/testConnection.json +3 -0
- data/spec/fixtures/resources/defaultimpl/unknownServerError.json +10 -0
- data/spec/fixtures/resources/logging/bodyNoObfuscation.json +17 -0
- data/spec/fixtures/resources/logging/bodyWithBinObfuscated.json +3 -0
- data/spec/fixtures/resources/logging/bodyWithBinOriginal.json +3 -0
- data/spec/fixtures/resources/logging/bodyWithCardObfuscated.json +21 -0
- data/spec/fixtures/resources/logging/bodyWithCardOriginal.json +21 -0
- data/spec/fixtures/resources/logging/bodyWithIbanObfuscated.json +19 -0
- data/spec/fixtures/resources/logging/bodyWithIbanOriginal.json +19 -0
- data/spec/fixtures/resources/payment/duplicate_request.json +8 -0
- data/spec/fixtures/resources/payment/invalid_authorization.json +9 -0
- data/spec/fixtures/resources/payment/invalid_request.json +11 -0
- data/spec/fixtures/resources/payment/method_not_allowed.html +1 -0
- data/spec/fixtures/resources/payment/not_found.html +1 -0
- data/spec/fixtures/resources/payment/pending_approval.json +39 -0
- data/spec/fixtures/resources/payment/rejected.json +46 -0
- data/spec/fixtures/resources/properties.proxy.yml +13 -0
- data/spec/fixtures/resources/properties.yml +7 -0
- data/spec/integration/connection_pooling_spec.rb +78 -0
- data/spec/integration/convert_amount_spec.rb +25 -0
- data/spec/integration/idempotence_spec.rb +59 -0
- data/spec/integration/multiline_header_spec.rb +30 -0
- data/spec/integration/payment_product_groups_spec.rb +23 -0
- data/spec/integration/payment_products_spec.rb +22 -0
- data/spec/integration/risk_assessments_spec.rb +37 -0
- data/spec/integration/sdk_proxy_spec.rb +89 -0
- data/spec/integration/token_spec.rb +42 -0
- data/spec/integration_setup.rb +50 -0
- data/spec/lib/client_spec.rb +69 -0
- data/spec/lib/communicator_configuration_spec.rb +179 -0
- data/spec/lib/communicator_spec.rb +31 -0
- data/spec/lib/defaultimpl/default_authenticator_spec.rb +74 -0
- data/spec/lib/defaultimpl/default_connection_idempotence_spec.rb +142 -0
- data/spec/lib/defaultimpl/default_connection_logger_spec.rb +526 -0
- data/spec/lib/defaultimpl/default_connection_spec.rb +334 -0
- data/spec/lib/defaultimpl/default_marshaller_spec.rb +36 -0
- data/spec/lib/factory_spec.rb +41 -0
- data/spec/lib/logging/header_obfuscator_spec.rb +51 -0
- data/spec/lib/logging/logging_util_spec.rb +143 -0
- data/spec/lib/logging/obfuscator_spec.rb +52 -0
- data/spec/lib/logging/ruby_communicator_logger_spec.rb +84 -0
- data/spec/lib/logging/stdout_communicator_logger_spec.rb +64 -0
- data/spec/lib/logging/value_obfuscator_spec.rb +95 -0
- data/spec/lib/meta_data_provider_spec.rb +71 -0
- data/spec/lib/payments_client_spec.rb +157 -0
- data/spec/lib/requestparams/delete_params_spec.rb +21 -0
- data/spec/lib/requestparams/directory_params_spec.rb +27 -0
- data/spec/lib/requestparams/find_params_spec.rb +58 -0
- data/spec/lib/requestparams/get_params_spec.rb +59 -0
- data/spec/lib/requestparams/param_request_spec.rb +57 -0
- data/spec/spec_helper.rb +23 -0
- metadata +565 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"errorId": "2c164323-20d3-4e9e-8578-dc562cd7506c-00000058",
|
3
|
+
"errors": [
|
4
|
+
{
|
5
|
+
"code": "21000120",
|
6
|
+
"requestId": "2001803",
|
7
|
+
"propertyName": "cardPaymentMethodSpecificInput.card.expiryDate",
|
8
|
+
"message": "paymentMethodSpecificInput.card.expiryDate (1210) IS IN THE PAST OR NOT IN CORRECT MMYY FORMAT"
|
9
|
+
}
|
10
|
+
]
|
11
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
Method Not Allowed
|
@@ -0,0 +1 @@
|
|
1
|
+
Not Found
|
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"creationOutput": {
|
3
|
+
"additionalReference": "00000200002014254946",
|
4
|
+
"externalReference": "000002000020142549460000100001"
|
5
|
+
},
|
6
|
+
"payment": {
|
7
|
+
"id": "000002000020142549460000100001",
|
8
|
+
"paymentOutput": {
|
9
|
+
"amountOfMoney": {
|
10
|
+
"amount": 2345,
|
11
|
+
"currencyCode": "CAD"
|
12
|
+
},
|
13
|
+
"references": {
|
14
|
+
"paymentReference": "0"
|
15
|
+
},
|
16
|
+
"paymentMethod": "card",
|
17
|
+
"cardPaymentMethodSpecificOutput": {
|
18
|
+
"paymentProductId": 1,
|
19
|
+
"authorisationCode": "OK1131",
|
20
|
+
"card": {
|
21
|
+
"cardNumber": "************9176",
|
22
|
+
"expiryDate": "1220"
|
23
|
+
},
|
24
|
+
"fraudResults": {
|
25
|
+
"fraudServiceResult": "error",
|
26
|
+
"avsResult": "X",
|
27
|
+
"cvvResult": "M"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"status": "PENDING_APPROVAL",
|
32
|
+
"statusOutput": {
|
33
|
+
"isCancellable": true,
|
34
|
+
"statusCode": 600,
|
35
|
+
"statusCodeChangeDateTime": "20150331120036",
|
36
|
+
"isAuthorized": true
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
{
|
2
|
+
"errorId": "2c164323-20d3-4e9e-8578-dc562cd7506c-0000003c",
|
3
|
+
"errors": [
|
4
|
+
{
|
5
|
+
"code": "21000020",
|
6
|
+
"requestId": "2001798",
|
7
|
+
"message": "VALUE **************** OF FIELD CREDITCARDNUMBER DID NOT PASS THE LUHNCHECK"
|
8
|
+
}
|
9
|
+
],
|
10
|
+
"paymentResult": {
|
11
|
+
"creationOutput": {
|
12
|
+
"additionalReference": "00000200002014254436",
|
13
|
+
"externalReference": "000002000020142544360000100001"
|
14
|
+
},
|
15
|
+
"payment": {
|
16
|
+
"id": "000002000020142544360000100001",
|
17
|
+
"paymentOutput": {
|
18
|
+
"amountOfMoney": {
|
19
|
+
"amount": 2345,
|
20
|
+
"currencyCode": "CAD"
|
21
|
+
},
|
22
|
+
"references": {
|
23
|
+
"paymentReference": "0"
|
24
|
+
},
|
25
|
+
"paymentMethod": "card",
|
26
|
+
"cardPaymentMethodSpecificOutput": {
|
27
|
+
"paymentProductId": 1
|
28
|
+
}
|
29
|
+
},
|
30
|
+
"status": "REJECTED",
|
31
|
+
"statusOutput": {
|
32
|
+
"errors": [
|
33
|
+
{
|
34
|
+
"code": "21000020",
|
35
|
+
"requestId": "2001798",
|
36
|
+
"message": "VALUE **************** OF FIELD CREDITCARDNUMBER DID NOT PASS THE LUHNCHECK"
|
37
|
+
}
|
38
|
+
],
|
39
|
+
"isCancellable": false,
|
40
|
+
"statusCode": 100,
|
41
|
+
"statusCodeChangeDateTime": "20150330173151",
|
42
|
+
"isAuthorized": false
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
@@ -0,0 +1,13 @@
|
|
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: 10
|
7
|
+
connect.api.integrator: Ingenico
|
8
|
+
# change uri to preferred proxy
|
9
|
+
connect.api.proxy.uri: http://localhost:9999
|
10
|
+
# change username and password to authentication credentials for the proxy, omit the entries if no authentication is required
|
11
|
+
# authentication is done using basic proxy authentication. Therefore, to avoid leaking credentials you should connect to the proxy using SSL
|
12
|
+
connect.api.proxy.username: global-collect
|
13
|
+
connect.api.proxy.password: global-collect
|
@@ -0,0 +1,7 @@
|
|
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
|
7
|
+
connect.api.integrator: Ingenico
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration_setup'
|
3
|
+
require 'ingenico/connect/sdk/merchant/services/convert_amount_params'
|
4
|
+
require 'ingenico/connect/sdk/factory'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
describe 'connection pooling with the server' do
|
8
|
+
|
9
|
+
before(:context){WebMock.allow_net_connect!}
|
10
|
+
after(:context){WebMock.disable_net_connect!}
|
11
|
+
|
12
|
+
it 'runs with one connection per request' do
|
13
|
+
run_connection_pooling_test(10, 10)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'runs with one connection per two requests' do
|
17
|
+
run_connection_pooling_test(10, 5)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'runs with one connection for 10 requests' do
|
21
|
+
run_connection_pooling_test(10, 1)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Event # as per https://emptysqua.re/blog/an-event-synchronization-primitive-for-ruby/
|
26
|
+
def initialize
|
27
|
+
@lock = Mutex.new
|
28
|
+
@cond = ConditionVariable.new
|
29
|
+
@flag = false
|
30
|
+
end
|
31
|
+
|
32
|
+
def set
|
33
|
+
@lock.synchronize do
|
34
|
+
@flag = true
|
35
|
+
@cond.broadcast
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def wait
|
40
|
+
@lock.synchronize do
|
41
|
+
unless @flag
|
42
|
+
@cond.wait(@lock)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# sends *request_count* requests with a maximum number of connections in the connection pool equal to *max_connections*
|
49
|
+
def run_connection_pooling_test(request_count, max_connections)
|
50
|
+
configuration = Integration.init_communicator_configuration(max_connections: max_connections)
|
51
|
+
begin
|
52
|
+
communicator = Ingenico::Connect::SDK::Factory.create_communicator_from_configuration(configuration)
|
53
|
+
flag = Event.new
|
54
|
+
runner_threads = Array.new(request_count){ |i| Thread.new{run_request(i, communicator, flag)} }
|
55
|
+
flag.set
|
56
|
+
ensure
|
57
|
+
communicator.close unless communicator.nil?
|
58
|
+
end
|
59
|
+
results = Array.new(request_count){ |i| runner_threads[i].value } # returned values are arrays of size 2
|
60
|
+
puts "running times of #{request_count} threads using #{max_connections} connections:"
|
61
|
+
puts "each pair is the thread's start and end time in milliseconds"
|
62
|
+
results.each do |pair|
|
63
|
+
puts pair[0].to_s + ' ' + pair[1].to_s
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def run_request(i, communicator, flag)
|
68
|
+
request = Ingenico::Connect::SDK::Merchant::Services::ConvertAmountParams.new
|
69
|
+
request.source = 'USD'
|
70
|
+
request.target = 'EUR'
|
71
|
+
request.amount = 100*(i+1)
|
72
|
+
|
73
|
+
client = Ingenico::Connect::SDK::Factory.create_client_from_communicator(communicator)
|
74
|
+
flag.wait
|
75
|
+
start_time = Time.now
|
76
|
+
client.merchant(Integration::MERCHANT_ID).services.convert_amount(request)
|
77
|
+
return [start_time.to_i*1000, Time.now.to_i*1000]
|
78
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'integration_setup'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
require 'ingenico/connect/sdk/merchant/services/convert_amount_params'
|
6
|
+
|
7
|
+
describe 'convertAmount with the server' do
|
8
|
+
|
9
|
+
before(:context){WebMock.allow_net_connect!}
|
10
|
+
after(:context){WebMock.disable_net_connect!}
|
11
|
+
|
12
|
+
it 'communicates with the GlobalCollect platform' do
|
13
|
+
|
14
|
+
request = Ingenico::Connect::SDK::Merchant::Services::ConvertAmountParams.new
|
15
|
+
request.amount = 123
|
16
|
+
request.source = 'USD'
|
17
|
+
request.target = 'EUR'
|
18
|
+
|
19
|
+
Integration.init_client(false) do |client|
|
20
|
+
response = client.merchant(Integration::MERCHANT_ID).services.convert_amount(request)
|
21
|
+
expect(response).to_not be_nil
|
22
|
+
expect(response.converted_amount).to be > 0
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration_setup'
|
3
|
+
require 'securerandom'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
require 'ingenico/connect/sdk/domain/definitions/amount_of_money'
|
6
|
+
require 'ingenico/connect/sdk/domain/definitions/address'
|
7
|
+
require 'ingenico/connect/sdk/domain/payment/create_payment_request'
|
8
|
+
require 'ingenico/connect/sdk/domain/payment/customer'
|
9
|
+
require 'ingenico/connect/sdk/domain/payment/order'
|
10
|
+
require 'ingenico/connect/sdk/domain/payment/redirect_payment_product809_specific_input'
|
11
|
+
require 'ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input'
|
12
|
+
require 'ingenico/connect/sdk/call_context'
|
13
|
+
|
14
|
+
describe 'Idempotence with the server' do
|
15
|
+
|
16
|
+
before(:context){WebMock.allow_net_connect!}
|
17
|
+
after(:context){WebMock.disable_net_connect!}
|
18
|
+
|
19
|
+
it 'realises when an idempotent request is sent twice' do
|
20
|
+
amount_of_money = Ingenico::Connect::SDK::Domain::Definitions::AmountOfMoney.new
|
21
|
+
amount_of_money.currency_code = 'EUR'
|
22
|
+
amount_of_money.amount = 100
|
23
|
+
billing_address = Ingenico::Connect::SDK::Domain::Definitions::Address.new
|
24
|
+
billing_address.country_code = 'NL'
|
25
|
+
customer = Ingenico::Connect::SDK::Domain::Payment::Customer.new
|
26
|
+
customer.locale = 'en'
|
27
|
+
customer.billing_address = billing_address
|
28
|
+
order = Ingenico::Connect::SDK::Domain::Payment::Order.new
|
29
|
+
order.amount_of_money = amount_of_money
|
30
|
+
order.customer = customer
|
31
|
+
payment_product_input = Ingenico::Connect::SDK::Domain::Payment::RedirectPaymentProduct809SpecificInput.new
|
32
|
+
payment_product_input.issuer_id = 'INGBNL2A'
|
33
|
+
payment_method_input = Ingenico::Connect::SDK::Domain::Payment::RedirectPaymentMethodSpecificInput.new
|
34
|
+
payment_method_input.return_url = 'http://example.com'
|
35
|
+
payment_method_input.payment_product_id = 809
|
36
|
+
payment_method_input.payment_product809_specific_input = payment_product_input
|
37
|
+
body = Ingenico::Connect::SDK::Domain::Payment::CreatePaymentRequest.new
|
38
|
+
body.order = order
|
39
|
+
body.redirect_payment_method_specific_input = payment_method_input
|
40
|
+
idempotence_key = SecureRandom.uuid
|
41
|
+
context = Ingenico::Connect::SDK::CallContext.new(idempotence_key)
|
42
|
+
|
43
|
+
Integration.init_client(false) do |client|
|
44
|
+
response = client.merchant(Integration::MERCHANT_ID).payments.create(body, context)
|
45
|
+
payment_id = response.payment.id
|
46
|
+
|
47
|
+
expect(payment_id).to_not be_nil
|
48
|
+
expect(context.idempotence_key).to eq(idempotence_key)
|
49
|
+
expect(context.idempotence_request_timestamp).to be_nil
|
50
|
+
|
51
|
+
response_2 = client.merchant(Integration::MERCHANT_ID).payments.create(body, context)
|
52
|
+
payment_id2 = response_2.payment.id
|
53
|
+
|
54
|
+
expect(payment_id).to eq(payment_id2)
|
55
|
+
expect(context.idempotence_key).to eq(idempotence_key)
|
56
|
+
expect(context.idempotence_request_timestamp).to_not be_nil
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration_setup'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'ingenico/connect/sdk/factory'
|
5
|
+
require 'ingenico/connect/sdk/meta_data_provider'
|
6
|
+
require 'ingenico/connect/sdk/request_header'
|
7
|
+
require 'ingenico/connect/sdk/merchant/products/directory_params'
|
8
|
+
|
9
|
+
describe 'multiline headers' do
|
10
|
+
|
11
|
+
before(:context){WebMock.allow_net_connect!}
|
12
|
+
after(:context){WebMock.disable_net_connect!}
|
13
|
+
|
14
|
+
it 'should be accepted by the ingenico platform' do
|
15
|
+
multi_line_header = " some value \r\n \n with a liberal amount of \r\n spaces "
|
16
|
+
configuration = Integration.init_communicator_configuration
|
17
|
+
meta_data_provider = Ingenico::Connect::SDK::MetaDataProvider.new('Ingenico', additional_request_headers:
|
18
|
+
[Ingenico::Connect::SDK::RequestHeader.new('X-GCS-MultiLineHeader', multi_line_header)])
|
19
|
+
session = Ingenico::Connect::SDK::Factory.create_session_from_configuration(configuration)
|
20
|
+
|
21
|
+
params = Ingenico::Connect::SDK::Merchant::Products::DirectoryParams.new
|
22
|
+
params.country_code = 'NL'
|
23
|
+
params.currency_code = 'EUR'
|
24
|
+
|
25
|
+
Integration.init_client(false) do |client|
|
26
|
+
response = client.merchant(Integration::MERCHANT_ID).products.directory(809, params)
|
27
|
+
expect(response.entries.length).to be > 0
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'yaml'
|
3
|
+
require 'integration_setup'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
require 'ingenico/connect/sdk/merchant/productgroups/get_productgroup_params'
|
6
|
+
|
7
|
+
describe 'PaymentProductGroups' do
|
8
|
+
|
9
|
+
before(:context){WebMock.allow_net_connect!}
|
10
|
+
after(:context){WebMock.disable_net_connect!}
|
11
|
+
|
12
|
+
it 'can be accessed' do
|
13
|
+
|
14
|
+
params = Ingenico::Connect::SDK::Merchant::Productgroups::GetProductgroupParams.new
|
15
|
+
params.country_code = 'NL'
|
16
|
+
params.currency_code = 'EUR'
|
17
|
+
|
18
|
+
Integration.init_client(false) do |client|
|
19
|
+
response = client.merchant(Integration::MERCHANT_ID).productgroups.get('cards', params)
|
20
|
+
expect(response.id).to eq('cards')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration_setup'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'ingenico/connect/sdk/merchant/products/directory_params'
|
5
|
+
|
6
|
+
describe 'PaymentProducts' do
|
7
|
+
|
8
|
+
before(:context){WebMock.allow_net_connect!}
|
9
|
+
after(:context){WebMock.disable_net_connect!}
|
10
|
+
|
11
|
+
it 'can be accessed' do
|
12
|
+
|
13
|
+
params = Ingenico::Connect::SDK::Merchant::Products::DirectoryParams.new
|
14
|
+
params.country_code = 'NL'
|
15
|
+
params.currency_code = 'EUR'
|
16
|
+
|
17
|
+
Integration.init_client(false) do |client|
|
18
|
+
response = client.merchant(Integration::MERCHANT_ID).products.directory(809, params)
|
19
|
+
expect(response.entries.length).to be > 0
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration_setup'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'ingenico/connect/sdk/domain/definitions/bank_account_bban'
|
5
|
+
require 'ingenico/connect/sdk/domain/definitions/amount_of_money'
|
6
|
+
require 'ingenico/connect/sdk/domain/riskassessments/customer_risk_assessment'
|
7
|
+
require 'ingenico/connect/sdk/domain/riskassessments/order_risk_assessment'
|
8
|
+
require 'ingenico/connect/sdk/domain/riskassessments/risk_assessment_bank_account'
|
9
|
+
|
10
|
+
describe 'RiskAssessments' do
|
11
|
+
|
12
|
+
before(:context){WebMock.allow_net_connect!}
|
13
|
+
after(:context){WebMock.disable_net_connect!}
|
14
|
+
|
15
|
+
it 'can let the GlobalCollect platform assess risks' do
|
16
|
+
bank_account_bban = Ingenico::Connect::SDK::Domain::Definitions::BankAccountBban.new
|
17
|
+
bank_account_bban.country_code = 'DE'
|
18
|
+
bank_account_bban.account_number = '0532013000'
|
19
|
+
bank_account_bban.bank_code = '37040044'
|
20
|
+
amount_of_money = Ingenico::Connect::SDK::Domain::Definitions::AmountOfMoney.new
|
21
|
+
amount_of_money.amount = 100
|
22
|
+
amount_of_money.currency_code = 'EUR'
|
23
|
+
customer = Ingenico::Connect::SDK::Domain::Riskassessments::CustomerRiskAssessment.new
|
24
|
+
customer.locale = 'en_GB'
|
25
|
+
order = Ingenico::Connect::SDK::Domain::Riskassessments::OrderRiskAssessment.new
|
26
|
+
order.amount_of_money = amount_of_money
|
27
|
+
order.customer = customer
|
28
|
+
body = Ingenico::Connect::SDK::Domain::Riskassessments::RiskAssessmentBankAccount.new
|
29
|
+
body.order = order
|
30
|
+
body.bank_account_bban = bank_account_bban
|
31
|
+
|
32
|
+
Integration.init_client(false) do |client|
|
33
|
+
response = client.merchant(Integration::MERCHANT_ID).riskassessments.bankaccounts(body)
|
34
|
+
expect(response.results.length).to be > 0
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration_setup'
|
3
|
+
require 'ingenico/connect/sdk/factory'
|
4
|
+
require 'ingenico/connect/sdk/communicator_configuration'
|
5
|
+
require 'ingenico/connect/sdk/proxy_configuration'
|
6
|
+
require 'ingenico/connect/sdk/communication_exception'
|
7
|
+
require 'ingenico/connect/sdk/merchant/services/convert_amount_params'
|
8
|
+
require 'ingenico/connect/sdk/merchant/services/services_client'
|
9
|
+
|
10
|
+
require 'webrick'
|
11
|
+
require 'webrick/httpproxy'
|
12
|
+
|
13
|
+
describe 'proxies' do
|
14
|
+
|
15
|
+
context 'using proxy server' do
|
16
|
+
proxy_server = nil
|
17
|
+
|
18
|
+
password_filename = 'password_file'
|
19
|
+
|
20
|
+
before :context do
|
21
|
+
WebMock.allow_net_connect!
|
22
|
+
|
23
|
+
# set up a proxy
|
24
|
+
proxy_server = Thread.new do
|
25
|
+
config = { Realm: 'testing' }
|
26
|
+
htpasswd = WEBrick::HTTPAuth::Htpasswd.new(password_filename) # create new Apache password file
|
27
|
+
htpasswd.set_passwd config[:Realm], 'global-collect', 'global-collect' # same as properties.proxy.yml
|
28
|
+
config[:UserDB] = htpasswd
|
29
|
+
basic_auth = WEBrick::HTTPAuth::ProxyBasicAuth.new(config)
|
30
|
+
|
31
|
+
auth_handler = Proc.new do |req, res|
|
32
|
+
basic_auth.authenticate(req, res)
|
33
|
+
end
|
34
|
+
|
35
|
+
proxy = WEBrick::HTTPProxyServer.new(Port: 9999, ProxyVia: false,
|
36
|
+
ProxyAuthProc: auth_handler)
|
37
|
+
Signal.trap('INT') do
|
38
|
+
proxy.shutdown
|
39
|
+
end
|
40
|
+
|
41
|
+
proxy.start
|
42
|
+
end
|
43
|
+
|
44
|
+
sleep 1 # wait for the proxy server
|
45
|
+
end
|
46
|
+
|
47
|
+
after :context do
|
48
|
+
Thread.kill(proxy_server)
|
49
|
+
File.delete(password_filename)
|
50
|
+
WebMock.disable_net_connect!
|
51
|
+
end
|
52
|
+
|
53
|
+
# NOTE: if this test is running for a long time with no response
|
54
|
+
# check https://api-sandbox.globalcollect.com coz this is where merchant
|
55
|
+
# connects to.
|
56
|
+
it 'can be connected to' do
|
57
|
+
request = Ingenico::Connect::SDK::Merchant::Services::ConvertAmountParams.new
|
58
|
+
request.amount = 123
|
59
|
+
request.source = 'USD'
|
60
|
+
request.target = 'EUR'
|
61
|
+
|
62
|
+
Integration.init_client(true) do |client|
|
63
|
+
services = client.merchant(Integration::MERCHANT_ID).services
|
64
|
+
services.convert_amount(request)
|
65
|
+
|
66
|
+
expect(services).to be_an_instance_of(Ingenico::Connect::SDK::Merchant::Services::ServicesClient)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# test that connecting to a nonexistent proxy will raise an error
|
71
|
+
it 'should be connected to if possible' do
|
72
|
+
yaml = YAML.load_file(Integration::PROPERTIES_URI_PROXY)
|
73
|
+
config = Ingenico::Connect::SDK::CommunicatorConfiguration.new(properties: yaml, connect_timeout: 0.5, socket_timeout: 0.5,
|
74
|
+
authorization_type: 'v1HMAC',
|
75
|
+
api_key_id: Integration::API_KEY_ID,
|
76
|
+
secret_api_key: Integration::SECRET_API_KEY,
|
77
|
+
proxy_configuration: Ingenico::Connect::SDK::ProxyConfiguration.new(host: 'localhost',
|
78
|
+
port: 65535,
|
79
|
+
username: 'arg',
|
80
|
+
password: 'blarg'))
|
81
|
+
begin
|
82
|
+
client = Ingenico::Connect::SDK::Factory.create_client_from_configuration(config)
|
83
|
+
expect{client.merchant(Integration::MERCHANT_ID).services.testconnection}.to raise_error(Ingenico::Connect::SDK::CommunicationException)
|
84
|
+
ensure
|
85
|
+
client.close unless client.nil?
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end # end of using proxy server
|
89
|
+
end
|