direct-sdk-ruby 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +141 -0
- data/Rakefile +34 -0
- data/direct-sdk-ruby.gemspec +28 -0
- data/lib/ingenico/direct/sdk.rb +26 -0
- data/lib/ingenico/direct/sdk/api_exception.rb +42 -0
- data/lib/ingenico/direct/sdk/api_resource.rb +115 -0
- data/lib/ingenico/direct/sdk/authenticator.rb +16 -0
- data/lib/ingenico/direct/sdk/authorization_exception.rb +13 -0
- data/lib/ingenico/direct/sdk/call_context.rb +26 -0
- data/lib/ingenico/direct/sdk/client.rb +85 -0
- data/lib/ingenico/direct/sdk/communication_exception.rb +16 -0
- data/lib/ingenico/direct/sdk/communicator.rb +301 -0
- data/lib/ingenico/direct/sdk/communicator_configuration.rb +59 -0
- data/lib/ingenico/direct/sdk/connection.rb +41 -0
- data/lib/ingenico/direct/sdk/data_object.rb +32 -0
- data/lib/ingenico/direct/sdk/declined_payment_exception.rb +30 -0
- data/lib/ingenico/direct/sdk/declined_payout_exception.rb +32 -0
- data/lib/ingenico/direct/sdk/declined_refund_exception.rb +32 -0
- data/lib/ingenico/direct/sdk/declined_transaction_exception.rb +16 -0
- data/lib/ingenico/direct/sdk/defaultimpl.rb +6 -0
- data/lib/ingenico/direct/sdk/defaultimpl/authorization_type.rb +24 -0
- data/lib/ingenico/direct/sdk/defaultimpl/default_authenticator.rb +108 -0
- data/lib/ingenico/direct/sdk/defaultimpl/default_connection.rb +293 -0
- data/lib/ingenico/direct/sdk/defaultimpl/default_marshaller.rb +32 -0
- data/lib/ingenico/direct/sdk/direct_exception.rb +15 -0
- data/lib/ingenico/direct/sdk/domain/account_on_file.rb +50 -0
- data/lib/ingenico/direct/sdk/domain/account_on_file_attribute.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/account_on_file_display_hints.rb +38 -0
- data/lib/ingenico/direct/sdk/domain/additional_order_input.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/address.rb +51 -0
- data/lib/ingenico/direct/sdk/domain/address_personal.rb +59 -0
- data/lib/ingenico/direct/sdk/domain/airline_data.rb +129 -0
- data/lib/ingenico/direct/sdk/domain/airline_flight_leg.rb +99 -0
- data/lib/ingenico/direct/sdk/domain/airline_passenger.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/amount_breakdown.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/amount_of_money.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/api_error.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/browser_data.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/cancel_payment_response.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/capture.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/capture_output.rb +79 -0
- data/lib/ingenico/direct/sdk/domain/capture_payment_request.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/capture_response.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/capture_status_output.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/captures_response.rb +34 -0
- data/lib/ingenico/direct/sdk/domain/card.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/card_essentials.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/card_fraud_results.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/card_payment_method_specific_input.rb +95 -0
- data/lib/ingenico/direct/sdk/domain/card_payment_method_specific_input_base.rb +79 -0
- data/lib/ingenico/direct/sdk/domain/card_payment_method_specific_output.rb +67 -0
- data/lib/ingenico/direct/sdk/domain/card_payout_method_specific_input.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/card_recurrence_details.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/card_without_cvv.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/company_information.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/complete_payment_card_payment_method_specific_input.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/complete_payment_request.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/complete_payment_response.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/contact_details.rb +43 -0
- data/lib/ingenico/direct/sdk/domain/create_hosted_checkout_request.rb +63 -0
- data/lib/ingenico/direct/sdk/domain/create_hosted_checkout_response.rb +49 -0
- data/lib/ingenico/direct/sdk/domain/create_hosted_tokenization_request.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/create_hosted_tokenization_response.rb +41 -0
- data/lib/ingenico/direct/sdk/domain/create_payment_request.rb +67 -0
- data/lib/ingenico/direct/sdk/domain/create_payment_response.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/create_payout_request.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/create_token_request.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/created_payment_output.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/created_token_response.rb +51 -0
- data/lib/ingenico/direct/sdk/domain/customer.rb +87 -0
- data/lib/ingenico/direct/sdk/domain/customer_account.rb +71 -0
- data/lib/ingenico/direct/sdk/domain/customer_account_authentication.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/customer_device.rb +51 -0
- data/lib/ingenico/direct/sdk/domain/customer_payment_activity.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/customer_token.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/decrypted_payment_data.rb +43 -0
- data/lib/ingenico/direct/sdk/domain/directory_entry.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/empty_validator.rb +13 -0
- data/lib/ingenico/direct/sdk/domain/error_response.rb +38 -0
- data/lib/ingenico/direct/sdk/domain/external_cardholder_authentication_data.rb +59 -0
- data/lib/ingenico/direct/sdk/domain/external_token_linked.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/fixed_list_validator.rb +33 -0
- data/lib/ingenico/direct/sdk/domain/fraud_fields.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/fraud_results.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/g_pay_three_d_secure.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/get_hosted_checkout_response.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/get_hosted_tokenization_response.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/get_payment_product_groups_response.rb +34 -0
- data/lib/ingenico/direct/sdk/domain/get_payment_products_response.rb +34 -0
- data/lib/ingenico/direct/sdk/domain/gift_card_purchase.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/hosted_checkout_specific_input.rb +55 -0
- data/lib/ingenico/direct/sdk/domain/hosted_checkout_specific_output.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/label_template_element.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/length_validator.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/line_item.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/line_item_invoice_data.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/loan_recipient.rb +43 -0
- data/lib/ingenico/direct/sdk/domain/merchant_action.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/mobile_payment_data.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/mobile_payment_method_specific_input.rb +63 -0
- data/lib/ingenico/direct/sdk/domain/mobile_payment_method_specific_output.rb +59 -0
- data/lib/ingenico/direct/sdk/domain/mobile_payment_product320_specific_input.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/order.rb +71 -0
- data/lib/ingenico/direct/sdk/domain/order_line_details.rb +55 -0
- data/lib/ingenico/direct/sdk/domain/order_references.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/order_status_output.rb +50 -0
- data/lib/ingenico/direct/sdk/domain/order_type_information.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/payment_account_on_file.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/payment_creation_output.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/payment_error_response.rb +46 -0
- data/lib/ingenico/direct/sdk/domain/payment_output.rb +79 -0
- data/lib/ingenico/direct/sdk/domain/payment_product.rb +77 -0
- data/lib/ingenico/direct/sdk/domain/payment_product5100_specific_input.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/payment_product5402_specific_output.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/payment_product5500_specific_output.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/payment_product771_specific_output.rb +13 -0
- data/lib/ingenico/direct/sdk/domain/payment_product840_customer_account.rb +55 -0
- data/lib/ingenico/direct/sdk/domain/payment_product840_specific_output.rb +54 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_display_hints.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_field.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_field_data_restrictions.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_field_display_element.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_field_display_hints.rb +71 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_field_form_element.rb +38 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_field_tooltip.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_field_validators.rb +91 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_filter.rb +43 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_filters_hosted_checkout.rb +38 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_group.rb +43 -0
- data/lib/ingenico/direct/sdk/domain/payment_product_networks_response.rb +33 -0
- data/lib/ingenico/direct/sdk/domain/payment_references.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/payment_response.rb +55 -0
- data/lib/ingenico/direct/sdk/domain/payment_status_output.rb +58 -0
- data/lib/ingenico/direct/sdk/domain/payout_error_response.rb +46 -0
- data/lib/ingenico/direct/sdk/domain/payout_output.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/payout_response.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/payout_result.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/payout_status_output.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/personal_information.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/personal_information_token.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/personal_name.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/personal_name_token.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/product_directory.rb +34 -0
- data/lib/ingenico/direct/sdk/domain/protection_eligibility.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/range_validator.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/redirect_data.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/redirect_payment_method_specific_input.rb +67 -0
- data/lib/ingenico/direct/sdk/domain/redirect_payment_method_specific_output.rb +67 -0
- data/lib/ingenico/direct/sdk/domain/redirect_payment_product809_specific_input.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/redirect_payment_product840_specific_input.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/redirection_data.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/refund_card_method_specific_output.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/refund_e_wallet_method_specific_output.rb +39 -0
- data/lib/ingenico/direct/sdk/domain/refund_error_response.rb +46 -0
- data/lib/ingenico/direct/sdk/domain/refund_mobile_method_specific_output.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/refund_output.rb +79 -0
- data/lib/ingenico/direct/sdk/domain/refund_payment_product840_customer_account.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/refund_payment_product840_specific_output.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/refund_redirect_method_specific_output.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/refund_request.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/refund_response.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/refunds_response.rb +34 -0
- data/lib/ingenico/direct/sdk/domain/regular_expression_validator.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/sepa_direct_debit_payment_method_specific_output.rb +43 -0
- data/lib/ingenico/direct/sdk/domain/session_request.rb +33 -0
- data/lib/ingenico/direct/sdk/domain/session_response.rb +49 -0
- data/lib/ingenico/direct/sdk/domain/shipping.rb +51 -0
- data/lib/ingenico/direct/sdk/domain/shopping_cart.rb +65 -0
- data/lib/ingenico/direct/sdk/domain/shopping_cart_extension.rb +52 -0
- data/lib/ingenico/direct/sdk/domain/test_connection.rb +27 -0
- data/lib/ingenico/direct/sdk/domain/three_d_secure.rb +63 -0
- data/lib/ingenico/direct/sdk/domain/three_d_secure_base.rb +47 -0
- data/lib/ingenico/direct/sdk/domain/three_d_secure_data.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/three_d_secure_results.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/token_card.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/token_card_data.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/token_card_specific_input.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/token_data.rb +31 -0
- data/lib/ingenico/direct/sdk/domain/token_e_wallet.rb +35 -0
- data/lib/ingenico/direct/sdk/domain/token_response.rb +55 -0
- data/lib/ingenico/direct/sdk/domain/value_mapping_element.rb +38 -0
- data/lib/ingenico/direct/sdk/endpoint_configuration.rb +127 -0
- data/lib/ingenico/direct/sdk/exceptions.rb +8 -0
- data/lib/ingenico/direct/sdk/factory.rb +136 -0
- data/lib/ingenico/direct/sdk/idempotence_exception.rb +24 -0
- data/lib/ingenico/direct/sdk/logging.rb +10 -0
- data/lib/ingenico/direct/sdk/logging/communicator_logger.rb +22 -0
- data/lib/ingenico/direct/sdk/logging/log_message_builder.rb +56 -0
- data/lib/ingenico/direct/sdk/logging/logging_capable.rb +19 -0
- data/lib/ingenico/direct/sdk/logging/logging_util.rb +271 -0
- data/lib/ingenico/direct/sdk/logging/request_log_message_builder.rb +39 -0
- data/lib/ingenico/direct/sdk/logging/response_log_message_builder.rb +34 -0
- data/lib/ingenico/direct/sdk/logging/ruby_communicator_logger.rb +57 -0
- data/lib/ingenico/direct/sdk/logging/stdout_communicator_logger.rb +34 -0
- data/lib/ingenico/direct/sdk/marshaller.rb +24 -0
- data/lib/ingenico/direct/sdk/marshaller_syntax_exception.rb +6 -0
- data/lib/ingenico/direct/sdk/merchant/hostedcheckout/hosted_checkout_client.rb +87 -0
- data/lib/ingenico/direct/sdk/merchant/hostedtokenization/hosted_tokenization_client.rb +87 -0
- data/lib/ingenico/direct/sdk/merchant/merchant_client.rb +83 -0
- data/lib/ingenico/direct/sdk/merchant/payments/payments_client.rb +291 -0
- data/lib/ingenico/direct/sdk/merchant/payouts/payouts_client.rb +87 -0
- data/lib/ingenico/direct/sdk/merchant/productgroups/get_product_group_params.rb +58 -0
- data/lib/ingenico/direct/sdk/merchant/productgroups/get_product_groups_params.rb +58 -0
- data/lib/ingenico/direct/sdk/merchant/productgroups/product_groups_client.rb +88 -0
- data/lib/ingenico/direct/sdk/merchant/products/get_payment_product_networks_params.rb +39 -0
- data/lib/ingenico/direct/sdk/merchant/products/get_payment_product_params.rb +58 -0
- data/lib/ingenico/direct/sdk/merchant/products/get_payment_products_params.rb +58 -0
- data/lib/ingenico/direct/sdk/merchant/products/get_product_directory_params.rb +31 -0
- data/lib/ingenico/direct/sdk/merchant/products/products_client.rb +156 -0
- data/lib/ingenico/direct/sdk/merchant/services/services_client.rb +52 -0
- data/lib/ingenico/direct/sdk/merchant/sessions/sessions_client.rb +55 -0
- data/lib/ingenico/direct/sdk/merchant/tokens/tokens_client.rb +117 -0
- data/lib/ingenico/direct/sdk/meta_data_provider.rb +150 -0
- data/lib/ingenico/direct/sdk/modules.rb +71 -0
- data/lib/ingenico/direct/sdk/not_found_exception.rb +16 -0
- data/lib/ingenico/direct/sdk/param_request.rb +11 -0
- data/lib/ingenico/direct/sdk/pooled_connection.rb +21 -0
- data/lib/ingenico/direct/sdk/proxy_configuration.rb +74 -0
- data/lib/ingenico/direct/sdk/reference_exception.rb +14 -0
- data/lib/ingenico/direct/sdk/request_header.rb +50 -0
- data/lib/ingenico/direct/sdk/request_param.rb +23 -0
- data/lib/ingenico/direct/sdk/response_exception.rb +47 -0
- data/lib/ingenico/direct/sdk/response_header.rb +42 -0
- data/lib/ingenico/direct/sdk/validation_exception.rb +14 -0
- data/lib/ingenico/direct/sdk/webhooks.rb +11 -0
- data/lib/ingenico/direct/sdk/webhooks/api_version_mismatch_exception.rb +20 -0
- data/lib/ingenico/direct/sdk/webhooks/in_memory_secret_key_store.rb +56 -0
- data/lib/ingenico/direct/sdk/webhooks/secret_key_not_available_exception.rb +17 -0
- data/lib/ingenico/direct/sdk/webhooks/secret_key_store.rb +16 -0
- data/lib/ingenico/direct/sdk/webhooks/signature_validation_exception.rb +19 -0
- data/lib/ingenico/direct/sdk/webhooks/webhooks.rb +22 -0
- data/lib/ingenico/direct/sdk/webhooks/webhooks_event.rb +58 -0
- data/lib/ingenico/direct/sdk/webhooks/webhooks_helper.rb +99 -0
- data/lib/ingenico/direct/sdk/webhooks/webhooks_helper_builder.rb +25 -0
- metadata +385 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This class was auto-generated from the API references found at
|
|
3
|
+
# https://support.direct.ingenico.com/documentation/api/reference/
|
|
4
|
+
#
|
|
5
|
+
require 'ingenico/direct/sdk/api_resource'
|
|
6
|
+
require 'ingenico/direct/sdk/response_exception'
|
|
7
|
+
require 'ingenico/direct/sdk/domain/error_response'
|
|
8
|
+
require 'ingenico/direct/sdk/domain/session_request'
|
|
9
|
+
require 'ingenico/direct/sdk/domain/session_response'
|
|
10
|
+
|
|
11
|
+
module Ingenico::Direct::SDK
|
|
12
|
+
module Merchant
|
|
13
|
+
module Sessions
|
|
14
|
+
|
|
15
|
+
# Sessions client. Thread-safe.
|
|
16
|
+
class SessionsClient < Ingenico::Direct::SDK::ApiResource
|
|
17
|
+
|
|
18
|
+
# @param parent [Ingenico::Direct::SDK::ApiResource]
|
|
19
|
+
# @param path_context [Hash, nil]
|
|
20
|
+
def initialize(parent, path_context = nil)
|
|
21
|
+
super(parent, path_context)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Resource /v2/!{merchantId}/sessions - {https://support.direct.ingenico.com/documentation/api/reference#operation/CreateSessionApi Create session}
|
|
25
|
+
# @param body [Ingenico::Direct::SDK::Domain::SessionRequest]
|
|
26
|
+
# @param context [Ingenico::Direct::SDK::CallContext]
|
|
27
|
+
# @return [Ingenico::Direct::SDK::Domain::SessionResponse]
|
|
28
|
+
# @raise [Ingenico::Direct::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
|
|
29
|
+
# @raise [Ingenico::Direct::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
|
|
30
|
+
# @raise [Ingenico::Direct::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
|
|
31
|
+
# @raise [Ingenico::Direct::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
|
|
32
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
|
33
|
+
# @raise [Ingenico::Direct::SDK::GlobalCollectException] if something went wrong at the Ingenico ePayments platform,
|
|
34
|
+
# the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
|
|
35
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
|
36
|
+
# @raise [Ingenico::Direct::SDK::ApiException]if the Ingenico ePayments platform returned any other error
|
|
37
|
+
def create_session(body, context = nil)
|
|
38
|
+
uri = instantiate_uri('/v2/{merchantId}/sessions')
|
|
39
|
+
@communicator.post(
|
|
40
|
+
uri,
|
|
41
|
+
client_headers,
|
|
42
|
+
nil,
|
|
43
|
+
body,
|
|
44
|
+
Ingenico::Direct::SDK::Domain::SessionResponse,
|
|
45
|
+
context
|
|
46
|
+
)
|
|
47
|
+
rescue ResponseException => e
|
|
48
|
+
error_type = Ingenico::Direct::SDK::Domain::ErrorResponse
|
|
49
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
|
50
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This class was auto-generated from the API references found at
|
|
3
|
+
# https://support.direct.ingenico.com/documentation/api/reference/
|
|
4
|
+
#
|
|
5
|
+
require 'ingenico/direct/sdk/api_resource'
|
|
6
|
+
require 'ingenico/direct/sdk/response_exception'
|
|
7
|
+
require 'ingenico/direct/sdk/domain/create_token_request'
|
|
8
|
+
require 'ingenico/direct/sdk/domain/created_token_response'
|
|
9
|
+
require 'ingenico/direct/sdk/domain/error_response'
|
|
10
|
+
require 'ingenico/direct/sdk/domain/token_response'
|
|
11
|
+
|
|
12
|
+
module Ingenico::Direct::SDK
|
|
13
|
+
module Merchant
|
|
14
|
+
module Tokens
|
|
15
|
+
|
|
16
|
+
# Tokens client. Thread-safe.
|
|
17
|
+
class TokensClient < Ingenico::Direct::SDK::ApiResource
|
|
18
|
+
|
|
19
|
+
# @param parent [Ingenico::Direct::SDK::ApiResource]
|
|
20
|
+
# @param path_context [Hash, nil]
|
|
21
|
+
def initialize(parent, path_context = nil)
|
|
22
|
+
super(parent, path_context)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Resource /v2/!{merchantId}/tokens - {https://support.direct.ingenico.com/documentation/api/reference#operation/CreateTokenApi Create token}
|
|
26
|
+
# @param body [Ingenico::Direct::SDK::Domain::CreateTokenRequest]
|
|
27
|
+
# @param context [Ingenico::Direct::SDK::CallContext]
|
|
28
|
+
# @return [Ingenico::Direct::SDK::Domain::CreatedTokenResponse]
|
|
29
|
+
# @raise [Ingenico::Direct::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
|
|
30
|
+
# @raise [Ingenico::Direct::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
|
|
31
|
+
# @raise [Ingenico::Direct::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
|
|
32
|
+
# @raise [Ingenico::Direct::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
|
|
33
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
|
34
|
+
# @raise [Ingenico::Direct::SDK::GlobalCollectException] if something went wrong at the Ingenico ePayments platform,
|
|
35
|
+
# the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
|
|
36
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
|
37
|
+
# @raise [Ingenico::Direct::SDK::ApiException]if the Ingenico ePayments platform returned any other error
|
|
38
|
+
def create_token(body, context = nil)
|
|
39
|
+
uri = instantiate_uri('/v2/{merchantId}/tokens')
|
|
40
|
+
@communicator.post(
|
|
41
|
+
uri,
|
|
42
|
+
client_headers,
|
|
43
|
+
nil,
|
|
44
|
+
body,
|
|
45
|
+
Ingenico::Direct::SDK::Domain::CreatedTokenResponse,
|
|
46
|
+
context
|
|
47
|
+
)
|
|
48
|
+
rescue ResponseException => e
|
|
49
|
+
error_type = Ingenico::Direct::SDK::Domain::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 /v2/!{merchantId}/tokens/!{tokenId} - {https://support.direct.ingenico.com/documentation/api/reference#operation/GetTokenApi Get token}
|
|
55
|
+
# @param token_id [String]
|
|
56
|
+
# @param context [Ingenico::Direct::SDK::CallContext]
|
|
57
|
+
# @return [Ingenico::Direct::SDK::Domain::TokenResponse]
|
|
58
|
+
# @raise [Ingenico::Direct::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
|
|
59
|
+
# @raise [Ingenico::Direct::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
|
|
60
|
+
# @raise [Ingenico::Direct::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
|
|
61
|
+
# @raise [Ingenico::Direct::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
|
|
62
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
|
63
|
+
# @raise [Ingenico::Direct::SDK::GlobalCollectException] if something went wrong at the Ingenico ePayments platform,
|
|
64
|
+
# the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
|
|
65
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
|
66
|
+
# @raise [Ingenico::Direct::SDK::ApiException]if the Ingenico ePayments platform returned any other error
|
|
67
|
+
def get_token(token_id, context = nil)
|
|
68
|
+
path_context = {
|
|
69
|
+
'tokenId'.freeze => token_id,
|
|
70
|
+
}
|
|
71
|
+
uri = instantiate_uri('/v2/{merchantId}/tokens/{tokenId}', path_context)
|
|
72
|
+
@communicator.get(
|
|
73
|
+
uri,
|
|
74
|
+
client_headers,
|
|
75
|
+
nil,
|
|
76
|
+
Ingenico::Direct::SDK::Domain::TokenResponse,
|
|
77
|
+
context
|
|
78
|
+
)
|
|
79
|
+
rescue ResponseException => e
|
|
80
|
+
error_type = Ingenico::Direct::SDK::Domain::ErrorResponse
|
|
81
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
|
82
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Resource /v2/!{merchantId}/tokens/!{tokenId} - {https://support.direct.ingenico.com/documentation/api/reference#operation/DeleteTokenApi Delete token}
|
|
86
|
+
# @param token_id [String]
|
|
87
|
+
# @param context [Ingenico::Direct::SDK::CallContext]
|
|
88
|
+
# @raise [Ingenico::Direct::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
|
|
89
|
+
# @raise [Ingenico::Direct::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
|
|
90
|
+
# @raise [Ingenico::Direct::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
|
|
91
|
+
# @raise [Ingenico::Direct::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
|
|
92
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
|
93
|
+
# @raise [Ingenico::Direct::SDK::GlobalCollectException] if something went wrong at the Ingenico ePayments platform,
|
|
94
|
+
# the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
|
|
95
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
|
96
|
+
# @raise [Ingenico::Direct::SDK::ApiException]if the Ingenico ePayments platform returned any other error
|
|
97
|
+
def delete_token(token_id, context = nil)
|
|
98
|
+
path_context = {
|
|
99
|
+
'tokenId'.freeze => token_id,
|
|
100
|
+
}
|
|
101
|
+
uri = instantiate_uri('/v2/{merchantId}/tokens/{tokenId}', path_context)
|
|
102
|
+
@communicator.delete(
|
|
103
|
+
uri,
|
|
104
|
+
client_headers,
|
|
105
|
+
nil,
|
|
106
|
+
nil,
|
|
107
|
+
context
|
|
108
|
+
)
|
|
109
|
+
rescue ResponseException => e
|
|
110
|
+
error_type = Ingenico::Direct::SDK::Domain::ErrorResponse
|
|
111
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
|
112
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
require 'ingenico/direct/sdk/domain/shopping_cart_extension'
|
|
2
|
+
require 'base64'
|
|
3
|
+
|
|
4
|
+
module Ingenico::Direct::SDK
|
|
5
|
+
|
|
6
|
+
# Manages metadata about the server using the SDK
|
|
7
|
+
#
|
|
8
|
+
# @attr_reader [Array<Ingenico::Direct::SDK::RequestHeader>] meta_data_headers List of headers that should be used in all requests.
|
|
9
|
+
class MetaDataProvider
|
|
10
|
+
SDK_VERSION = '0.0.1'.freeze
|
|
11
|
+
SERVER_META_INFO_HEADER = 'X-GCS-ServerMetaInfo'.freeze
|
|
12
|
+
PROHIBITED_HEADERS = [SERVER_META_INFO_HEADER,
|
|
13
|
+
'X-GCS-Idempotence-Key', 'Date', 'Content-Type', 'Authorization'].sort!.freeze
|
|
14
|
+
CHARSET = 'utf-8'.freeze
|
|
15
|
+
|
|
16
|
+
# Stores metadata about the server so it can be sent to the Ingenico ePayments platform
|
|
17
|
+
class ServerMetaInfo < DataObject
|
|
18
|
+
@platform_identifier = nil
|
|
19
|
+
@sdk_identifier = nil
|
|
20
|
+
@sdk_creator = nil
|
|
21
|
+
@integrator = nil
|
|
22
|
+
@shopping_cart_extension = nil
|
|
23
|
+
|
|
24
|
+
# String containing system information (Operating system and Ruby version).
|
|
25
|
+
attr_accessor :platform_identifier
|
|
26
|
+
|
|
27
|
+
# String containing this SDK version.
|
|
28
|
+
attr_accessor :sdk_identifier
|
|
29
|
+
|
|
30
|
+
attr_accessor :sdk_creator
|
|
31
|
+
|
|
32
|
+
attr_accessor :integrator
|
|
33
|
+
|
|
34
|
+
attr_accessor :shopping_cart_extension
|
|
35
|
+
|
|
36
|
+
# Returns the values of all attributes as a hash.
|
|
37
|
+
def to_h
|
|
38
|
+
hash = super
|
|
39
|
+
hash['platformIdentifier'] = @platform_identifier if @platform_identifier
|
|
40
|
+
hash['sdkIdentifier'] = @sdk_identifier if @sdk_identifier
|
|
41
|
+
hash['sdkCreator'] = @sdk_creator if @sdk_creator
|
|
42
|
+
hash['integrator'] = @integrator if @integrator
|
|
43
|
+
hash['shoppingCartExtension'] = @shopping_cart_extension.to_h if @shopping_cart_extension
|
|
44
|
+
hash
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Initializes the ServerMetaInfo object with properties stored in the parameter hash
|
|
48
|
+
def from_hash(hash)
|
|
49
|
+
super
|
|
50
|
+
@platform_identifier = hash['platformIdentifier'] if hash.has_key? 'platformIdentifier'
|
|
51
|
+
@sdk_identifier = hash['sdkIdentifier'] if hash.has_key? 'sdkIdentifier'
|
|
52
|
+
@sdk_creator = hash['sdkCreator'] if hash.has_key? 'sdkCreator'
|
|
53
|
+
@integrator = hash['integrator'] if hash.has_key? 'integrator'
|
|
54
|
+
@shopping_cart_extension = Domain::ShoppingCartExtension.new_from_hash(hash['shoppingCartExtension']) if hash.has_key? 'shoppingCartExtension'
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Create a new MetaDataProvider instance that can be used to access platform-related information
|
|
59
|
+
#
|
|
60
|
+
# @param integrator [String] Name of the integrator
|
|
61
|
+
# @param shopping_cart_extension [Ingenico::Direct::SDK::Domain::ShoppingCartExtension] shopping cart-related metadata.
|
|
62
|
+
# @param additional_request_headers [Array<Ingenico::Direct::SDK::RequestHeader>] list of additional headers to include in all requests made.
|
|
63
|
+
# The following headers are not allowed due to conflicts with already added headers:
|
|
64
|
+
# 'X-GCS-Idempotence-Key', 'Date', 'Content-Type', 'Authorization' and 'X-GCS-ServerMetaInfo'
|
|
65
|
+
def initialize(integrator, shopping_cart_extension: nil, additional_request_headers: [].freeze)
|
|
66
|
+
|
|
67
|
+
MetaDataProvider.validate_additional_request_headers(additional_request_headers)
|
|
68
|
+
server_meta_info = ServerMetaInfo.new
|
|
69
|
+
server_meta_info.platform_identifier = get_platform_identifier
|
|
70
|
+
server_meta_info.sdk_identifier = get_sdk_identifier
|
|
71
|
+
server_meta_info.sdk_creator = 'Ingenico'
|
|
72
|
+
server_meta_info.integrator = integrator
|
|
73
|
+
server_meta_info.shopping_cart_extension = shopping_cart_extension if shopping_cart_extension
|
|
74
|
+
server_meta_info_string = DefaultImpl::DefaultMarshaller.INSTANCE.marshal(server_meta_info)
|
|
75
|
+
server_meta_info_header = RequestHeader.new(
|
|
76
|
+
SERVER_META_INFO_HEADER,
|
|
77
|
+
Base64.strict_encode64(server_meta_info_string.force_encoding('iso-8859-1').encode(CHARSET)))
|
|
78
|
+
if additional_request_headers.nil? || additional_request_headers.empty?
|
|
79
|
+
@meta_data_headers = [server_meta_info_header].freeze
|
|
80
|
+
else
|
|
81
|
+
request_headers = [server_meta_info_header]
|
|
82
|
+
request_headers += additional_request_headers
|
|
83
|
+
@meta_data_headers = request_headers.freeze
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Checks that none of the {Ingenico::Direct::SDK::RequestHeaders} in _additional_request_headers_ is equal to any of the forbidden headers.
|
|
88
|
+
# The forbidden headers are:
|
|
89
|
+
#'X-GCS-Idempotence-Key', 'Date', 'Content-Type', 'Authorization' and 'X-GCS-ServerMetaInfo'
|
|
90
|
+
# If a header is found that is equal to one of the forbidden headers an ArgumentError is raised.
|
|
91
|
+
def self.validate_additional_request_headers(additional_request_headers)
|
|
92
|
+
if additional_request_headers
|
|
93
|
+
additional_request_headers.each { |additional_request_header|
|
|
94
|
+
validate_additional_request_header(additional_request_header)
|
|
95
|
+
}
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Checks that the {Ingenico::Direct::SDK::RequestHeaders} _additional_request_header_ is equal to any of the forbidden headers.
|
|
100
|
+
# The forbidden headers are:
|
|
101
|
+
#'X-GCS-Idempotence-Key', 'Date', 'Content-Type', 'Authorization' and 'X-GCS-ServerMetaInfo'
|
|
102
|
+
# If the header is equal to one of the forbidden headers an ArgumentError is raised.
|
|
103
|
+
def self.validate_additional_request_header(additional_request_header)
|
|
104
|
+
if MetaDataProvider.PROHIBITED_HEADERS.include? additional_request_header.name
|
|
105
|
+
raise ArgumentError, "request header '#{additional_request_header.name}' not allowed"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
protected
|
|
110
|
+
|
|
111
|
+
# String containing information of the system using the SDK.
|
|
112
|
+
# It contains data like Operating System version and Ruby version
|
|
113
|
+
def get_platform_identifier
|
|
114
|
+
os_host = RbConfig::CONFIG['host_os']
|
|
115
|
+
if os_host.include? 'mingw'
|
|
116
|
+
s = 'Windows'
|
|
117
|
+
elsif os_host.include? 'linux'
|
|
118
|
+
s = 'Linux'
|
|
119
|
+
else
|
|
120
|
+
s = 'Mac OS X'
|
|
121
|
+
end
|
|
122
|
+
"#{s}/#{RUBY_DESCRIPTION}"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# String describing the version of the SDK being used
|
|
126
|
+
def get_sdk_identifier
|
|
127
|
+
"RubyServerSDK/v#{SDK_VERSION}"
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
public
|
|
131
|
+
|
|
132
|
+
# Version of this SDK being used
|
|
133
|
+
def self.SDK_VERSION
|
|
134
|
+
SDK_VERSION
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# A {Ingenico::Direct::SDK::RequestHeader} that contains serialized and encoded {Ingenico::Direct::SDK::MetaDataProvider::ServerMetaInfo}.
|
|
138
|
+
def self.SERVER_META_INFO_HEADER
|
|
139
|
+
SERVER_META_INFO_HEADER
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# A list of header names that should not be used by any added headers.
|
|
143
|
+
# These headers are reserved for specific purposes.
|
|
144
|
+
def self.PROHIBITED_HEADERS
|
|
145
|
+
PROHIBITED_HEADERS
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
attr_reader :meta_data_headers
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Main module of this SDK. All non-data classes that are used at multiple places in the SDK are placed in this module.
|
|
2
|
+
module Ingenico::Direct::SDK
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
# Contains provided implementations for abstract functionality in this SDK.
|
|
6
|
+
# These implementations can be replaced or adapted if desired to suit specific needs.
|
|
7
|
+
module Ingenico::Direct::SDK::DefaultImpl
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Container for all data-containing modules.
|
|
11
|
+
# The data-classes contained within can be serialized and communicated with the Ingenico ePayments platform.
|
|
12
|
+
# These classes generally contain data used in processing requests or responses.
|
|
13
|
+
module Ingenico::Direct::SDK::Domain
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Contains all logging-related classes.
|
|
17
|
+
module Ingenico::Direct::SDK::Logging
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Contains interfaces to all Direct services. These services are accessed through a *Ingenico::Direct::SDK::Client* instance.
|
|
21
|
+
module Ingenico::Direct::SDK::Merchant
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Contains the client used to access the Hosted Checkout service.
|
|
25
|
+
# @see https://support.direct.ingenico.com/documentation/api/reference/index.html#tag/HostedCheckout/
|
|
26
|
+
module Ingenico::Direct::SDK::Merchant::HostedCheckout
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Contains the client used to access the Hosted Tokenization service.
|
|
30
|
+
# @see https://support.direct.ingenico.com/documentation/api/reference/index.html#tag/HostedTokenization/
|
|
31
|
+
module Ingenico::Direct::SDK::Merchant::HostedTokenization
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Contains the client used to access the Payment service.
|
|
35
|
+
# @see https://support.direct.ingenico.com/documentation/api/reference/index.html#tag/Payments/
|
|
36
|
+
module Ingenico::Direct::SDK::Merchant::Payments
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Contains the client used to access the Payout service.
|
|
40
|
+
# @see https://support.direct.ingenico.com/documentation/api/reference/index.html#tag/Payouts/
|
|
41
|
+
module Ingenico::Direct::SDK::Merchant::Payouts
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Contains the client used to access the Product Groups service.
|
|
45
|
+
# @see https://support.direct.ingenico.com/documentation/api/reference/index.html#tag/ProductGroups/
|
|
46
|
+
module Ingenico::Direct::SDK::Merchant::ProductGroups
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Contains the client used to access the Products service.
|
|
50
|
+
# @see https://support.direct.ingenico.com/documentation/api/reference/index.html#tag/Products/
|
|
51
|
+
module Ingenico::Direct::SDK::Merchant::Products
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Contains the client to access miscellaneous services.
|
|
55
|
+
# @see https://support.direct.ingenico.com/documentation/api/reference/index.html#tag/Services/
|
|
56
|
+
module Ingenico::Direct::SDK::Merchant::Services
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Contains the client used to access the Sessions service.
|
|
60
|
+
# @see https://support.direct.ingenico.com/documentation/api/reference/index.html#tag/Sessions/
|
|
61
|
+
module Ingenico::Direct::SDK::Merchant::Sessions
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Contains the client used to access the Tokens service.
|
|
65
|
+
# @see https://support.direct.ingenico.com/documentation/api/reference/index.html#tag/Tokens/
|
|
66
|
+
module Ingenico::Direct::SDK::Merchant::Tokens
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Contains data classes related to Webhooks functionality.
|
|
70
|
+
module Ingenico::Direct::SDK::Webhooks
|
|
71
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Ingenico::Direct::SDK
|
|
2
|
+
|
|
3
|
+
# Raised when a resource is not found on the Ingenico ePayments platform.
|
|
4
|
+
# This error corresponds to a 404 HTTP response.
|
|
5
|
+
#
|
|
6
|
+
# @attr [Exception] cause The error that is the cause of this error.
|
|
7
|
+
class NotFoundException < RuntimeError
|
|
8
|
+
|
|
9
|
+
def initialize(cause, message = nil)
|
|
10
|
+
super(message)
|
|
11
|
+
@cause = cause
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
attr_accessor :cause
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Ingenico::Direct::SDK
|
|
2
|
+
|
|
3
|
+
# Class that represents the URL request parameters.
|
|
4
|
+
# Contains a method to add a name and value pair to a parameter array as a {Ingenico::Direct::SDK::RequestParam}.
|
|
5
|
+
class ParamRequest
|
|
6
|
+
# @return [Array<Ingenico::Direct::SDK::RequestParam>]
|
|
7
|
+
def to_request_parameters
|
|
8
|
+
raise NotImplementedError
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Ingenico::Direct::SDK
|
|
2
|
+
|
|
3
|
+
# {Ingenico::Direct::SDK::Connection} that supports connection pooling. This is used to more efficiently communicate using HTTP.
|
|
4
|
+
# Connection pooling means that a number of connections are kept alive after use so they can possibly be reused.
|
|
5
|
+
# If the Connection does not do so automatically,
|
|
6
|
+
# the methods _close_idle_connections_ and _close_expired_connections_ can be used to drop connections
|
|
7
|
+
# that are idle for a specified amount of time or that have expired.
|
|
8
|
+
# @see Ingenico::Direct::SDK::DefaultImpl::DefaultConnection
|
|
9
|
+
class PooledConnection < Connection
|
|
10
|
+
|
|
11
|
+
# Closes all connections that have not been used for _idle_time_ seconds.
|
|
12
|
+
def close_idle_connections(idle_time)
|
|
13
|
+
raise NotImplementedError
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Closes all connections that have expired.
|
|
17
|
+
def close_expired_connections
|
|
18
|
+
raise NotImplementedError
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|