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,42 @@
|
|
1
|
+
module Ingenico::Connect::SDK
|
2
|
+
module Logging
|
3
|
+
|
4
|
+
# Class that converts data about a request into a properly formatted log message.
|
5
|
+
# Formats request id, http method, uri, headers and body into a helpful message.
|
6
|
+
class RequestLogMessageBuilder < Ingenico::Connect::SDK::Logging::LogMessageBuilder
|
7
|
+
def initialize(request_id, method, uri)
|
8
|
+
super(request_id)
|
9
|
+
@method = method
|
10
|
+
@uri = uri
|
11
|
+
end
|
12
|
+
|
13
|
+
# Constructs and returns a log message based on the request data. The log message is a string.
|
14
|
+
def get_message
|
15
|
+
msgTemplateWithoutBody = "Outgoing request (requestId='%s'):\n" +
|
16
|
+
" method: '%s'\n" +
|
17
|
+
" uri: '%s'\n" +
|
18
|
+
" headers: '%s'"
|
19
|
+
msgTemplateWithBody = msgTemplateWithoutBody + "\n" +
|
20
|
+
" content-type: '%s'\n" +
|
21
|
+
" body: '%s'"
|
22
|
+
|
23
|
+
return sprintf(msgTemplateWithoutBody, @request_id, empty_if_null(@method),
|
24
|
+
format_uri, @headers) if @body.nil?
|
25
|
+
sprintf(msgTemplateWithBody, @request_id, empty_if_null(@method),
|
26
|
+
format_uri, @headers, empty_if_null(@content_type), @body)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def format_uri
|
32
|
+
'' unless @uri && @uri.path
|
33
|
+
if @uri.query.nil?
|
34
|
+
return @uri.path
|
35
|
+
else
|
36
|
+
return @uri.path + '?' + @uri.query unless @uri.query.nil?
|
37
|
+
end
|
38
|
+
# @uri.path + '?' + empty_if_null(@uri.query)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Ingenico::Connect::SDK
|
2
|
+
module Logging
|
3
|
+
|
4
|
+
class ResponseLogMessageBuilder < LogMessageBuilder
|
5
|
+
|
6
|
+
# Class that converts data about a response into a properly formatted log message.
|
7
|
+
# Formats request id, status code, headers, body and time between request and response into a helpful message.
|
8
|
+
# request_id:: Identifier of the request corresponding to this response.
|
9
|
+
# status_code:: HTTP status code of the response.
|
10
|
+
# duration:: Time elapsed between request and response.
|
11
|
+
def initialize(request_id, status_code, duration=-1)
|
12
|
+
super(request_id)
|
13
|
+
@status_code = status_code
|
14
|
+
@duration = duration
|
15
|
+
end
|
16
|
+
|
17
|
+
# Constructs and returns a log message based on the request data. The log message is a string.
|
18
|
+
def get_message
|
19
|
+
msgTemplate = "Incoming response (requestId='%s'" +
|
20
|
+
((@duration < 0) ? "" : ", %.3f ms") +
|
21
|
+
"):\n" +
|
22
|
+
" status-code: '%s'\n" +
|
23
|
+
" headers: '%s'\n" +
|
24
|
+
" content-type: '%s'\n" +
|
25
|
+
" body: '%s'"
|
26
|
+
|
27
|
+
return sprintf(msgTemplate, @request_id, @status_code, @headers,
|
28
|
+
empty_if_null(@content_type), empty_if_null(@body)) if @duration < 0
|
29
|
+
sprintf(msgTemplate, @request_id, @duration, @status_code, @headers,
|
30
|
+
empty_if_null(@content_type), empty_if_null(@body))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'English'
|
2
|
+
|
3
|
+
module Ingenico::Connect::SDK
|
4
|
+
module Logging
|
5
|
+
|
6
|
+
# Logging class that Logs messages and errors to a logger.
|
7
|
+
# Errors can be logged at a separate level compared to regular messages.
|
8
|
+
class RubyCommunicatorLogger < CommunicatorLogger
|
9
|
+
|
10
|
+
# Creates a new RubyCommunicatorLogger instance.
|
11
|
+
# logger:: The logger to log messages to. Messages to log will be provided using logger#log(message level, message)
|
12
|
+
# log_level:: Log level to use for non-error messages.
|
13
|
+
# error_level:: Error logging level to use.
|
14
|
+
def initialize(logger, log_level, error_level=false)
|
15
|
+
# implement the interface
|
16
|
+
error_level ||= log_level
|
17
|
+
raise ArgumentError unless logger
|
18
|
+
raise ArgumentError unless log_level
|
19
|
+
raise ArgumentError unless error_level
|
20
|
+
|
21
|
+
@logger = logger
|
22
|
+
@logLevel = log_level
|
23
|
+
@errorLevel = error_level
|
24
|
+
end
|
25
|
+
|
26
|
+
# Logs a single error or non-error message to the logger.
|
27
|
+
def log(msg, thrown=false)
|
28
|
+
# use Ruby Logger
|
29
|
+
if thrown
|
30
|
+
@logger.log(@errorLevel) { msg + $RS + thrown.backtrace.join($RS) }
|
31
|
+
else
|
32
|
+
@logger.log(@logLevel, msg)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Opens or creates a new file in write-only mode with _filename_.
|
37
|
+
def self.create_logfile(filename)
|
38
|
+
logdev = begin
|
39
|
+
open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL))
|
40
|
+
rescue Errno::EEXIST
|
41
|
+
# file is created by another process
|
42
|
+
open_logfile(filename)
|
43
|
+
end
|
44
|
+
logdev.sync = true
|
45
|
+
logdev
|
46
|
+
end
|
47
|
+
|
48
|
+
# Opens or creates a new file in write-only mode with _filename_.
|
49
|
+
def self.open_logfile(filename)
|
50
|
+
begin
|
51
|
+
open(filename, (File::WRONLY | File::APPEND))
|
52
|
+
rescue Errno::ENOENT
|
53
|
+
create_logfile(filename)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'English'
|
2
|
+
|
3
|
+
module Ingenico::Connect::SDK
|
4
|
+
module Logging
|
5
|
+
|
6
|
+
# {Ingenico::Connect::SDK::Logging::CommunicatorLogger} that logs the messages to $stdout.
|
7
|
+
class StdoutCommunicatorLogger < CommunicatorLogger
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
# implement the interface
|
11
|
+
end
|
12
|
+
|
13
|
+
# singleton
|
14
|
+
@@INSTANCE = StdoutCommunicatorLogger.new
|
15
|
+
|
16
|
+
private_class_method :new
|
17
|
+
|
18
|
+
# Returns the StdoutCommunicatorLogger instance
|
19
|
+
def self.INSTANCE
|
20
|
+
@@INSTANCE
|
21
|
+
end
|
22
|
+
|
23
|
+
# Logs a single error or non-error message to $stdout.
|
24
|
+
def log(msg, thrown=false)
|
25
|
+
$stdout.puts (get_date_prefix + msg)
|
26
|
+
$stdout.puts thrown.backtrace.join($RS) if thrown
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def get_date_prefix
|
32
|
+
Time.now.strftime("%Y-%m-%dT%H:%M:%S ")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Ingenico::Connect::SDK
|
2
|
+
|
3
|
+
# Class responsible for marshalling and unmarshalling objects to and from JSON
|
4
|
+
class Marshaller
|
5
|
+
|
6
|
+
# Marshals _request_object_ to JSON format by calling #to_hash on it.
|
7
|
+
def marshal(request_object)
|
8
|
+
raise NotImplementedError
|
9
|
+
end
|
10
|
+
|
11
|
+
# Unmarshals a JSON string into an object of type _type_.
|
12
|
+
# The new object is initialized by calling .new_from_hash with contents of the JSON as a Hash object.
|
13
|
+
# response_json:: The JSON to unmarshal
|
14
|
+
# type:: The class of the object that will be instantiated using _type.new_from_hash_
|
15
|
+
def unmarshal(response_json, type)
|
16
|
+
raise NotImplementedError
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://developer.globalcollect.com/documentation/api/server/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/api_resource'
|
6
|
+
require 'ingenico/connect/sdk/response_exception'
|
7
|
+
require 'ingenico/connect/sdk/domain/errors/error_response'
|
8
|
+
require 'ingenico/connect/sdk/domain/hostedcheckout/create_hosted_checkout_response'
|
9
|
+
require 'ingenico/connect/sdk/domain/hostedcheckout/get_hosted_checkout_response'
|
10
|
+
|
11
|
+
module Ingenico::Connect::SDK
|
12
|
+
module Merchant
|
13
|
+
module Hostedcheckouts
|
14
|
+
|
15
|
+
# Hostedcheckouts client. Thread-safe.
|
16
|
+
class HostedcheckoutsClient < Ingenico::Connect::SDK::ApiResource
|
17
|
+
|
18
|
+
# parent:: {Ingenico::Connect::SDK::ApiResource}
|
19
|
+
# path_context:: Hash of String to String
|
20
|
+
def initialize(parent, path_context)
|
21
|
+
super(parent, path_context)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Resource /{{merchantId}}/hostedcheckouts
|
25
|
+
#
|
26
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__hostedcheckouts_post Create hosted checkout}
|
27
|
+
# body:: {Ingenico::Connect::SDK::Domain::Hostedcheckout::CreateHostedCheckoutRequest}
|
28
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
29
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Hostedcheckout::CreateHostedCheckoutResponse}
|
30
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
31
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
32
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
33
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
34
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
35
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
36
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
37
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
38
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
39
|
+
def create(body, context=nil)
|
40
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/hostedcheckouts', nil)
|
41
|
+
return @communicator.post(
|
42
|
+
uri,
|
43
|
+
client_headers,
|
44
|
+
nil,
|
45
|
+
body,
|
46
|
+
Ingenico::Connect::SDK::Domain::Hostedcheckout::CreateHostedCheckoutResponse,
|
47
|
+
context)
|
48
|
+
rescue ResponseException => e
|
49
|
+
error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
|
50
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
51
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Resource /{{merchantId}}/hostedcheckouts/{{hostedCheckoutId}}
|
55
|
+
#
|
56
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__hostedcheckouts__hostedCheckoutId__get Get hosted checkout status}
|
57
|
+
# hosted_checkout_id:: String
|
58
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
59
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Hostedcheckout::GetHostedCheckoutResponse}
|
60
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
61
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
62
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
63
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
64
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
65
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
66
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
67
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
68
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
69
|
+
def get(hosted_checkout_id, context=nil)
|
70
|
+
path_context = {
|
71
|
+
'hostedCheckoutId' => hosted_checkout_id,
|
72
|
+
}
|
73
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/hostedcheckouts/{hostedCheckoutId}', path_context)
|
74
|
+
return @communicator.get(
|
75
|
+
uri,
|
76
|
+
client_headers,
|
77
|
+
nil,
|
78
|
+
Ingenico::Connect::SDK::Domain::Hostedcheckout::GetHostedCheckoutResponse,
|
79
|
+
context)
|
80
|
+
rescue ResponseException => e
|
81
|
+
error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
|
82
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
83
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://developer.globalcollect.com/documentation/api/server/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/api_resource'
|
6
|
+
require 'ingenico/connect/sdk/merchant/hostedcheckouts/hostedcheckouts_client'
|
7
|
+
require 'ingenico/connect/sdk/merchant/payments/payments_client'
|
8
|
+
require 'ingenico/connect/sdk/merchant/payouts/payouts_client'
|
9
|
+
require 'ingenico/connect/sdk/merchant/productgroups/productgroups_client'
|
10
|
+
require 'ingenico/connect/sdk/merchant/products/products_client'
|
11
|
+
require 'ingenico/connect/sdk/merchant/refunds/refunds_client'
|
12
|
+
require 'ingenico/connect/sdk/merchant/riskassessments/riskassessments_client'
|
13
|
+
require 'ingenico/connect/sdk/merchant/services/services_client'
|
14
|
+
require 'ingenico/connect/sdk/merchant/sessions/sessions_client'
|
15
|
+
require 'ingenico/connect/sdk/merchant/tokens/tokens_client'
|
16
|
+
|
17
|
+
module Ingenico::Connect::SDK
|
18
|
+
module Merchant
|
19
|
+
|
20
|
+
# Merchant client. Thread-safe.
|
21
|
+
class MerchantClient < Ingenico::Connect::SDK::ApiResource
|
22
|
+
|
23
|
+
# parent:: {Ingenico::Connect::SDK::ApiResource}
|
24
|
+
# path_context:: Hash of String to String
|
25
|
+
def initialize(parent, path_context)
|
26
|
+
super(parent, path_context)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Resource /{{merchantId}}/hostedcheckouts
|
30
|
+
#
|
31
|
+
# Create new hosted checkout
|
32
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Hostedcheckouts::HostedcheckoutsClient}
|
33
|
+
def hostedcheckouts
|
34
|
+
Ingenico::Connect::SDK::Merchant::Hostedcheckouts::HostedcheckoutsClient.new(self, nil)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Resource /{{merchantId}}/payments
|
38
|
+
#
|
39
|
+
# Create, cancel and approve payments
|
40
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Payments::PaymentsClient}
|
41
|
+
def payments
|
42
|
+
Ingenico::Connect::SDK::Merchant::Payments::PaymentsClient.new(self, nil)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Resource /{{merchantId}}/payouts
|
46
|
+
#
|
47
|
+
# Create, cancel and approve payouts
|
48
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Payouts::PayoutsClient}
|
49
|
+
def payouts
|
50
|
+
Ingenico::Connect::SDK::Merchant::Payouts::PayoutsClient.new(self, nil)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Resource /{{merchantId}}/productgroups
|
54
|
+
#
|
55
|
+
# Get information about payment product groups
|
56
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Productgroups::ProductgroupsClient}
|
57
|
+
def productgroups
|
58
|
+
Ingenico::Connect::SDK::Merchant::Productgroups::ProductgroupsClient.new(self, nil)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Resource /{{merchantId}}/products
|
62
|
+
#
|
63
|
+
# Get information about payment products
|
64
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Products::ProductsClient}
|
65
|
+
def products
|
66
|
+
Ingenico::Connect::SDK::Merchant::Products::ProductsClient.new(self, nil)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Resource /{{merchantId}}/refunds
|
70
|
+
#
|
71
|
+
# Create, cancel and approve refunds
|
72
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Refunds::RefundsClient}
|
73
|
+
def refunds
|
74
|
+
Ingenico::Connect::SDK::Merchant::Refunds::RefundsClient.new(self, nil)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Resource /{{merchantId}}/riskassessments
|
78
|
+
#
|
79
|
+
# Perform risk assessments on your customer data
|
80
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Riskassessments::RiskassessmentsClient}
|
81
|
+
def riskassessments
|
82
|
+
Ingenico::Connect::SDK::Merchant::Riskassessments::RiskassessmentsClient.new(self, nil)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Resource /{{merchantId}}/services
|
86
|
+
#
|
87
|
+
# Several services to help you
|
88
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Services::ServicesClient}
|
89
|
+
def services
|
90
|
+
Ingenico::Connect::SDK::Merchant::Services::ServicesClient.new(self, nil)
|
91
|
+
end
|
92
|
+
|
93
|
+
# Resource /{{merchantId}}/sessions
|
94
|
+
#
|
95
|
+
# Create new Session for Client2Server API calls
|
96
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Sessions::SessionsClient}
|
97
|
+
def sessions
|
98
|
+
Ingenico::Connect::SDK::Merchant::Sessions::SessionsClient.new(self, nil)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Resource /{{merchantId}}/tokens
|
102
|
+
#
|
103
|
+
# Create, delete and update tokens
|
104
|
+
# Returns:: {Ingenico::Connect::SDK::Merchant::Tokens::TokensClient}
|
105
|
+
def tokens
|
106
|
+
Ingenico::Connect::SDK::Merchant::Tokens::TokensClient.new(self, nil)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,319 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://developer.globalcollect.com/documentation/api/server/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/api_resource'
|
6
|
+
require 'ingenico/connect/sdk/response_exception'
|
7
|
+
require 'ingenico/connect/sdk/domain/errors/error_response'
|
8
|
+
require 'ingenico/connect/sdk/domain/payment/cancel_approval_payment_response'
|
9
|
+
require 'ingenico/connect/sdk/domain/payment/cancel_payment_response'
|
10
|
+
require 'ingenico/connect/sdk/domain/payment/create_payment_response'
|
11
|
+
require 'ingenico/connect/sdk/domain/payment/payment_approval_response'
|
12
|
+
require 'ingenico/connect/sdk/domain/payment/payment_error_response'
|
13
|
+
require 'ingenico/connect/sdk/domain/payment/payment_response'
|
14
|
+
require 'ingenico/connect/sdk/domain/refund/refund_error_response'
|
15
|
+
require 'ingenico/connect/sdk/domain/refund/refund_response'
|
16
|
+
require 'ingenico/connect/sdk/domain/token/create_token_response'
|
17
|
+
|
18
|
+
module Ingenico::Connect::SDK
|
19
|
+
module Merchant
|
20
|
+
module Payments
|
21
|
+
|
22
|
+
# Payments client. Thread-safe.
|
23
|
+
class PaymentsClient < Ingenico::Connect::SDK::ApiResource
|
24
|
+
|
25
|
+
# parent:: {Ingenico::Connect::SDK::ApiResource}
|
26
|
+
# path_context:: Hash of String to String
|
27
|
+
def initialize(parent, path_context)
|
28
|
+
super(parent, path_context)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Resource /{{merchantId}}/payments
|
32
|
+
#
|
33
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__payments_post Create payment}
|
34
|
+
# body:: {Ingenico::Connect::SDK::Domain::Payment::CreatePaymentRequest}
|
35
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
36
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Payment::CreatePaymentResponse}
|
37
|
+
# Raises:: {Ingenico::Connect::SDK::DeclinedPaymentException} if the GlobalCollect platform declined / rejected the payment. The payment result will be available from the exception.
|
38
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
39
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
40
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
41
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
42
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
43
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
44
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
45
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
46
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
47
|
+
def create(body, context=nil)
|
48
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/payments', nil)
|
49
|
+
return @communicator.post(
|
50
|
+
uri,
|
51
|
+
client_headers,
|
52
|
+
nil,
|
53
|
+
body,
|
54
|
+
Ingenico::Connect::SDK::Domain::Payment::CreatePaymentResponse,
|
55
|
+
context)
|
56
|
+
rescue ResponseException => e
|
57
|
+
error_type = {
|
58
|
+
400 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse,
|
59
|
+
402 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse,
|
60
|
+
403 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse,
|
61
|
+
502 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse,
|
62
|
+
503 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse,
|
63
|
+
}.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
|
64
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
65
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Resource /{{merchantId}}/payments/{{paymentId}}
|
69
|
+
#
|
70
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__payments__paymentId__get Get payment}
|
71
|
+
# payment_id:: String
|
72
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
73
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Payment::PaymentResponse}
|
74
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
75
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
76
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
77
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
78
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
79
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
80
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
81
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
82
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
83
|
+
def get(payment_id, context=nil)
|
84
|
+
path_context = {
|
85
|
+
'paymentId' => payment_id,
|
86
|
+
}
|
87
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}', path_context)
|
88
|
+
return @communicator.get(
|
89
|
+
uri,
|
90
|
+
client_headers,
|
91
|
+
nil,
|
92
|
+
Ingenico::Connect::SDK::Domain::Payment::PaymentResponse,
|
93
|
+
context)
|
94
|
+
rescue ResponseException => e
|
95
|
+
error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
|
96
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
97
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Resource /{{merchantId}}/payments/{{paymentId}}/approve
|
101
|
+
#
|
102
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__payments__paymentId__approve_post Capture payment}
|
103
|
+
# payment_id:: String
|
104
|
+
# body:: {Ingenico::Connect::SDK::Domain::Payment::ApprovePaymentRequest}
|
105
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
106
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Payment::PaymentApprovalResponse}
|
107
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
108
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
109
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
110
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
111
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
112
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
113
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
114
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
115
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
116
|
+
def approve(payment_id, body, context=nil)
|
117
|
+
path_context = {
|
118
|
+
'paymentId' => payment_id,
|
119
|
+
}
|
120
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/approve', path_context)
|
121
|
+
return @communicator.post(
|
122
|
+
uri,
|
123
|
+
client_headers,
|
124
|
+
nil,
|
125
|
+
body,
|
126
|
+
Ingenico::Connect::SDK::Domain::Payment::PaymentApprovalResponse,
|
127
|
+
context)
|
128
|
+
rescue ResponseException => e
|
129
|
+
error_type = {
|
130
|
+
402 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
|
131
|
+
404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
|
132
|
+
}.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
|
133
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
134
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Resource /{{merchantId}}/payments/{{paymentId}}/cancel
|
138
|
+
#
|
139
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__payments__paymentId__cancel_post Cancel payment}
|
140
|
+
# payment_id:: String
|
141
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
142
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Payment::CancelPaymentResponse}
|
143
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
144
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
145
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
146
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
147
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
148
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
149
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
150
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
151
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
152
|
+
def cancel(payment_id, context=nil)
|
153
|
+
path_context = {
|
154
|
+
'paymentId' => payment_id,
|
155
|
+
}
|
156
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/cancel', path_context)
|
157
|
+
return @communicator.post(
|
158
|
+
uri,
|
159
|
+
client_headers,
|
160
|
+
nil,
|
161
|
+
nil,
|
162
|
+
Ingenico::Connect::SDK::Domain::Payment::CancelPaymentResponse,
|
163
|
+
context)
|
164
|
+
rescue ResponseException => e
|
165
|
+
error_type = {
|
166
|
+
402 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
|
167
|
+
}.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
|
168
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
169
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
170
|
+
end
|
171
|
+
|
172
|
+
# Resource /{{merchantId}}/payments/{{paymentId}}/cancelapproval
|
173
|
+
#
|
174
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__payments__paymentId__cancelapproval_post Undo capture payment request}
|
175
|
+
# payment_id:: String
|
176
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
177
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Payment::CancelApprovalPaymentResponse}
|
178
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
179
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
180
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
181
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
182
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
183
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
184
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
185
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
186
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
187
|
+
def cancelapproval(payment_id, context=nil)
|
188
|
+
path_context = {
|
189
|
+
'paymentId' => payment_id,
|
190
|
+
}
|
191
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/cancelapproval', path_context)
|
192
|
+
return @communicator.post(
|
193
|
+
uri,
|
194
|
+
client_headers,
|
195
|
+
nil,
|
196
|
+
nil,
|
197
|
+
Ingenico::Connect::SDK::Domain::Payment::CancelApprovalPaymentResponse,
|
198
|
+
context)
|
199
|
+
rescue ResponseException => e
|
200
|
+
error_type = {
|
201
|
+
404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
|
202
|
+
}.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
|
203
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
204
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
205
|
+
end
|
206
|
+
|
207
|
+
# Resource /{{merchantId}}/payments/{{paymentId}}/processchallenged
|
208
|
+
#
|
209
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__payments__paymentId__processchallenged_post Approves challenged payment}
|
210
|
+
# payment_id:: String
|
211
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
212
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Payment::PaymentResponse}
|
213
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
214
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
215
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
216
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
217
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
218
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
219
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
220
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
221
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
222
|
+
def processchallenged(payment_id, context=nil)
|
223
|
+
path_context = {
|
224
|
+
'paymentId' => payment_id,
|
225
|
+
}
|
226
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/processchallenged', path_context)
|
227
|
+
return @communicator.post(
|
228
|
+
uri,
|
229
|
+
client_headers,
|
230
|
+
nil,
|
231
|
+
nil,
|
232
|
+
Ingenico::Connect::SDK::Domain::Payment::PaymentResponse,
|
233
|
+
context)
|
234
|
+
rescue ResponseException => e
|
235
|
+
error_type = {
|
236
|
+
404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
|
237
|
+
405 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
|
238
|
+
}.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
|
239
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
240
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
241
|
+
end
|
242
|
+
|
243
|
+
# Resource /{{merchantId}}/payments/{{paymentId}}/refund
|
244
|
+
#
|
245
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__payments__paymentId__refund_post Create refund}
|
246
|
+
# payment_id:: String
|
247
|
+
# body:: {Ingenico::Connect::SDK::Domain::Refund::RefundRequest}
|
248
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
249
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Refund::RefundResponse}
|
250
|
+
# Raises:: {Ingenico::Connect::SDK::DeclinedRefundException} if the GlobalCollect platform declined / rejected the refund. The refund result will be available from the exception.
|
251
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
252
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
253
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
254
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
255
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
256
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
257
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
258
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
259
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
260
|
+
def refund(payment_id, body, context=nil)
|
261
|
+
path_context = {
|
262
|
+
'paymentId' => payment_id,
|
263
|
+
}
|
264
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/refund', path_context)
|
265
|
+
return @communicator.post(
|
266
|
+
uri,
|
267
|
+
client_headers,
|
268
|
+
nil,
|
269
|
+
body,
|
270
|
+
Ingenico::Connect::SDK::Domain::Refund::RefundResponse,
|
271
|
+
context)
|
272
|
+
rescue ResponseException => e
|
273
|
+
error_type = {
|
274
|
+
400 => Ingenico::Connect::SDK::Domain::Refund::RefundErrorResponse,
|
275
|
+
404 => Ingenico::Connect::SDK::Domain::Refund::RefundErrorResponse,
|
276
|
+
}.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
|
277
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
278
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
279
|
+
end
|
280
|
+
|
281
|
+
# Resource /{{merchantId}}/payments/{{paymentId}}/tokenize
|
282
|
+
#
|
283
|
+
# {https://developer.globalcollect.com/documentation/api/server/#__merchantId__payments__paymentId__tokenize_post Create a token from payment}
|
284
|
+
# payment_id:: String
|
285
|
+
# body:: {Ingenico::Connect::SDK::Domain::Payment::TokenizePaymentRequest}
|
286
|
+
# context:: {Ingenico::Connect::SDK::CallContext}
|
287
|
+
# Returns:: {Ingenico::Connect::SDK::Domain::Token::CreateTokenResponse}
|
288
|
+
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
|
289
|
+
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
|
290
|
+
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
|
291
|
+
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
|
292
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
293
|
+
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
|
294
|
+
# the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
|
295
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
296
|
+
# Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
|
297
|
+
def tokenize(payment_id, body, context=nil)
|
298
|
+
path_context = {
|
299
|
+
'paymentId' => payment_id,
|
300
|
+
}
|
301
|
+
uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/tokenize', path_context)
|
302
|
+
return @communicator.post(
|
303
|
+
uri,
|
304
|
+
client_headers,
|
305
|
+
nil,
|
306
|
+
body,
|
307
|
+
Ingenico::Connect::SDK::Domain::Token::CreateTokenResponse,
|
308
|
+
context)
|
309
|
+
rescue ResponseException => e
|
310
|
+
error_type = {
|
311
|
+
404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
|
312
|
+
}.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
|
313
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
314
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|