connect-sdk-ruby 1.36.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/connect-sdk-ruby.gemspec +1 -1
- data/examples/merchant/captures/get_capture_example.rb +1 -1
- data/examples/merchant/disputes/cancel_dispute_example.rb +1 -1
- data/examples/merchant/disputes/get_dispute_example.rb +1 -1
- data/examples/merchant/disputes/submit_dispute_example.rb +1 -1
- data/examples/merchant/disputes/upload_dispute_file_example.rb +30 -0
- data/examples/merchant/{products/get_payment_product_public_key_example.rb → files/get_file_example.rb} +7 -1
- data/examples/merchant/hostedcheckouts/create_hosted_checkout_example.rb +1 -1
- data/examples/merchant/hostedcheckouts/get_hosted_checkout_example.rb +1 -1
- data/examples/merchant/hostedmandatemanagements/create_hosted_mandate_management_example.rb +1 -1
- data/examples/merchant/hostedmandatemanagements/get_hosted_mandate_management_example.rb +1 -1
- data/examples/merchant/mandates/block_mandate_example.rb +1 -1
- data/examples/merchant/mandates/create_mandate_example.rb +1 -1
- data/examples/merchant/mandates/create_mandate_with_reference_example.rb +1 -1
- data/examples/merchant/mandates/get_mandate_example.rb +1 -1
- data/examples/merchant/mandates/revoke_mandate_example.rb +1 -1
- data/examples/merchant/mandates/unblock_mandate_example.rb +1 -1
- data/examples/merchant/payments/approve_payment_example.rb +1 -1
- data/examples/merchant/payments/cancel_approval_payment_example.rb +1 -1
- data/examples/merchant/payments/cancel_payment_example.rb +1 -1
- data/examples/merchant/payments/capture_payment_example.rb +1 -1
- data/examples/merchant/payments/complete_payment_example.rb +1 -1
- data/examples/merchant/payments/create_payment_dispute_example.rb +1 -1
- data/examples/merchant/payments/create_payment_example.rb +3 -3
- data/examples/merchant/payments/find_payments_example.rb +1 -1
- data/examples/merchant/payments/get_payment_captures_example.rb +1 -1
- data/examples/merchant/payments/get_payment_disputes_example.rb +1 -1
- data/examples/merchant/payments/get_payment_example.rb +1 -1
- data/examples/merchant/payments/get_refunds_example.rb +1 -1
- data/examples/merchant/payments/get_third_party_status_example.rb +1 -1
- data/examples/merchant/payments/process_challenged_payment_example.rb +1 -1
- data/examples/merchant/payments/refund_payment_example.rb +2 -2
- data/examples/merchant/payments/tokenize_payment_example.rb +1 -1
- data/examples/merchant/payouts/approve_payout_example.rb +1 -1
- data/examples/merchant/payouts/cancel_approval_payout_example.rb +1 -1
- data/examples/merchant/payouts/cancel_payout_example.rb +1 -1
- data/examples/merchant/payouts/create_payout_example.rb +2 -2
- data/examples/merchant/payouts/find_payouts_example.rb +1 -1
- data/examples/merchant/payouts/get_payout_example.rb +1 -1
- data/examples/merchant/productgroups/get_device_fingerprint_for_groups_example.rb +1 -1
- data/examples/merchant/productgroups/get_payment_product_group_example.rb +1 -1
- data/examples/merchant/productgroups/get_payment_product_groups_example.rb +1 -1
- data/examples/merchant/products/get_customer_details_example.rb +1 -1
- data/examples/merchant/products/get_device_fingerprint_example.rb +1 -1
- data/examples/merchant/products/get_directory_example.rb +1 -1
- data/examples/merchant/products/get_networks_example.rb +1 -1
- data/examples/merchant/products/get_payment_product_example.rb +1 -1
- data/examples/merchant/products/get_payment_products_example.rb +1 -1
- data/examples/merchant/refunds/approve_refund_example.rb +1 -1
- data/examples/merchant/refunds/cancel_approval_refund_example.rb +1 -1
- data/examples/merchant/refunds/cancel_refund_example.rb +1 -1
- data/examples/merchant/refunds/find_refunds_example.rb +1 -1
- data/examples/merchant/refunds/get_refund_example.rb +1 -1
- data/examples/merchant/riskassessments/risk_assessment_bank_account_example.rb +1 -1
- data/examples/merchant/riskassessments/risk_assessment_cards_example.rb +1 -1
- data/examples/merchant/services/convert_amount_example.rb +1 -1
- data/examples/merchant/services/convert_bank_account_example.rb +1 -1
- data/examples/merchant/services/get_privacy_policy_example.rb +1 -1
- data/examples/merchant/services/iin_details_example.rb +1 -1
- data/examples/merchant/services/test_connection_example.rb +1 -1
- data/examples/merchant/sessions/create_session_example.rb +1 -1
- data/examples/merchant/tokens/approve_sepa_direct_debit_token_example.rb +1 -1
- data/examples/merchant/tokens/create_token_example.rb +1 -1
- data/examples/merchant/tokens/delete_token_example.rb +1 -1
- data/examples/merchant/tokens/get_token_example.rb +1 -1
- data/examples/merchant/tokens/update_token_example.rb +1 -1
- data/lib/ingenico/connect/sdk.rb +3 -1
- data/lib/ingenico/connect/sdk/api_exception.rb +12 -14
- data/lib/ingenico/connect/sdk/api_resource.rb +14 -13
- data/lib/ingenico/connect/sdk/authenticator.rb +5 -4
- data/lib/ingenico/connect/sdk/call_context.rb +6 -6
- data/lib/ingenico/connect/sdk/client.rb +12 -11
- data/lib/ingenico/connect/sdk/communication_exception.rb +2 -1
- data/lib/ingenico/connect/sdk/communicator.rb +331 -128
- data/lib/ingenico/connect/sdk/communicator_configuration.rb +21 -39
- data/lib/ingenico/connect/sdk/connection.rb +16 -6
- data/lib/ingenico/connect/sdk/data_object.rb +2 -13
- data/lib/ingenico/connect/sdk/declined_payment_exception.rb +1 -1
- data/lib/ingenico/connect/sdk/declined_payout_exception.rb +1 -1
- data/lib/ingenico/connect/sdk/declined_refund_exception.rb +1 -1
- data/lib/ingenico/connect/sdk/defaultimpl/authorization_type.rb +2 -1
- data/lib/ingenico/connect/sdk/defaultimpl/default_authenticator.rb +9 -7
- data/lib/ingenico/connect/sdk/defaultimpl/default_connection.rb +212 -68
- data/lib/ingenico/connect/sdk/defaultimpl/default_marshaller.rb +2 -2
- data/lib/ingenico/connect/sdk/domain/capture/capture.rb +12 -15
- data/lib/ingenico/connect/sdk/domain/capture/capture_output.rb +43 -60
- data/lib/ingenico/connect/sdk/domain/capture/capture_status_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/capture/captures_response.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/definitions/abstract_order_status.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/definitions/abstract_payment_method_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/definitions/additional_order_input_airline_data.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/definitions/address.rb +25 -24
- data/lib/ingenico/connect/sdk/domain/definitions/airline_data.rb +76 -79
- data/lib/ingenico/connect/sdk/domain/definitions/airline_flight_leg.rb +62 -61
- data/lib/ingenico/connect/sdk/domain/definitions/airline_passenger.rb +13 -12
- data/lib/ingenico/connect/sdk/domain/definitions/amount_of_money.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/definitions/bank_account.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/definitions/bank_account_bban.rb +19 -18
- data/lib/ingenico/connect/sdk/domain/definitions/bank_account_iban.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/definitions/card.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/definitions/card_essentials.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/definitions/card_fraud_results.rb +15 -18
- data/lib/ingenico/connect/sdk/domain/definitions/card_without_cvv.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/definitions/company_information.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/definitions/contact_details_base.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/definitions/customer_base.rb +12 -13
- data/lib/ingenico/connect/sdk/domain/definitions/fraud_fields.rb +70 -75
- data/lib/ingenico/connect/sdk/domain/definitions/fraud_fields_shipping_details.rb +14 -13
- data/lib/ingenico/connect/sdk/domain/definitions/fraud_results.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/definitions/fraud_results_retail_decisions.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/definitions/fraugster_results.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/definitions/key_value_pair.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/definitions/order_status_output.rb +17 -18
- data/lib/ingenico/connect/sdk/domain/definitions/payment_product_filter.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/definitions/personal_name_base.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/definitions/redirect_data_base.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/definitions/result_do_risk_assessment.rb +15 -18
- data/lib/ingenico/connect/sdk/domain/definitions/retail_decisions_cc_fraud_check_output.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/definitions/validation_bank_account_check.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/definitions/validation_bank_account_output.rb +17 -18
- data/lib/ingenico/connect/sdk/domain/dispute/create_dispute_request.rb +17 -18
- data/lib/ingenico/connect/sdk/domain/dispute/dispute.rb +18 -21
- data/lib/ingenico/connect/sdk/domain/dispute/dispute_creation_detail.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/dispute/dispute_output.rb +32 -39
- data/lib/ingenico/connect/sdk/domain/dispute/dispute_reference.rb +16 -15
- data/lib/ingenico/connect/sdk/domain/dispute/dispute_status_output.rb +13 -12
- data/lib/ingenico/connect/sdk/domain/dispute/disputes_response.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/dispute/upload_dispute_file_response.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/errors/api_error.rb +22 -21
- data/lib/ingenico/connect/sdk/domain/errors/error_response.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/file/hosted_file.rb +13 -12
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/create_hosted_checkout_request.rb +45 -66
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/create_hosted_checkout_response.rb +17 -18
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/created_payment_output.rb +23 -28
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/displayed_data.rb +11 -12
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/get_hosted_checkout_response.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/hosted_checkout_specific_input.rb +29 -30
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/mobile_payment_method_specific_input_hosted_checkout.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/mobile_payment_product320_specific_input_hosted_checkout.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/hostedcheckout/payment_product_filters_hosted_checkout.rb +12 -15
- data/lib/ingenico/connect/sdk/domain/hostedmandatemanagement/create_hosted_mandate_management_request.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/hostedmandatemanagement/create_hosted_mandate_management_response.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/hostedmandatemanagement/get_hosted_mandate_management_response.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/hostedmandatemanagement/hosted_mandate_info.rb +20 -21
- data/lib/ingenico/connect/sdk/domain/hostedmandatemanagement/hosted_mandate_management_specific_input.rb +13 -12
- data/lib/ingenico/connect/sdk/domain/mandates/create_mandate_base.rb +23 -24
- data/lib/ingenico/connect/sdk/domain/mandates/create_mandate_response.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/mandates/create_mandate_with_return_url.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/mandates/get_mandate_response.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/mandates/mandate_address.rb +16 -15
- data/lib/ingenico/connect/sdk/domain/mandates/mandate_contact_details.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/mandates/mandate_customer.rb +20 -27
- data/lib/ingenico/connect/sdk/domain/mandates/mandate_merchant_action.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/mandates/mandate_personal_information.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/mandates/mandate_personal_name.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/mandates/mandate_response.rb +20 -21
- data/lib/ingenico/connect/sdk/domain/metadata/shopping_cart_extension.rb +8 -8
- data/lib/ingenico/connect/sdk/domain/payment/abstract_bank_transfer_payment_method_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/abstract_card_payment_method_specific_input.rb +44 -45
- data/lib/ingenico/connect/sdk/domain/payment/abstract_e_invoice_payment_method_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/abstract_payment_method_specific_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/abstract_redirect_payment_method_specific_input.rb +16 -15
- data/lib/ingenico/connect/sdk/domain/payment/abstract_redirect_payment_product840_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/abstract_sepa_direct_debit_payment_product771_specific_input.rb +5 -4
- data/lib/ingenico/connect/sdk/domain/payment/abstract_three_d_secure.rb +21 -24
- data/lib/ingenico/connect/sdk/domain/payment/additional_order_input.rb +20 -25
- data/lib/ingenico/connect/sdk/domain/payment/address_personal.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/amount_breakdown.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/approve_payment_card_payment_method_specific_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/approve_payment_mobile_payment_method_specific_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/approve_payment_payment_method_specific_input.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/approve_payment_request.rb +16 -21
- data/lib/ingenico/connect/sdk/domain/payment/browser_data.rb +22 -21
- data/lib/ingenico/connect/sdk/domain/payment/cancel_approval_payment_response.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/cancel_payment_card_payment_method_specific_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/cancel_payment_mobile_payment_method_specific_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/cancel_payment_response.rb +13 -18
- data/lib/ingenico/connect/sdk/domain/payment/capture_payment_request.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/card_payment_method_specific_input.rb +21 -26
- data/lib/ingenico/connect/sdk/domain/payment/card_payment_method_specific_input_base.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/card_payment_method_specific_output.rb +19 -24
- data/lib/ingenico/connect/sdk/domain/payment/card_recurrence_details.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_input.rb +30 -43
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1503_specific_input.rb +6 -5
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1504_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1521_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1522_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1523_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1524_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1526_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/complete_payment_card_payment_method_specific_input.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/complete_payment_request.rb +13 -18
- data/lib/ingenico/connect/sdk/domain/payment/contact_details.rb +13 -12
- data/lib/ingenico/connect/sdk/domain/payment/create_payment_request.rb +52 -75
- data/lib/ingenico/connect/sdk/domain/payment/create_payment_result.rb +13 -18
- data/lib/ingenico/connect/sdk/domain/payment/customer.rb +38 -49
- data/lib/ingenico/connect/sdk/domain/payment/customer_account.rb +40 -45
- data/lib/ingenico/connect/sdk/domain/payment/customer_account_authentication.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/customer_approve_payment.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/customer_device.rb +26 -27
- data/lib/ingenico/connect/sdk/domain/payment/customer_payment_activity.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/payment/decrypted_payment_data.rb +22 -21
- data/lib/ingenico/connect/sdk/domain/payment/device_render_options.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/e_invoice_payment_method_specific_input.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/payment/e_invoice_payment_method_specific_output.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/e_invoice_payment_product9000_specific_input.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/payment/e_invoice_payment_product9000_specific_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/external_cardholder_authentication_data.rb +25 -24
- data/lib/ingenico/connect/sdk/domain/payment/find_payments_response.rb +14 -15
- data/lib/ingenico/connect/sdk/domain/payment/gift_card_purchase.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/payment/hosted_checkout_specific_output.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/invoice_payment_method_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/level3_summary_data.rb +14 -13
- data/lib/ingenico/connect/sdk/domain/payment/line_item.rb +18 -25
- data/lib/ingenico/connect/sdk/domain/payment/line_item_invoice_data.rb +16 -15
- data/lib/ingenico/connect/sdk/domain/payment/line_item_level3_interchange_information.rb +25 -24
- data/lib/ingenico/connect/sdk/domain/payment/merchant.rb +11 -12
- data/lib/ingenico/connect/sdk/domain/payment/merchant_action.rb +27 -36
- data/lib/ingenico/connect/sdk/domain/payment/mobile_payment_data.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/mobile_payment_method_specific_input.rb +17 -18
- data/lib/ingenico/connect/sdk/domain/payment/mobile_payment_method_specific_output.rb +19 -24
- data/lib/ingenico/connect/sdk/domain/payment/mobile_three_d_secure_challenge_parameters.rb +13 -12
- data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_method_specific_input.rb +27 -30
- data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_method_specific_output.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_product705_specific_input.rb +11 -12
- data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_product730_specific_input.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/order.rb +35 -50
- data/lib/ingenico/connect/sdk/domain/payment/order_approve_payment.rb +13 -18
- data/lib/ingenico/connect/sdk/domain/payment/order_invoice_data.rb +14 -15
- data/lib/ingenico/connect/sdk/domain/payment/order_line_details.rb +34 -33
- data/lib/ingenico/connect/sdk/domain/payment/order_output.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/payment/order_references.rb +14 -15
- data/lib/ingenico/connect/sdk/domain/payment/order_references_approve_payment.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/order_type_information.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/payment/payment.rb +16 -21
- data/lib/ingenico/connect/sdk/domain/payment/payment_account_on_file.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/payment_approval_response.rb +18 -25
- data/lib/ingenico/connect/sdk/domain/payment/payment_creation_output.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/payment/payment_creation_references.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/payment_error_response.rb +12 -15
- data/lib/ingenico/connect/sdk/domain/payment/payment_output.rb +43 -60
- data/lib/ingenico/connect/sdk/domain/payment/payment_product3201_specific_output.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/payment_product771_specific_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/payment_product836_specific_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/payment_product840_customer_account.rb +31 -30
- data/lib/ingenico/connect/sdk/domain/payment/payment_product840_specific_output.rb +13 -18
- data/lib/ingenico/connect/sdk/domain/payment/payment_product863_third_party_data.rb +22 -21
- data/lib/ingenico/connect/sdk/domain/payment/payment_references.rb +19 -18
- data/lib/ingenico/connect/sdk/domain/payment/payment_status_output.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/payment/personal_information.rb +11 -12
- data/lib/ingenico/connect/sdk/domain/payment/personal_name.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/protection_eligibility.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input.rb +36 -49
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input_base.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_output.rb +24 -33
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product809_specific_input.rb +8 -7
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product816_specific_input.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product840_specific_input.rb +8 -7
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product861_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product863_specific_input.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product882_specific_input.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/redirection_data.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/refund_e_wallet_method_specific_output.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/refund_method_specific_output.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/payment/refund_mobile_method_specific_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/refund_output.rb +27 -36
- data/lib/ingenico/connect/sdk/domain/payment/refund_payment_product840_customer_account.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/payment/refund_payment_product840_specific_output.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/sdk_data_input.rb +26 -27
- data/lib/ingenico/connect/sdk/domain/payment/sdk_data_output.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/seller.rb +29 -30
- data/lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_method_specific_input.rb +23 -24
- data/lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_method_specific_input_base.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_method_specific_output.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_product771_specific_input.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_product771_specific_input_base.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/payment/shipping.rb +26 -27
- data/lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb +22 -27
- data/lib/ingenico/connect/sdk/domain/payment/third_party_data.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/payment/third_party_status_response.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payment/three_d_secure.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/payment/three_d_secure_data.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/payment/three_d_secure_results.rb +27 -30
- data/lib/ingenico/connect/sdk/domain/payment/tokenize_payment_request.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payout/approve_payout_request.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/payout/bank_transfer_payout_method_specific_input.rb +22 -27
- data/lib/ingenico/connect/sdk/domain/payout/card_payout_method_specific_input.rb +11 -12
- data/lib/ingenico/connect/sdk/domain/payout/create_payout_request.rb +44 -57
- data/lib/ingenico/connect/sdk/domain/payout/find_payouts_response.rb +14 -15
- data/lib/ingenico/connect/sdk/domain/payout/payout_customer.rb +20 -27
- data/lib/ingenico/connect/sdk/domain/payout/payout_error_response.rb +12 -15
- data/lib/ingenico/connect/sdk/domain/payout/payout_references.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/payout/payout_result.rb +12 -15
- data/lib/ingenico/connect/sdk/domain/product/abstract_indicator.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/product/account_on_file.rb +15 -18
- data/lib/ingenico/connect/sdk/domain/product/account_on_file_attribute.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/product/account_on_file_display_hints.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/product/boleto_bancario_requiredness_validator.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/product/device_fingerprint_request.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/product/device_fingerprint_response.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/product/directory.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/product/directory_entry.rb +14 -15
- data/lib/ingenico/connect/sdk/domain/product/fixed_list_validator.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/product/get_customer_details_request.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/product/get_customer_details_response.rb +31 -30
- data/lib/ingenico/connect/sdk/domain/product/label_template_element.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/product/length_validator.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/product/payment_product.rb +71 -84
- data/lib/ingenico/connect/sdk/domain/product/payment_product302_specific_data.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/product/payment_product320_specific_data.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/product/payment_product863_specific_data.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/product/payment_product_display_hints.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field.rb +18 -21
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_data_restrictions.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_display_element.rb +13 -12
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_display_hints.rb +33 -36
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_form_element.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_tooltip.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/product/payment_product_field_validators.rb +41 -60
- data/lib/ingenico/connect/sdk/domain/product/payment_product_group.rb +19 -24
- data/lib/ingenico/connect/sdk/domain/product/payment_product_groups.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/product/payment_product_networks_response.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/product/payment_products.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/product/range_validator.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/product/regular_expression_validator.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/product/value_mapping_element.rb +12 -13
- data/lib/ingenico/connect/sdk/domain/refund/approve_refund_request.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/refund/bank_account_bban_refund.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/refund/bank_refund_method_specific_input.rb +12 -15
- data/lib/ingenico/connect/sdk/domain/refund/find_refunds_response.rb +14 -15
- data/lib/ingenico/connect/sdk/domain/refund/refund_customer.rb +16 -21
- data/lib/ingenico/connect/sdk/domain/refund/refund_error_response.rb +12 -15
- data/lib/ingenico/connect/sdk/domain/refund/refund_references.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/refund/refund_request.rb +20 -27
- data/lib/ingenico/connect/sdk/domain/refund/refund_result.rb +12 -15
- data/lib/ingenico/connect/sdk/domain/refund/refunds_response.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/riskassessments/contact_details_risk_assessment.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/riskassessments/customer_account_risk_assessment.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/riskassessments/customer_device_risk_assessment.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/riskassessments/customer_risk_assessment.rb +35 -46
- data/lib/ingenico/connect/sdk/domain/riskassessments/merchant_risk_assessment.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/riskassessments/order_risk_assessment.rb +17 -24
- data/lib/ingenico/connect/sdk/domain/riskassessments/personal_information_risk_assessment.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment.rb +16 -21
- data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment_bank_account.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment_card.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/riskassessments/risk_assessment_response.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/riskassessments/shipping_risk_assessment.rb +11 -12
- data/lib/ingenico/connect/sdk/domain/services/bank_data.rb +13 -12
- data/lib/ingenico/connect/sdk/domain/services/bank_details.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/services/bank_details_response.rb +17 -24
- data/lib/ingenico/connect/sdk/domain/services/convert_amount.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/services/get_iin_details_request.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/services/get_iin_details_response.rb +14 -15
- data/lib/ingenico/connect/sdk/domain/services/get_privacy_policy_response.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/services/iin_detail.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/services/payment_context.rb +11 -12
- data/lib/ingenico/connect/sdk/domain/services/swift.rb +31 -30
- data/lib/ingenico/connect/sdk/domain/services/test_connection.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/sessions/payment_product_filters_client_session.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/sessions/session_request.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/sessions/session_response.rb +20 -21
- data/lib/ingenico/connect/sdk/domain/token/abstract_token.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/token/create_token_request.rb +20 -27
- data/lib/ingenico/connect/sdk/domain/token/create_token_response.rb +7 -6
- data/lib/ingenico/connect/sdk/domain/token/creditor.rb +34 -33
- data/lib/ingenico/connect/sdk/domain/token/customer_token.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/token/customer_token_with_contact_details.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/token/debtor.rb +34 -33
- data/lib/ingenico/connect/sdk/domain/token/mandate_approval.rb +10 -9
- data/lib/ingenico/connect/sdk/domain/token/mandate_non_sepa_direct_debit.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/token/mandate_sepa_direct_debit.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/token/mandate_sepa_direct_debit_with_mandate_id.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/token/mandate_sepa_direct_debit_without_creditor.rb +22 -27
- data/lib/ingenico/connect/sdk/domain/token/personal_information_token.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/token/token_card.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/token/token_card_data.rb +11 -12
- data/lib/ingenico/connect/sdk/domain/token/token_e_wallet.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/token/token_e_wallet_data.rb +4 -3
- data/lib/ingenico/connect/sdk/domain/token/token_non_sepa_direct_debit.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/token/token_non_sepa_direct_debit_payment_product705_specific_data.rb +8 -9
- data/lib/ingenico/connect/sdk/domain/token/token_non_sepa_direct_debit_payment_product730_specific_data.rb +5 -6
- data/lib/ingenico/connect/sdk/domain/token/token_response.rb +23 -30
- data/lib/ingenico/connect/sdk/domain/token/token_sepa_direct_debit.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/token/token_sepa_direct_debit_without_creditor.rb +9 -12
- data/lib/ingenico/connect/sdk/domain/token/update_token_request.rb +20 -27
- data/lib/ingenico/connect/sdk/endpoint_configuration.rb +12 -20
- data/lib/ingenico/connect/sdk/factory.rb +34 -32
- data/lib/ingenico/connect/sdk/idempotence_exception.rb +3 -3
- data/lib/ingenico/connect/sdk/logging/communicator_logger.rb +5 -2
- data/lib/ingenico/connect/sdk/logging/log_message_builder.rb +25 -13
- data/lib/ingenico/connect/sdk/logging/logging_util.rb +14 -14
- data/lib/ingenico/connect/sdk/logging/request_log_message_builder.rb +4 -5
- data/lib/ingenico/connect/sdk/logging/response_log_message_builder.rb +7 -6
- data/lib/ingenico/connect/sdk/logging/ruby_communicator_logger.rb +5 -4
- data/lib/ingenico/connect/sdk/logging/stdout_communicator_logger.rb +2 -1
- data/lib/ingenico/connect/sdk/marshaller.rb +8 -3
- data/lib/ingenico/connect/sdk/merchant/captures/captures_client.rb +17 -17
- data/lib/ingenico/connect/sdk/merchant/disputes/disputes_client.rb +80 -47
- data/lib/ingenico/connect/sdk/merchant/disputes/upload_file_request.rb +27 -0
- data/lib/ingenico/connect/sdk/merchant/files/files_client.rb +55 -0
- data/lib/ingenico/connect/sdk/merchant/hostedcheckouts/hostedcheckouts_client.rb +31 -31
- data/lib/ingenico/connect/sdk/merchant/hostedmandatemanagements/hostedmandatemanagements_client.rb +31 -31
- data/lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb +92 -92
- data/lib/ingenico/connect/sdk/merchant/merchant_client.rb +37 -30
- data/lib/ingenico/connect/sdk/merchant/payments/find_payments_params.rb +12 -11
- data/lib/ingenico/connect/sdk/merchant/payments/payments_client.rb +248 -248
- data/lib/ingenico/connect/sdk/merchant/payouts/find_payouts_params.rb +10 -9
- data/lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb +90 -90
- data/lib/ingenico/connect/sdk/merchant/productgroups/find_productgroups_params.rb +17 -13
- data/lib/ingenico/connect/sdk/merchant/productgroups/get_productgroup_params.rb +17 -13
- data/lib/ingenico/connect/sdk/merchant/productgroups/productgroups_client.rb +48 -48
- data/lib/ingenico/connect/sdk/merchant/products/directory_params.rb +6 -5
- data/lib/ingenico/connect/sdk/merchant/products/find_products_params.rb +17 -13
- data/lib/ingenico/connect/sdk/merchant/products/get_product_params.rb +19 -15
- data/lib/ingenico/connect/sdk/merchant/products/networks_params.rb +10 -9
- data/lib/ingenico/connect/sdk/merchant/products/products_client.rb +96 -127
- data/lib/ingenico/connect/sdk/merchant/refunds/find_refunds_params.rb +12 -11
- data/lib/ingenico/connect/sdk/merchant/refunds/refunds_client.rb +74 -74
- data/lib/ingenico/connect/sdk/merchant/riskassessments/riskassessments_client.rb +30 -30
- data/lib/ingenico/connect/sdk/merchant/services/convert_amount_params.rb +8 -7
- data/lib/ingenico/connect/sdk/merchant/services/privacypolicy_params.rb +6 -5
- data/lib/ingenico/connect/sdk/merchant/services/services_client.rb +71 -71
- data/lib/ingenico/connect/sdk/merchant/sessions/sessions_client.rb +16 -16
- data/lib/ingenico/connect/sdk/merchant/tokens/delete_token_params.rb +4 -3
- data/lib/ingenico/connect/sdk/merchant/tokens/tokens_client.rb +76 -76
- data/lib/ingenico/connect/sdk/meta_data_provider.rb +19 -20
- data/lib/ingenico/connect/sdk/modules.rb +5 -4
- data/lib/ingenico/connect/sdk/multipart_form_data_object.rb +44 -0
- data/lib/ingenico/connect/sdk/multipart_form_data_request.rb +9 -0
- data/lib/ingenico/connect/sdk/not_found_exception.rb +4 -7
- data/lib/ingenico/connect/sdk/param_request.rb +3 -25
- data/lib/ingenico/connect/sdk/proxy_configuration.rb +16 -17
- data/lib/ingenico/connect/sdk/request_header.rb +22 -3
- data/lib/ingenico/connect/sdk/request_param.rb +3 -2
- data/lib/ingenico/connect/sdk/response_exception.rb +24 -27
- data/lib/ingenico/connect/sdk/response_header.rb +49 -2
- data/lib/ingenico/connect/sdk/session.rb +11 -10
- data/lib/ingenico/connect/sdk/uploadable_file.rb +30 -0
- data/lib/ingenico/connect/sdk/webhooks/api_version_mismatch_exception.rb +3 -3
- data/lib/ingenico/connect/sdk/webhooks/in_memory_secret_key_store.rb +5 -5
- data/lib/ingenico/connect/sdk/webhooks/secret_key_not_available_exception.rb +2 -0
- data/lib/ingenico/connect/sdk/webhooks/secret_key_store.rb +2 -2
- data/lib/ingenico/connect/sdk/webhooks/signature_validation_exception.rb +1 -1
- data/lib/ingenico/connect/sdk/webhooks/webhooks_event.rb +19 -25
- data/lib/ingenico/connect/sdk/webhooks/webhooks_helper.rb +11 -10
- data/spec/integration/multipart_form_data_spec.rb +214 -0
- data/spec/lib/defaultimpl/default_connection_idempotence_spec.rb +7 -7
- data/spec/lib/defaultimpl/default_connection_logger_spec.rb +0 -4
- data/spec/lib/defaultimpl/default_connection_spec.rb +48 -25
- data/spec/lib/logging/header_obfuscator_spec.rb +1 -1
- data/spec/lib/logging/logging_util_spec.rb +7 -7
- data/spec/lib/logging/obfuscator_spec.rb +4 -4
- data/spec/lib/logging/ruby_communicator_logger_spec.rb +8 -8
- data/spec/lib/logging/stdout_communicator_logger_spec.rb +1 -1
- data/spec/lib/logging/value_obfuscator_spec.rb +1 -1
- data/spec/lib/payments_client_spec.rb +8 -9
- metadata +12 -7
- data/lib/ingenico/connect/sdk/domain/publickey/public_key.rb +0 -38
- data/lib/ingenico/connect/sdk/response.rb +0 -59
- data/spec/lib/requestparams/param_request_spec.rb +0 -57
@@ -1,44 +1,33 @@
|
|
1
1
|
module Ingenico::Connect::SDK
|
2
2
|
|
3
|
-
# A CommunicatorConfiguration stores all data used to initialize an {Ingenico::Connect::SDK::Communicator}.
|
3
|
+
# A CommunicatorConfiguration stores all data used to initialize an {Ingenico::Connect::SDK::Communicator}.
|
4
4
|
#
|
5
|
-
# api_endpoint
|
6
|
-
# api_key_id
|
7
|
-
# secret_api_key
|
8
|
-
# authorization_type
|
9
|
-
# connect_timeout:: The number of seconds before a connection attempt with the Ingenico ePayments platform times out.
|
10
|
-
# socket_timeout:: The number of seconds before a timeout occurs
|
11
|
-
# when transmitting data to or from the Ingenico ePayments platform.
|
12
|
-
# max_connections:: The number of connections with the Ingenico ePayments platform
|
13
|
-
# that are kept alive in the connection pool. These connections will be reused when possible.
|
14
|
-
# proxy_configuration:: {Ingenico::Connect::SDK::ProxyConfiguration} instance that stores the url to a proxy to be used in all communication,
|
15
|
-
# or nil if no proxy should be used.
|
16
|
-
# integrator:: String
|
17
|
-
# shopping_cart_extension:: {Ingenico::Connect::SDK::Domain::Metadata::ShoppingCartExtension} that stores shopping cart-related metadata.
|
5
|
+
# @attr [String] api_endpoint Base URL to the Ingenico ePayments platform
|
6
|
+
# @attr [String] api_key_id Identifier of the _secret_api_key_ used in authentication.
|
7
|
+
# @attr [String] secret_api_key Secret key used in authentication
|
8
|
+
# @attr [String] authorization_type String representing the authentication algorithm used
|
18
9
|
class CommunicatorConfiguration < EndpointConfiguration
|
19
10
|
|
20
|
-
# Creates a new CommunicatorConfiguration instance
|
21
|
-
#
|
22
|
-
# properties:: A hash that may contain any of the other parameters.
|
23
|
-
# If a parameter is given in both the _properties_ and separately,
|
24
|
-
# the separate value takes precedence.
|
25
|
-
# api_endpoint:: The base url to the Ingenico ePayments platform.
|
26
|
-
# api_key_id:: The identifier of the _secret_api_key_ used to authenticate requests.
|
27
|
-
# secret_api_key:: The key used to authenticate requests sent to the Ingenico ePayments platform.
|
28
|
-
# authorization_type:: String describing the authorization protocol to follow.
|
29
|
-
# connect_timeout:: The number of seconds before a connection attempt with the Ingenico ePayments platform times out.
|
30
|
-
# socket_timeout:: The number of seconds before a timeout occurs
|
31
|
-
# when transmitting data to or from the Ingenico ePayments platform.
|
32
|
-
# max_connections:: The number of connections with the Ingenico ePayments platform
|
33
|
-
# that are kept alive in the connection pool. These connections will be reused when possible.
|
34
|
-
# proxy_configuration:: {Ingenico::Connect::SDK::ProxyConfiguration} instance that stores the url to a proxy to be used in all communication,
|
35
|
-
# or nil if no proxy should be used.
|
36
|
-
# integrator:: String
|
37
|
-
# shopping_cart_extension:: {Ingenico::Connect::SDK::Domain::Metadata::ShoppingCartExtension} that stores shopping cart-related metadata.
|
11
|
+
# Creates a new CommunicatorConfiguration instance.
|
38
12
|
#
|
39
13
|
# If a _properties_ object is given, it will be parsed like a hash in order to read these attributes.
|
40
14
|
# If a value is given in both the _properties_ hash and as a separate parameter,
|
41
15
|
# the separate parameter will take precedence over the value in the properties.
|
16
|
+
#
|
17
|
+
# @param properties [Hash] hash that may contain any of the other parameters.
|
18
|
+
# @param api_endpoint [String] the base URL to the Ingenico ePayments platform.
|
19
|
+
# @param api_key_id [String] the identifier of the _secret_api_key_ used to authenticate requests.
|
20
|
+
# @param secret_api_key [String] the key used to authenticate requests sent to the Ingenico ePayments platform.
|
21
|
+
# @param authorization_type [String] string describing the authorization protocol to follow.
|
22
|
+
# @param connect_timeout [Integer] the number of seconds before a connection attempt with the Ingenico ePayments platform times out.
|
23
|
+
# @param socket_timeout [Integer] the number of seconds before a timeout occurs when transmitting data to or from the Ingenico ePayments platform.
|
24
|
+
# @param max_connections [Integer] the number of connections with the Ingenico ePayments platform that are kept alive in the connection pool.
|
25
|
+
# These connections will be reused when possible.
|
26
|
+
# @param proxy_configuration [Ingenico::Connect::SDK::ProxyConfiguration] stores the URL to a proxy to be used in all communication,
|
27
|
+
# or nil if no proxy should be used.
|
28
|
+
# @param integrator [String] name of the integrator
|
29
|
+
# @param shopping_cart_extension [Ingenico::Connect::SDK::Domain::Metadata::ShoppingCartExtension] stores shopping cart-related metadata.
|
30
|
+
# @see EndpointConfiguration#initialize
|
42
31
|
def initialize(properties: nil, api_endpoint: nil, api_key_id: nil,
|
43
32
|
secret_api_key: nil, authorization_type: nil,
|
44
33
|
connect_timeout: nil, socket_timeout: nil,
|
@@ -83,16 +72,9 @@ module Ingenico::Connect::SDK
|
|
83
72
|
end
|
84
73
|
end
|
85
74
|
|
86
|
-
# Base URL to the Ingenico ePayments platform
|
87
75
|
attr_accessor :api_endpoint
|
88
|
-
|
89
|
-
# Identifier of the _secret_api_key_ used in authentication.
|
90
76
|
attr_accessor :api_key_id
|
91
|
-
|
92
|
-
# Secret key used in authentication
|
93
77
|
attr_accessor :secret_api_key
|
94
|
-
|
95
|
-
# String representing the authentication algorithm used
|
96
78
|
attr_accessor :authorization_type
|
97
79
|
end
|
98
80
|
end
|
@@ -6,24 +6,34 @@ module Ingenico::Connect::SDK
|
|
6
6
|
class Connection
|
7
7
|
include Ingenico::Connect::SDK::Logging::LoggingCapable
|
8
8
|
|
9
|
-
# Performs a GET request to _uri_ using _request_headers_
|
9
|
+
# Performs a GET request to _uri_ using _request_headers_,
|
10
|
+
# and yields the response as the status code, headers and body.
|
11
|
+
#
|
12
|
+
# @yield (Integer, Array<Ingenico::Connect::SDK::ResponseHeader>, IO) The status code, headers and body of the response.
|
10
13
|
def get(uri, request_headers)
|
11
14
|
raise NotImplementedError
|
12
15
|
end
|
13
16
|
|
14
|
-
# Performs a DELETE request to _uri_ using _request_headers_
|
17
|
+
# Performs a DELETE request to _uri_ using _request_headers_,
|
18
|
+
# and yields the response as the status code, headers and body.
|
19
|
+
#
|
20
|
+
# @yield (Integer, Array<Ingenico::Connect::SDK::ResponseHeader>, IO) The status code, headers and body of the response.
|
15
21
|
def delete(uri, request_headers)
|
16
22
|
raise NotImplementedError
|
17
23
|
end
|
18
24
|
|
19
|
-
# Performs a POST request to _uri_ using _request_headers_ and _body_
|
20
|
-
#
|
25
|
+
# Performs a POST request to _uri_ using _request_headers_ and _body_,
|
26
|
+
# and yields the response as the status code, headers and body.
|
27
|
+
#
|
28
|
+
# @yield (Integer, Array<Ingenico::Connect::SDK::ResponseHeader>, IO) The status code, headers and body of the response.
|
21
29
|
def post(uri, request_headers, body)
|
22
30
|
raise NotImplementedError
|
23
31
|
end
|
24
32
|
|
25
|
-
# Performs a PUT request to _uri_ using _request_headers_ and _body_
|
26
|
-
#
|
33
|
+
# Performs a PUT request to _uri_ using _request_headers_ and _body_,
|
34
|
+
# and yields the response as the status code, headers and body.
|
35
|
+
#
|
36
|
+
# @yield (Integer, Array<Ingenico::Connect::SDK::ResponseHeader>, IO) The status code, headers and body of the response.
|
27
37
|
def put(uri, request_headers, body)
|
28
38
|
raise NotImplementedError
|
29
39
|
end
|
@@ -8,6 +8,8 @@ module Ingenico::Connect::SDK
|
|
8
8
|
# Returns a hash representation of the DataObject.
|
9
9
|
# The hash contains camelCase representations of the variables, and their values.
|
10
10
|
# Should be overridden to add all instance variables of the object.
|
11
|
+
#
|
12
|
+
# @return [Hash]
|
11
13
|
def to_h
|
12
14
|
{}
|
13
15
|
end
|
@@ -26,18 +28,5 @@ module Ingenico::Connect::SDK
|
|
26
28
|
# Note that the hash contains Strings as keys instead of more commonly used tokens.
|
27
29
|
def from_hash(hash)
|
28
30
|
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
# Adds a serializable hash or array representation of _value_ to _hash_ keyed under _key_
|
33
|
-
def add_to_hash(hash, key, value)
|
34
|
-
if value.is_a?(Array) # For arrays, convert the elements to hash representations
|
35
|
-
hash[key] = value.collect{|val| if val.is_a?(DataObject); val.to_h else val end}
|
36
|
-
elsif value.is_a?(DataObject)
|
37
|
-
hash[key] = value.to_h
|
38
|
-
elsif !value.nil?
|
39
|
-
hash[key] = value
|
40
|
-
end
|
41
|
-
end
|
42
31
|
end
|
43
32
|
end
|
@@ -16,7 +16,7 @@ module Ingenico::Connect::SDK
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# The declined payment result returned by the Ingenico ePayments platform.
|
19
|
-
#
|
19
|
+
# @return [Ingenico::Connect::SDK::Domain::Payment::CreatePaymentResult]
|
20
20
|
def payment_result
|
21
21
|
if @errors.nil?
|
22
22
|
nil
|
@@ -16,7 +16,7 @@ module Ingenico::Connect::SDK
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# The declined payout result as returned by the Ingenico ePayments platform.
|
19
|
-
#
|
19
|
+
# @return [Ingenico::Connect::SDK::Domain::Payout::PayoutResult]
|
20
20
|
def payout_result
|
21
21
|
if @errors.nil?
|
22
22
|
nil
|
@@ -18,7 +18,7 @@ module Ingenico::Connect::SDK
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# The declined refund result as returned by the Ingenico ePayments platform.
|
21
|
-
#
|
21
|
+
# @return [Ingenico::Connect::SDK::Domain::Refund::RefundResult]
|
22
22
|
def refund_result
|
23
23
|
if @errors.nil?
|
24
24
|
nil
|
@@ -5,11 +5,12 @@ module Ingenico::Connect::SDK
|
|
5
5
|
class AuthorizationType
|
6
6
|
V1HMAC = 'v1HMAC'
|
7
7
|
|
8
|
-
#
|
8
|
+
# @return [String] the authorization string that belongs to the parameter _authorization_, or _nil_ if not found.
|
9
9
|
def self.get_authorization(authorization)
|
10
10
|
authorization if authorization == 'v1HMAC'
|
11
11
|
end
|
12
12
|
|
13
|
+
# @return [String]
|
13
14
|
def self.get_signature_string
|
14
15
|
V1HMAC
|
15
16
|
end
|
@@ -15,9 +15,10 @@ module Ingenico::Connect::SDK
|
|
15
15
|
|
16
16
|
# Construct a new DefaultAuthenticator instance that can sign requests
|
17
17
|
# with the provided _api_key_id_ and _secret_api_key_.
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
18
|
+
#
|
19
|
+
# @param authorization_type [String] the authorization protocol to use for authentication.
|
20
|
+
# @param api_key_id [String] identifier for the secret key used in authentication.
|
21
|
+
# @param secret_api_key [String] the secret key that is used to generate the authentication signature.
|
21
22
|
def initialize(authorization_type, api_key_id, secret_api_key)
|
22
23
|
raise ArgumentError unless authorization_type
|
23
24
|
raise ArgumentError unless api_key_id and not api_key_id.strip.empty?
|
@@ -29,10 +30,11 @@ module Ingenico::Connect::SDK
|
|
29
30
|
end
|
30
31
|
|
31
32
|
# Creates a signature to authenticate a request.
|
32
|
-
#
|
33
|
-
# http_method
|
34
|
-
# resource_uri::
|
35
|
-
#
|
33
|
+
#
|
34
|
+
# @param http_method [String] 'GET', 'PUT', 'POST' or 'DELETE' indicating which HTTP method will be used with the request
|
35
|
+
# @param resource_uri [URI::HTTP] URI object that includes #path and #query of the URL that will be used, #query may be *nil*
|
36
|
+
# @param http_headers [Array<Ingenico::Connect::SDK::RequestHeader>] list that contains all headers used by the request
|
37
|
+
# @return [String] the created signature
|
36
38
|
def create_simple_authentication_signature(http_method, resource_uri, http_headers)
|
37
39
|
raise ArgumentError unless http_method and not http_method.strip.empty?
|
38
40
|
raise ArgumentError unless resource_uri
|
@@ -16,22 +16,22 @@ end
|
|
16
16
|
module Ingenico::Connect::SDK
|
17
17
|
module DefaultImpl
|
18
18
|
class DefaultConnection < PooledConnection
|
19
|
-
|
20
19
|
using RefineHTTPClient
|
21
20
|
|
22
21
|
CONTENT_TYPE = 'Content-Type'.freeze
|
23
22
|
JSON_CONTENT_TYPE = 'application/json'.freeze
|
24
23
|
|
25
|
-
#
|
26
|
-
# connect_timeout
|
27
|
-
# socket_timeout
|
28
|
-
# max_connections
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
24
|
+
# @param args [Hash] the parameters to initialize the connection with
|
25
|
+
# @option args [Integer] :connect_timeout connection timeout in seconds.
|
26
|
+
# @option args [Integer] :socket_timeout socket timeout in seconds.
|
27
|
+
# @option args [Integer] :max_connections number of connections kept alive in the thread pool.
|
28
|
+
# Uses {Ingenico::Connect::SDK::CommunicatorConfiguration.DEFAULT_MAX_CONNECTIONS} if not given.
|
29
|
+
# @option args [Ingenico::Connect::SDK::ProxyConfiguration] :proxy_configuration object that stores the proxy to use.
|
30
|
+
# If not given the system default proxy is used;
|
31
|
+
# if there is no system default proxy set either, no proxy is used.
|
33
32
|
def initialize(args)
|
34
33
|
raise ArgumentError unless args.is_a? Hash
|
34
|
+
|
35
35
|
# Set timeouts to nil if they are negative
|
36
36
|
@connect_timeout = args[:connect_timeout]
|
37
37
|
@connect_timeout = nil unless @connect_timeout.nil? || @connect_timeout > 0
|
@@ -59,15 +59,17 @@ module Ingenico::Connect::SDK
|
|
59
59
|
if @proxy_configuration
|
60
60
|
httpclient = HTTPClient.new(@proxy_configuration.proxy_uri)
|
61
61
|
httpclient.set_proxy_auth(@proxy_configuration.username, @proxy_configuration.password)
|
62
|
+
httpclient.force_basic_auth = true unless @proxy_configuration.username.nil? || @proxy_configuration.password.nil?
|
62
63
|
httpclient
|
63
64
|
else # use system settings
|
64
65
|
proxy_string = ENV['https_proxy'] || ENV['http_proxy']
|
65
66
|
# proxy string format = 'http://username:password@hostname:port'
|
66
|
-
proxy_string =~ %r
|
67
|
-
username =
|
68
|
-
password =
|
67
|
+
proxy_string =~ %r{https?//(?<username>[^:]):(?<password>[^@])@.*}
|
68
|
+
username = Regexp.last_match(1)
|
69
|
+
password = Regexp.last_match(2)
|
69
70
|
httpclient = HTTPClient.new(proxy_string)
|
70
71
|
httpclient.set_proxy_auth(username, password) unless username.nil? || password.nil?
|
72
|
+
httpclient.force_basic_auth = true unless username.nil? || password.nil?
|
71
73
|
httpclient
|
72
74
|
end
|
73
75
|
end
|
@@ -102,65 +104,100 @@ module Ingenico::Connect::SDK
|
|
102
104
|
# Performs a GET request to the Ingenico ePayments platform
|
103
105
|
# @see request
|
104
106
|
def get(uri, request_headers)
|
105
|
-
request('get', uri, request_headers)
|
107
|
+
request('get', uri, request_headers) do |response_status_code, response_headers, response_body|
|
108
|
+
yield response_status_code, response_headers, response_body
|
109
|
+
end
|
106
110
|
end
|
107
111
|
|
108
112
|
# Performs a DELETE request to the Ingenico ePayments platform
|
109
113
|
# @see request
|
110
114
|
def delete(uri, request_headers)
|
111
|
-
request('delete', uri, request_headers)
|
115
|
+
request('delete', uri, request_headers) do |response_status_code, response_headers, response_body|
|
116
|
+
yield response_status_code, response_headers, response_body
|
117
|
+
end
|
112
118
|
end
|
113
119
|
|
114
120
|
# Performs a POST request to the Ingenico ePayments platform
|
115
121
|
# @see request
|
116
122
|
def post(uri, request_headers, body)
|
117
|
-
request('post', uri, request_headers, body)
|
123
|
+
request('post', uri, request_headers, body) do |response_status_code, response_headers, response_body|
|
124
|
+
yield response_status_code, response_headers, response_body
|
125
|
+
end
|
118
126
|
end
|
119
127
|
|
120
128
|
# Performs a PUT request to the Ingenico ePayments platform
|
121
129
|
# @see request
|
122
130
|
def put(uri, request_headers, body)
|
123
|
-
request('put', uri, request_headers, body)
|
131
|
+
request('put', uri, request_headers, body) do |response_status_code, response_headers, response_body|
|
132
|
+
yield response_status_code, response_headers, response_body
|
133
|
+
end
|
124
134
|
end
|
125
135
|
|
126
|
-
#
|
136
|
+
# Performs a HTTP request and yields the response as the status code, headers and body.
|
127
137
|
# Also ensures the request is logged when sent and its response is logged when received.
|
128
|
-
#
|
129
|
-
# method
|
130
|
-
# uri::
|
131
|
-
# request_headers
|
132
|
-
# body
|
133
|
-
|
138
|
+
#
|
139
|
+
# @param method [String] 'GET', 'DELETE', 'POST' or 'PUT' depending on the HTTP method being used.
|
140
|
+
# @param uri [URI::HTTP] full URI of the location the request is targeted at, including query parameters.
|
141
|
+
# @param request_headers [Array<Ingenico::Connect::SDK::RequestHeader>] list of headers that should be used as HTTP headers in the request.
|
142
|
+
# @param body [String, Ingenico::Connect::SDK::MultipartFormDataObject] request body.
|
143
|
+
# @yield (Integer, Array<Ingenico::Connect::SDK::ResponseHeader>, IO) The status code, headers and body of the response.
|
144
|
+
# @raise [Ingenico::Connect::SDK::CommunicationException] when communication with the Ingenico ePayments platform was not successful.
|
145
|
+
def request(method, uri, request_headers, body = nil)
|
134
146
|
request_headers = convert_from_sdk_headers(request_headers)
|
135
147
|
request_id = SecureRandom.uuid
|
136
|
-
request_headers[CONTENT_TYPE] = JSON_CONTENT_TYPE if body
|
137
148
|
content_type = request_headers[CONTENT_TYPE]
|
149
|
+
|
138
150
|
info = { headers: request_headers, content_type: content_type }
|
139
151
|
info[:body] = body unless body.nil?
|
152
|
+
|
140
153
|
log_request(request_id, method.upcase, uri, info)
|
141
154
|
|
142
155
|
start_time = Time.now
|
143
156
|
begin
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
157
|
+
response_headers = nil
|
158
|
+
response_status_code = nil
|
159
|
+
response_content_type = nil
|
160
|
+
response_body = ''
|
161
|
+
|
162
|
+
if body.is_a? Ingenico::Connect::SDK::MultipartFormDataObject
|
163
|
+
multipart_request(method, uri, request_headers, body) do |status_code, headers, r_content_type, r_body|
|
164
|
+
response_headers = headers
|
165
|
+
response_status_code = status_code
|
166
|
+
response_content_type = r_content_type
|
167
|
+
unless binary_content_type? response_content_type
|
168
|
+
response_body = r_body.read.force_encoding('UTF-8')
|
169
|
+
r_body = StringIO.new(response_body)
|
170
|
+
end
|
171
|
+
|
172
|
+
yield status_code, headers, r_body
|
173
|
+
end
|
174
|
+
else
|
175
|
+
raw_request(method, uri, request_headers, body) do |status_code, headers, r_content_type, r_body|
|
176
|
+
response_headers = headers
|
177
|
+
response_status_code = status_code
|
178
|
+
response_content_type = r_content_type
|
179
|
+
unless binary_content_type? response_content_type
|
180
|
+
response_body = r_body.read.force_encoding('UTF-8')
|
181
|
+
r_body = StringIO.new(response_body)
|
182
|
+
end
|
183
|
+
|
184
|
+
yield status_code, headers, r_body
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
log_response(request_id, response_status_code, start_time,
|
189
|
+
headers: response_headers, body: response_body,
|
190
|
+
content_type: response_content_type)
|
149
191
|
rescue HTTPClient::TimeoutError => e
|
150
192
|
log_error(request_id, start_time, e)
|
151
|
-
raise Ingenico::Connect::SDK::CommunicationException
|
152
|
-
rescue HTTPClient::KeepAliveDisconnected, HTTPClient::RetryableResponse => e
|
193
|
+
raise Ingenico::Connect::SDK::CommunicationException, e
|
194
|
+
rescue HTTPClient::KeepAliveDisconnected, HTTPClient::RetryableResponse => e # retry these?
|
153
195
|
log_error(request_id, start_time, e)
|
154
|
-
raise Ingenico::Connect::SDK::CommunicationException
|
155
|
-
rescue => e
|
196
|
+
raise Ingenico::Connect::SDK::CommunicationException, e
|
197
|
+
rescue StandardError => e
|
156
198
|
log_error(request_id, start_time, e)
|
157
|
-
raise Ingenico::Connect::SDK::CommunicationException
|
199
|
+
raise Ingenico::Connect::SDK::CommunicationException, e
|
158
200
|
end
|
159
|
-
|
160
|
-
log_response(request_id, response.status, start_time,
|
161
|
-
headers: response.headers, body: response.body,
|
162
|
-
content_type: response.content_type)
|
163
|
-
convert_to_sdk_response(response)
|
164
201
|
end
|
165
202
|
|
166
203
|
# logging code
|
@@ -169,10 +206,10 @@ module Ingenico::Connect::SDK
|
|
169
206
|
# Note that only one logger can be registered at a time and calling _enable_logging_
|
170
207
|
# a second time will override the old logger instance with the new one.
|
171
208
|
#
|
172
|
-
# communicator_logger
|
173
|
-
#
|
209
|
+
# @param communicator_logger [Ingenico::Connect::SDK::Logging::CommunicatorLogger] the communicator logger the requests and responses are logged to
|
174
210
|
def enable_logging(communicator_logger)
|
175
|
-
raise ArgumentError
|
211
|
+
raise ArgumentError, 'communicatorLogger is required' unless communicator_logger
|
212
|
+
|
176
213
|
@communicator_logger = communicator_logger
|
177
214
|
end
|
178
215
|
|
@@ -185,56 +222,163 @@ module Ingenico::Connect::SDK
|
|
185
222
|
|
186
223
|
# Converts a {Ingenico::Connect::SDK::RequestHeader} list headers to a hash
|
187
224
|
def convert_from_sdk_headers(headers)
|
188
|
-
headers.
|
225
|
+
headers.each_with_object({}) { |h, hash| hash[h.name] = h.value }
|
189
226
|
end
|
190
227
|
|
191
228
|
# Converts a hash to a {Ingenico::Connect::SDK::ResponseHeader} list
|
192
|
-
def
|
193
|
-
|
229
|
+
def convert_to_sdk_response_headers(headers)
|
230
|
+
arr ||= []
|
231
|
+
headers.each { |k, v| arr << Ingenico::Connect::SDK::ResponseHeader.new(k, v) }
|
232
|
+
arr
|
194
233
|
end
|
195
234
|
|
196
|
-
|
197
|
-
def convert_to_sdk_response(response)
|
198
|
-
Ingenico::Connect::SDK::Response.new(response.status,
|
199
|
-
response.body,
|
200
|
-
convert_to_sdk_headers(response.headers))
|
201
|
-
end
|
202
|
-
|
203
|
-
def log_request(requestId, method, uri, args={})
|
235
|
+
def log_request(request_id, method, uri, args = {})
|
204
236
|
return unless @communicator_logger
|
205
237
|
|
206
|
-
headers
|
207
|
-
|
238
|
+
headers = args[:headers]
|
239
|
+
body = args[:body]
|
240
|
+
content_type = args[:content_type]
|
241
|
+
log_msg_builder = Ingenico::Connect::SDK::Logging::RequestLogMessageBuilder.new(request_id, method, uri)
|
208
242
|
headers.each { |k, v| log_msg_builder.add_headers(k, v) } if headers
|
209
|
-
|
243
|
+
|
244
|
+
if binary?(headers)
|
245
|
+
log_msg_builder.set_body('<binary content>', content_type)
|
246
|
+
else
|
247
|
+
log_msg_builder.set_body(body, content_type)
|
248
|
+
end
|
210
249
|
|
211
250
|
begin
|
212
251
|
@communicator_logger.log(log_msg_builder.get_message)
|
213
|
-
rescue => e
|
214
|
-
@communicator_logger.log("An error occurred trying to log request #{
|
252
|
+
rescue StandardError => e
|
253
|
+
@communicator_logger.log("An error occurred trying to log request #{request_id}", e)
|
215
254
|
end
|
216
255
|
end
|
217
256
|
|
218
|
-
|
257
|
+
# Creates the log_response stream
|
258
|
+
# both based on whether or not it is binary and on the rest of the response
|
259
|
+
def log_response(request_id, status_code, start_time, args = {})
|
219
260
|
return unless @communicator_logger
|
220
261
|
|
221
|
-
duration
|
222
|
-
headers
|
223
|
-
|
224
|
-
|
225
|
-
|
262
|
+
duration = (Time.now - start_time) * 1000 # in milliseconds
|
263
|
+
headers = args[:headers]
|
264
|
+
body = args[:body] unless args[:body].nil?
|
265
|
+
content_type = args[:content_type]
|
266
|
+
|
267
|
+
log_msg_builder = Ingenico::Connect::SDK::Logging::ResponseLogMessageBuilder.new(request_id, status_code, duration)
|
268
|
+
unless headers.nil?
|
269
|
+
headers = convert_from_sdk_headers(headers)
|
270
|
+
headers.each do |key, value|
|
271
|
+
log_msg_builder.add_headers(key, value)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
if binary_content_type?(content_type)
|
276
|
+
log_msg_builder.set_body('<binary content>', content_type)
|
277
|
+
else
|
278
|
+
log_msg_builder.set_body(body, content_type)
|
279
|
+
end
|
226
280
|
|
227
281
|
begin
|
228
282
|
@communicator_logger.log(log_msg_builder.get_message)
|
229
|
-
rescue => e
|
230
|
-
@communicator_logger.log("An error occurred trying to log response #{
|
283
|
+
rescue StandardError => e
|
284
|
+
@communicator_logger.log("An error occurred trying to log response #{request_id}", e)
|
231
285
|
end
|
232
286
|
end
|
233
287
|
|
234
|
-
def log_error(
|
288
|
+
def log_error(request_id, start_time, thrown)
|
235
289
|
return unless @communicator_logger
|
290
|
+
|
236
291
|
duration = (Time.now - start_time) * 1000 # in millisecs
|
237
|
-
@communicator_logger.log("Error occurred for outgoing request (requestId='#{
|
292
|
+
@communicator_logger.log("Error occurred for outgoing request (requestId='#{request_id}', #{duration} ms)", thrown)
|
293
|
+
end
|
294
|
+
|
295
|
+
# @param headers [Hash]
|
296
|
+
def binary?(headers)
|
297
|
+
unless headers.nil?
|
298
|
+
content_type = nil
|
299
|
+
headers.each { |k, v| content_type = v if k.casecmp(CONTENT_TYPE).zero? }
|
300
|
+
|
301
|
+
binary_content_type?(content_type)
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
# @param content_type [String]
|
306
|
+
def binary_content_type?(content_type)
|
307
|
+
unless content_type.nil?
|
308
|
+
content_type = content_type.downcase
|
309
|
+
return !content_type.start_with?('text/') &&
|
310
|
+
!content_type.include?('json') &&
|
311
|
+
!content_type.include?('xml')
|
312
|
+
end
|
313
|
+
false
|
314
|
+
end
|
315
|
+
|
316
|
+
# Makes a request using the specified method
|
317
|
+
#
|
318
|
+
# Yields a status code, an array of {Ingenico::Connect::SDK::ResponseHeader},
|
319
|
+
# the content_type and body
|
320
|
+
def raw_request(method, uri, headers, body = nil)
|
321
|
+
connection = if body
|
322
|
+
@http_client.send(method + '_async', uri, body: body, header: headers)
|
323
|
+
else
|
324
|
+
@http_client.send(method + '_async', uri, header: headers)
|
325
|
+
end
|
326
|
+
|
327
|
+
response = connection.pop
|
328
|
+
pipe = response.content
|
329
|
+
response_headers = convert_to_sdk_response_headers(response.headers)
|
330
|
+
|
331
|
+
begin
|
332
|
+
yield response.status_code, response_headers, response.content_type, pipe
|
333
|
+
ensure
|
334
|
+
pipe.close
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
# Makes a request using the specified method
|
339
|
+
#
|
340
|
+
# Yields a status code, an array of {Ingenico::Connect::SDK::ResponseHeader},
|
341
|
+
# the content_type and body
|
342
|
+
def multipart_request(method, uri, headers, body = nil)
|
343
|
+
unless body.is_a? Ingenico::Connect::SDK::MultipartFormDataObject
|
344
|
+
raise ArgumentError, 'body should be a MultipartFormDataObject'
|
345
|
+
end
|
346
|
+
|
347
|
+
if method != 'post' && method != 'put'
|
348
|
+
raise ArgumentError, "method #{method} is not supported"
|
349
|
+
end
|
350
|
+
|
351
|
+
connection = @http_client.send method + '_async',
|
352
|
+
uri,
|
353
|
+
body: multipart_request_body(body),
|
354
|
+
header: headers
|
355
|
+
|
356
|
+
response = connection.pop
|
357
|
+
pipe = response.content
|
358
|
+
response_headers = convert_to_sdk_response_headers(response.headers)
|
359
|
+
|
360
|
+
begin
|
361
|
+
yield response.status_code, response_headers, response.content_type, pipe
|
362
|
+
ensure
|
363
|
+
pipe.close
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# Creates a request body for the multipart request
|
368
|
+
def multipart_request_body( body )
|
369
|
+
request_body = []
|
370
|
+
body.files.each do |k, v|
|
371
|
+
request_body.push :content => v.content,
|
372
|
+
'Content-Type' => v.content_type,
|
373
|
+
'Content-Disposition' => "form-data; name=\"#{k}\"; filename=\"#{v.file_name}\"",
|
374
|
+
'Content-Transfer-Encoding' => 'binary'
|
375
|
+
end
|
376
|
+
|
377
|
+
body.values.each do |k, v|
|
378
|
+
request_body << { :content => v,
|
379
|
+
'Content-Disposition' => "form-data; name=\"#{k}\"" }
|
380
|
+
end
|
381
|
+
request_body
|
238
382
|
end
|
239
383
|
end
|
240
384
|
end
|