connect-sdk-ruby 2.20.0 → 2.21.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/example_configuration.yml +1 -1
- data/lib/ingenico/connect/sdk/api_resource.rb +2 -2
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input.rb +9 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_product4101_specific_input.rb +39 -0
- data/lib/ingenico/connect/sdk/domain/payment/sdk_data_input.rb +2 -0
- data/lib/ingenico/connect/sdk/factory.rb +15 -15
- data/lib/ingenico/connect/sdk/meta_data_provider.rb +1 -1
- data/lib/ingenico/connect/sdk/modules.rb +1 -1
- data/spec/fixtures/resources/properties.proxy.yml +3 -3
- data/spec/fixtures/resources/properties.yml +1 -1
- data/spec/integration/sdk_proxy_spec.rb +3 -2
- data/spec/integration_setup.rb +1 -1
- data/spec/lib/communicator_configuration_spec.rb +20 -20
- data/spec/lib/communicator_spec.rb +4 -4
- data/spec/lib/defaultimpl/default_connection_idempotence_spec.rb +7 -8
- data/spec/lib/defaultimpl/default_connection_logger_spec.rb +17 -17
- data/spec/lib/factory_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b5b8f7aa27fc0820c2821ad162c634a592a1aeb3582582120b2c1bcae1c3d0f
|
4
|
+
data.tar.gz: d4df76e3c026c6ae17ae7285e9c990e7bd66d5fc6d8c7c0b019bd48623dc5a0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f1cf43dc3464e888c01c5e412fb28fa3b15795dc396e5275b070d8e6f6ebe580be09bdccff9101a5d08b94c766102251cc8d105557811a46add9f608787781b
|
7
|
+
data.tar.gz: 7954b53ff1e3e4ee765fb036e67e64f0df73378184607ee5378cf10f127b19d49639b6e249d83ff59694873845d4cb1d9a7cb1aaa14cfa35bb7d949ea1ce05f5
|
data/connect-sdk-ruby.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'connect-sdk-ruby'
|
3
|
-
spec.version = '2.
|
3
|
+
spec.version = '2.21.0'
|
4
4
|
spec.authors = ['Ingenico ePayments']
|
5
5
|
spec.email = ['github@epay.ingenico.com']
|
6
6
|
spec.summary = %q{SDK to communicate with the Ingenico ePayments platform using the Ingenico Connect Server API}
|
@@ -15,10 +15,10 @@ module Ingenico::Connect::SDK
|
|
15
15
|
# If a parent class is given its communicator will be used for communication.
|
16
16
|
# @param path_context [Hash] hash that contains substitutions for generic locations in the URL path.
|
17
17
|
# This hash will be used to instantiate a concrete URL used to access specific resources.
|
18
|
-
# For example in the URL https://api-
|
18
|
+
# For example in the URL https://eu.sandbox.api-ingenico.com/!{version}/!{merchantId}/payments
|
19
19
|
# !{version} and !{merchantId} can be instantiated using the hash
|
20
20
|
# !{'version' => 'v1', 'merchantId' => '1234'}. The final URL in this case will be
|
21
|
-
# https://api-
|
21
|
+
# https://eu.sandbox.api-ingenico.com/v1/1234/payments.
|
22
22
|
# @param client_meta_info [String] JSON string containing the meta data for the client.
|
23
23
|
def initialize(arg, path_context, client_meta_info=false)
|
24
24
|
if client_meta_info == false
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
4
|
#
|
5
5
|
require 'ingenico/connect/sdk/domain/payment/abstract_redirect_payment_method_specific_input'
|
6
|
+
require 'ingenico/connect/sdk/domain/payment/redirect_payment_product4101_specific_input'
|
6
7
|
require 'ingenico/connect/sdk/domain/payment/redirect_payment_product809_specific_input'
|
7
8
|
require 'ingenico/connect/sdk/domain/payment/redirect_payment_product816_specific_input'
|
8
9
|
require 'ingenico/connect/sdk/domain/payment/redirect_payment_product840_specific_input'
|
@@ -17,6 +18,7 @@ module Ingenico::Connect::SDK
|
|
17
18
|
module Payment
|
18
19
|
|
19
20
|
# @attr [true/false] is_recurring
|
21
|
+
# @attr [Ingenico::Connect::SDK::Domain::Payment::RedirectPaymentProduct4101SpecificInput] payment_product4101_specific_input
|
20
22
|
# @attr [Ingenico::Connect::SDK::Domain::Payment::RedirectPaymentProduct809SpecificInput] payment_product809_specific_input
|
21
23
|
# @attr [Ingenico::Connect::SDK::Domain::Payment::RedirectPaymentProduct816SpecificInput] payment_product816_specific_input
|
22
24
|
# @attr [Ingenico::Connect::SDK::Domain::Payment::RedirectPaymentProduct840SpecificInput] payment_product840_specific_input
|
@@ -30,6 +32,8 @@ module Ingenico::Connect::SDK
|
|
30
32
|
|
31
33
|
attr_accessor :is_recurring
|
32
34
|
|
35
|
+
attr_accessor :payment_product4101_specific_input
|
36
|
+
|
33
37
|
attr_accessor :payment_product809_specific_input
|
34
38
|
|
35
39
|
attr_accessor :payment_product816_specific_input
|
@@ -54,6 +58,7 @@ module Ingenico::Connect::SDK
|
|
54
58
|
def to_h
|
55
59
|
hash = super
|
56
60
|
hash['isRecurring'] = @is_recurring unless @is_recurring.nil?
|
61
|
+
hash['paymentProduct4101SpecificInput'] = @payment_product4101_specific_input.to_h unless @payment_product4101_specific_input.nil?
|
57
62
|
hash['paymentProduct809SpecificInput'] = @payment_product809_specific_input.to_h unless @payment_product809_specific_input.nil?
|
58
63
|
hash['paymentProduct816SpecificInput'] = @payment_product816_specific_input.to_h unless @payment_product816_specific_input.nil?
|
59
64
|
hash['paymentProduct840SpecificInput'] = @payment_product840_specific_input.to_h unless @payment_product840_specific_input.nil?
|
@@ -71,6 +76,10 @@ module Ingenico::Connect::SDK
|
|
71
76
|
if hash.has_key? 'isRecurring'
|
72
77
|
@is_recurring = hash['isRecurring']
|
73
78
|
end
|
79
|
+
if hash.has_key? 'paymentProduct4101SpecificInput'
|
80
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct4101SpecificInput']] unless hash['paymentProduct4101SpecificInput'].is_a? Hash
|
81
|
+
@payment_product4101_specific_input = Ingenico::Connect::SDK::Domain::Payment::RedirectPaymentProduct4101SpecificInput.new_from_hash(hash['paymentProduct4101SpecificInput'])
|
82
|
+
end
|
74
83
|
if hash.has_key? 'paymentProduct809SpecificInput'
|
75
84
|
raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct809SpecificInput']] unless hash['paymentProduct809SpecificInput'].is_a? Hash
|
76
85
|
@payment_product809_specific_input = Ingenico::Connect::SDK::Domain::Payment::RedirectPaymentProduct809SpecificInput.new_from_hash(hash['paymentProduct809SpecificInput'])
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/data_object'
|
6
|
+
|
7
|
+
module Ingenico::Connect::SDK
|
8
|
+
module Domain
|
9
|
+
module Payment
|
10
|
+
|
11
|
+
# @attr [String] integration_type
|
12
|
+
# @attr [String] vpa
|
13
|
+
class RedirectPaymentProduct4101SpecificInput < Ingenico::Connect::SDK::DataObject
|
14
|
+
|
15
|
+
attr_accessor :integration_type
|
16
|
+
|
17
|
+
attr_accessor :vpa
|
18
|
+
|
19
|
+
# @return (Hash)
|
20
|
+
def to_h
|
21
|
+
hash = super
|
22
|
+
hash['integrationType'] = @integration_type unless @integration_type.nil?
|
23
|
+
hash['vpa'] = @vpa unless @vpa.nil?
|
24
|
+
hash
|
25
|
+
end
|
26
|
+
|
27
|
+
def from_hash(hash)
|
28
|
+
super
|
29
|
+
if hash.has_key? 'integrationType'
|
30
|
+
@integration_type = hash['integrationType']
|
31
|
+
end
|
32
|
+
if hash.has_key? 'vpa'
|
33
|
+
@vpa = hash['vpa']
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -11,8 +11,8 @@ module Ingenico::Connect::SDK
|
|
11
11
|
# located at _configuration_file_name_.
|
12
12
|
#
|
13
13
|
# @param configuration_file_name [String] Path to the configuration file to use, should be in YAML format.
|
14
|
-
# @param api_key_id [String] Key id for the
|
15
|
-
# @param secret_api_key [String] Secret key used for authentication to the
|
14
|
+
# @param api_key_id [String] Key id for the Ingenico ePayments platform.
|
15
|
+
# @param secret_api_key [String] Secret key used for authentication to the Ingenico ePayments platform.
|
16
16
|
# @return [Ingenico::Connect::SDK::CommunicatorConfiguration] The created communicator configuration
|
17
17
|
def self.create_configuration(configuration_file_name, api_key_id, secret_api_key)
|
18
18
|
properties = YAML::load_file(configuration_file_name)
|
@@ -56,8 +56,8 @@ module Ingenico::Connect::SDK
|
|
56
56
|
# using the _api_key_id_ and _secret_api_key_ in the CommunicatorConfiguration.
|
57
57
|
#
|
58
58
|
# @param configuration_file_name [String] Path to the configuration file to use, should be in YAML format.
|
59
|
-
# @param api_key_id [String] Key id for the
|
60
|
-
# @param secret_api_key [String] Secret key used for authentication to the
|
59
|
+
# @param api_key_id [String] Key id for the Ingenico ePayments platform.
|
60
|
+
# @param secret_api_key [String] Secret key used for authentication to the Ingenico ePayments platform.
|
61
61
|
# @param meta_data_provider [Ingenico::Connect::SDK::MetaDataProvider] stores the metadata for the communicating client.
|
62
62
|
# @param connection [Ingenico::Connect::SDK::Connection] connection that can be used to communicate with the Ingenico ePayments platform.
|
63
63
|
# @param authenticator [Ingenico::Connect::SDK::Authenticator] authenticator that can authenticate messages sent to the Ingenico ePayments platform.
|
@@ -69,7 +69,7 @@ module Ingenico::Connect::SDK
|
|
69
69
|
authenticator: authenticator)
|
70
70
|
end
|
71
71
|
|
72
|
-
# Creates and returns an {Ingenico::Connect::SDK::Communicator} that is used for communication with the
|
72
|
+
# Creates and returns an {Ingenico::Connect::SDK::Communicator} that is used for communication with the Ingenico ePayments platform.
|
73
73
|
#
|
74
74
|
# @param session [Ingenico::Connect::SDK::Session] session that the communicator will utilize for communication.
|
75
75
|
# @return [Ingenico::Connect::SDK::Communicator] The created communicator
|
@@ -77,7 +77,7 @@ module Ingenico::Connect::SDK
|
|
77
77
|
Communicator.new(session, DefaultImpl::DefaultMarshaller.INSTANCE)
|
78
78
|
end
|
79
79
|
|
80
|
-
# Creates and returns an {Ingenico::Connect::SDK::Communicator} that can be used for communication with the
|
80
|
+
# Creates and returns an {Ingenico::Connect::SDK::Communicator} that can be used for communication with the Ingenico ePayments platform.
|
81
81
|
#
|
82
82
|
# @param configuration [Ingenico::Connect::SDK::CommunicatorConfiguration] contains configuration settings to be used by the client.
|
83
83
|
# @return [Ingenico::Connect::SDK::Communicator] The created communicator
|
@@ -86,11 +86,11 @@ module Ingenico::Connect::SDK
|
|
86
86
|
Communicator.new(session, DefaultImpl::DefaultMarshaller.INSTANCE)
|
87
87
|
end
|
88
88
|
|
89
|
-
# Creates and returns an {Ingenico::Connect::SDK::Communicator} that is used for communication with the
|
89
|
+
# Creates and returns an {Ingenico::Connect::SDK::Communicator} that is used for communication with the Ingenico ePayments platform.
|
90
90
|
#
|
91
91
|
# @param configuration_file_name [String] Path to the configuration file to use, should be in YAML format.
|
92
|
-
# @param api_key_id [String] Key id for the
|
93
|
-
# @param secret_api_key [String] Secret key used for authentication to the
|
92
|
+
# @param api_key_id [String] Key id for the Ingenico ePayments platform.
|
93
|
+
# @param secret_api_key [String] Secret key used for authentication to the Ingenico ePayments platform.
|
94
94
|
# @return [Ingenico::Connect::SDK::Communicator] The created communicator
|
95
95
|
def self.create_communicator_from_file(configuration_file_name, api_key_id, secret_api_key)
|
96
96
|
configuration = create_configuration(configuration_file_name, api_key_id, secret_api_key)
|
@@ -98,7 +98,7 @@ module Ingenico::Connect::SDK
|
|
98
98
|
Communicator.new(session, DefaultImpl::DefaultMarshaller.INSTANCE)
|
99
99
|
end
|
100
100
|
|
101
|
-
# Creates and returns an {Ingenico::Connect::SDK::Client} that provides the a high-level interface with the
|
101
|
+
# Creates and returns an {Ingenico::Connect::SDK::Client} that provides the a high-level interface with the Ingenico ePayments platform.
|
102
102
|
# If a code block is given, the created client is returned to the code block and closed afterwards.
|
103
103
|
#
|
104
104
|
# @example Providing a code block
|
@@ -123,7 +123,7 @@ module Ingenico::Connect::SDK
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
# Creates and returns an {Ingenico::Connect::SDK::Client} that provides the a high-level interface with the
|
126
|
+
# Creates and returns an {Ingenico::Connect::SDK::Client} that provides the a high-level interface with the Ingenico ePayments platform.
|
127
127
|
# If a code block is given, the created client is returned to the code block and closed afterwards.
|
128
128
|
#
|
129
129
|
# @example Providing a code block
|
@@ -147,7 +147,7 @@ module Ingenico::Connect::SDK
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
# Creates and returns an {Ingenico::Connect::SDK::Client} that provides the a high-level interface with the
|
150
|
+
# Creates and returns an {Ingenico::Connect::SDK::Client} that provides the a high-level interface with the Ingenico ePayments platform.
|
151
151
|
# If a code block is given, the created client is returned to the code block and closed afterwards.
|
152
152
|
#
|
153
153
|
# @example Providing a code block
|
@@ -172,7 +172,7 @@ module Ingenico::Connect::SDK
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
|
-
# Creates and returns an {Ingenico::Connect::SDK::Client} that provides the a high-level interface with the
|
175
|
+
# Creates and returns an {Ingenico::Connect::SDK::Client} that provides the a high-level interface with the Ingenico ePayments platform.
|
176
176
|
# If a code block is given, the created client is returned to the code block and closed afterwards.
|
177
177
|
#
|
178
178
|
# @example Providing a code block
|
@@ -182,8 +182,8 @@ module Ingenico::Connect::SDK
|
|
182
182
|
# # client is closed here
|
183
183
|
#
|
184
184
|
# @param configuration_file_name [String] Path to the configuration file to use, should be in YAML format.
|
185
|
-
# @param api_key_id [String] Key id for the
|
186
|
-
# @param secret_api_key [String] Secret key used for authentication to the
|
185
|
+
# @param api_key_id [String] Key id for the Ingenico ePayments platform.
|
186
|
+
# @param secret_api_key [String] Secret key used for authentication to the Ingenico ePayments platform.
|
187
187
|
# @return [Ingenico::Connect::SDK::Client] The created client
|
188
188
|
def self.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
|
189
189
|
communicator = create_communicator_from_file(configuration_file_name, api_key_id, secret_api_key)
|
@@ -7,7 +7,7 @@ module Ingenico::Connect::SDK
|
|
7
7
|
#
|
8
8
|
# @attr_reader [Array<Ingenico::Connect::SDK::RequestHeader>] meta_data_headers List of headers that should be used in all requests.
|
9
9
|
class MetaDataProvider
|
10
|
-
@@SDK_VERSION = '2.
|
10
|
+
@@SDK_VERSION = '2.21.0'
|
11
11
|
@@SERVER_META_INFO_HEADER = 'X-GCS-ServerMetaInfo'
|
12
12
|
@@PROHIBITED_HEADERS = [@@SERVER_META_INFO_HEADER, 'X-GCS-Idempotence-Key',
|
13
13
|
'Date', 'Content-Type', 'Authorization'].sort!.freeze
|
@@ -11,7 +11,7 @@ end
|
|
11
11
|
module Ingenico::Connect::SDK::Logging
|
12
12
|
end
|
13
13
|
|
14
|
-
# Contains interfaces to all
|
14
|
+
# Contains interfaces to all Ingenico ePayments services. These services are accessed through a *Ingenico::Connect::SDK::Client* instance.
|
15
15
|
module Ingenico::Connect::SDK::Merchant
|
16
16
|
end
|
17
17
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
--- # YAML settings used in testing the SDK
|
2
|
-
connect.api.endpoint.host: api-
|
2
|
+
connect.api.endpoint.host: eu.sandbox.api-ingenico.com
|
3
3
|
connect.api.authorizationType: v1HMAC
|
4
4
|
connect.api.connectTimeout: -1
|
5
5
|
connect.api.socketTimeout: -1
|
@@ -9,5 +9,5 @@
|
|
9
9
|
connect.api.proxy.uri: http://localhost:9999
|
10
10
|
# change username and password to authentication credentials for the proxy, omit the entries if no authentication is required
|
11
11
|
# authentication is done using basic proxy authentication. Therefore, to avoid leaking credentials you should connect to the proxy using SSL
|
12
|
-
connect.api.proxy.username:
|
13
|
-
connect.api.proxy.password:
|
12
|
+
connect.api.proxy.username: test-user
|
13
|
+
connect.api.proxy.password: test-password
|
@@ -24,7 +24,8 @@ describe 'proxies' do
|
|
24
24
|
proxy_server = Thread.new do
|
25
25
|
config = { Realm: 'testing' }
|
26
26
|
htpasswd = WEBrick::HTTPAuth::Htpasswd.new(password_filename) # create new Apache password file
|
27
|
-
|
27
|
+
proxy_configuration = Integration.init_communicator_configuration(Integration::PROPERTIES_URI_PROXY).proxy_configuration
|
28
|
+
htpasswd.set_passwd config[:Realm], proxy_configuration.username, proxy_configuration.password
|
28
29
|
config[:UserDB] = htpasswd
|
29
30
|
basic_auth = WEBrick::HTTPAuth::ProxyBasicAuth.new(config)
|
30
31
|
|
@@ -51,7 +52,7 @@ describe 'proxies' do
|
|
51
52
|
end
|
52
53
|
|
53
54
|
# NOTE: if this test is running for a long time with no response
|
54
|
-
# check https://api-
|
55
|
+
# check https://eu.sandbox.api-ingenico.com because this is where merchant
|
55
56
|
# connects to.
|
56
57
|
it 'can be connected to' do
|
57
58
|
request = Ingenico::Connect::SDK::Merchant::Services::ConvertAmountParams.new
|
data/spec/integration_setup.rb
CHANGED
@@ -22,7 +22,7 @@ module Integration
|
|
22
22
|
def self.init_communicator_configuration(properties_url: PROPERTIES_URI, max_connections: nil)
|
23
23
|
yaml = YAML.load_file(properties_url)
|
24
24
|
configuration = Ingenico::Connect::SDK::CommunicatorConfiguration.new(properties: yaml,
|
25
|
-
api_endpoint: 'https://api-
|
25
|
+
api_endpoint: 'https://eu.sandbox.api-ingenico.com',
|
26
26
|
authorization_type: 'v1HMAC',
|
27
27
|
api_key_id: API_KEY_ID,
|
28
28
|
secret_api_key: SECRET_API_KEY,
|
@@ -7,7 +7,7 @@ describe 'CommunicatorConfiguration' do
|
|
7
7
|
|
8
8
|
it 'can be constructed without a proxy' do
|
9
9
|
yaml = '---
|
10
|
-
connect.api.endpoint.host: api-
|
10
|
+
connect.api.endpoint.host: eu.sandbox.api-ingenico.com
|
11
11
|
connect.api.authorizationType: v1HMAC
|
12
12
|
connect.api.connectTimeout: 20
|
13
13
|
connect.api.socketTimeout: 10'
|
@@ -15,7 +15,7 @@ describe 'CommunicatorConfiguration' do
|
|
15
15
|
|
16
16
|
communicator_config = CommunicatorConfiguration.new(properties: config)
|
17
17
|
|
18
|
-
expect(communicator_config.api_endpoint).to eq('https://api-
|
18
|
+
expect(communicator_config.api_endpoint).to eq('https://eu.sandbox.api-ingenico.com')
|
19
19
|
expect(communicator_config.authorization_type).to eq('v1HMAC')
|
20
20
|
expect(communicator_config.connect_timeout).to eq(20)
|
21
21
|
expect(communicator_config.socket_timeout).to eq(10)
|
@@ -29,7 +29,7 @@ describe 'CommunicatorConfiguration' do
|
|
29
29
|
|
30
30
|
it 'can be constructed with a proxy, without authentication' do
|
31
31
|
yaml = '---
|
32
|
-
connect.api.endpoint.host: api-
|
32
|
+
connect.api.endpoint.host: eu.sandbox.api-ingenico.com
|
33
33
|
connect.api.authorizationType: v1HMAC
|
34
34
|
connect.api.connectTimeout: 20
|
35
35
|
connect.api.socketTimeout: 10
|
@@ -39,7 +39,7 @@ describe 'CommunicatorConfiguration' do
|
|
39
39
|
communicator_config = CommunicatorConfiguration.new(properties: config)
|
40
40
|
proxy_config = communicator_config.proxy_configuration
|
41
41
|
|
42
|
-
expect(communicator_config.api_endpoint).to eq('https://api-
|
42
|
+
expect(communicator_config.api_endpoint).to eq('https://eu.sandbox.api-ingenico.com')
|
43
43
|
expect(communicator_config.authorization_type).to eq('v1HMAC')
|
44
44
|
expect(communicator_config.connect_timeout).to eq(20)
|
45
45
|
expect(communicator_config.socket_timeout).to eq(10)
|
@@ -56,19 +56,19 @@ describe 'CommunicatorConfiguration' do
|
|
56
56
|
|
57
57
|
it 'can be constructed to authenticate to a proxy' do
|
58
58
|
yaml = '---
|
59
|
-
connect.api.endpoint.host: api-
|
59
|
+
connect.api.endpoint.host: eu.sandbox.api-ingenico.com
|
60
60
|
connect.api.authorizationType: v1HMAC
|
61
61
|
connect.api.connectTimeout: 20
|
62
62
|
connect.api.socketTimeout: 10
|
63
63
|
connect.api.proxy.uri: http://proxy.example.org:3128
|
64
|
-
connect.api.proxy.username:
|
65
|
-
connect.api.proxy.password:
|
64
|
+
connect.api.proxy.username: test-username
|
65
|
+
connect.api.proxy.password: test-password'
|
66
66
|
config = YAML.load(yaml)
|
67
67
|
|
68
68
|
communicator_config = CommunicatorConfiguration.new(properties: config)
|
69
69
|
proxy_config = communicator_config.proxy_configuration
|
70
70
|
|
71
|
-
expect(communicator_config.api_endpoint).to eq('https://api-
|
71
|
+
expect(communicator_config.api_endpoint).to eq('https://eu.sandbox.api-ingenico.com')
|
72
72
|
expect(communicator_config.authorization_type).to eq('v1HMAC')
|
73
73
|
expect(communicator_config.connect_timeout).to eq(20)
|
74
74
|
expect(communicator_config.socket_timeout).to eq(10)
|
@@ -79,13 +79,13 @@ describe 'CommunicatorConfiguration' do
|
|
79
79
|
expect(proxy_config.scheme).to eq('http')
|
80
80
|
expect(proxy_config.host).to eq('proxy.example.org')
|
81
81
|
expect(proxy_config.port).to eq(3128)
|
82
|
-
expect(proxy_config.username).to eq('
|
83
|
-
expect(proxy_config.password).to eq('
|
82
|
+
expect(proxy_config.username).to eq('test-username')
|
83
|
+
expect(proxy_config.password).to eq('test-password')
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'accepts a different number of maximum connections' do
|
87
87
|
yaml = '---
|
88
|
-
connect.api.endpoint.host: api-
|
88
|
+
connect.api.endpoint.host: eu.sandbox.api-ingenico.com
|
89
89
|
connect.api.authorizationType: v1HMAC
|
90
90
|
connect.api.connectTimeout: 20
|
91
91
|
connect.api.socketTimeout: 10
|
@@ -94,7 +94,7 @@ describe 'CommunicatorConfiguration' do
|
|
94
94
|
|
95
95
|
communicator_config = CommunicatorConfiguration.new(properties: config)
|
96
96
|
|
97
|
-
expect(communicator_config.api_endpoint).to eq('https://api-
|
97
|
+
expect(communicator_config.api_endpoint).to eq('https://eu.sandbox.api-ingenico.com')
|
98
98
|
expect(communicator_config.authorization_type).to eq('v1HMAC')
|
99
99
|
expect(communicator_config.connect_timeout).to eq(20)
|
100
100
|
expect(communicator_config.socket_timeout).to eq(10)
|
@@ -107,7 +107,7 @@ describe 'CommunicatorConfiguration' do
|
|
107
107
|
|
108
108
|
it 'uses specific scheme to override default' do
|
109
109
|
yaml = '---
|
110
|
-
connect.api.endpoint.host: api-
|
110
|
+
connect.api.endpoint.host: eu.sandbox.api-ingenico.com
|
111
111
|
connect.api.authorizationType: v1HMAC
|
112
112
|
connect.api.connectTimeout: 20
|
113
113
|
connect.api.socketTimeout: 10
|
@@ -116,12 +116,12 @@ describe 'CommunicatorConfiguration' do
|
|
116
116
|
|
117
117
|
communicator_config = CommunicatorConfiguration.new(properties: config)
|
118
118
|
|
119
|
-
expect(communicator_config.api_endpoint).to eq('http://api-
|
119
|
+
expect(communicator_config.api_endpoint).to eq('http://eu.sandbox.api-ingenico.com')
|
120
120
|
end
|
121
121
|
|
122
122
|
it 'uses specific port to override default' do
|
123
123
|
yaml = '---
|
124
|
-
connect.api.endpoint.host: api-
|
124
|
+
connect.api.endpoint.host: eu.sandbox.api-ingenico.com
|
125
125
|
connect.api.authorizationType: v1HMAC
|
126
126
|
connect.api.connectTimeout: 20
|
127
127
|
connect.api.socketTimeout: 10
|
@@ -130,12 +130,12 @@ describe 'CommunicatorConfiguration' do
|
|
130
130
|
|
131
131
|
communicator_config = CommunicatorConfiguration.new(properties: config)
|
132
132
|
|
133
|
-
expect(communicator_config.api_endpoint).to eq('https://api-
|
133
|
+
expect(communicator_config.api_endpoint).to eq('https://eu.sandbox.api-ingenico.com:8080')
|
134
134
|
end
|
135
135
|
|
136
136
|
it 'uses specific scheme and port to override default' do
|
137
137
|
yaml = '---
|
138
|
-
connect.api.endpoint.host: api-
|
138
|
+
connect.api.endpoint.host: eu.sandbox.api-ingenico.com
|
139
139
|
connect.api.authorizationType: v1HMAC
|
140
140
|
connect.api.connectTimeout: 20
|
141
141
|
connect.api.socketTimeout: 10
|
@@ -145,12 +145,12 @@ describe 'CommunicatorConfiguration' do
|
|
145
145
|
|
146
146
|
communicator_config = CommunicatorConfiguration.new(properties: config)
|
147
147
|
|
148
|
-
expect(communicator_config.api_endpoint).to eq('http://api-
|
148
|
+
expect(communicator_config.api_endpoint).to eq('http://eu.sandbox.api-ingenico.com:8080')
|
149
149
|
end
|
150
150
|
|
151
151
|
it 'stores shoppingCartExtension data' do
|
152
152
|
yaml = '---
|
153
|
-
connect.api.endpoint.host: api-
|
153
|
+
connect.api.endpoint.host: eu.sandbox.api-ingenico.com
|
154
154
|
connect.api.authorizationType: v1HMAC
|
155
155
|
connect.api.connectTimeout: 20
|
156
156
|
connect.api.socketTimeout: 10
|
@@ -163,7 +163,7 @@ describe 'CommunicatorConfiguration' do
|
|
163
163
|
|
164
164
|
communicator_config = CommunicatorConfiguration.new(properties: config)
|
165
165
|
|
166
|
-
expect(communicator_config.api_endpoint).to eq('https://api-
|
166
|
+
expect(communicator_config.api_endpoint).to eq('https://eu.sandbox.api-ingenico.com')
|
167
167
|
expect(communicator_config.authorization_type).to eq('v1HMAC')
|
168
168
|
expect(communicator_config.connect_timeout).to eq(20)
|
169
169
|
expect(communicator_config.socket_timeout).to eq(10)
|
@@ -7,15 +7,15 @@ RequestParam ||= Ingenico::Connect::SDK::RequestParam
|
|
7
7
|
|
8
8
|
describe Communicator do
|
9
9
|
|
10
|
-
let(:session){instance_double('Session', :api_endpoint => URI('https://api-
|
10
|
+
let(:session){instance_double('Session', :api_endpoint => URI('https://eu.sandbox.api-ingenico.com'))}
|
11
11
|
let(:communicator){communicator = Communicator.new(session, DefaultMarshaller.INSTANCE)}
|
12
12
|
context 'to_absolute_uri()' do
|
13
13
|
it 'accepts a uri with or without a leading slash' do
|
14
14
|
uri1 = communicator.send(:to_absolute_uri, 'v1/merchant/20000/convertamount', [])
|
15
15
|
uri2 = communicator.send(:to_absolute_uri, '/v1/merchant/20000/convertamount', [])
|
16
16
|
# Ruby URI library adds port in HTTPS url's by default
|
17
|
-
expect(uri1.to_s).to eq('https://api-
|
18
|
-
expect(uri2.to_s).to eq('https://api-
|
17
|
+
expect(uri1.to_s).to eq('https://eu.sandbox.api-ingenico.com:443/v1/merchant/20000/convertamount')
|
18
|
+
expect(uri2.to_s).to eq('https://eu.sandbox.api-ingenico.com:443/v1/merchant/20000/convertamount')
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'adds request parameters to the uri' do
|
@@ -24,7 +24,7 @@ describe Communicator do
|
|
24
24
|
|
25
25
|
uri = communicator.send(:to_absolute_uri, 'v1/merchant/20000/convertamount', request_params)
|
26
26
|
|
27
|
-
expect(uri.to_s).to eq('https://api-
|
27
|
+
expect(uri.to_s).to eq('https://eu.sandbox.api-ingenico.com:443/v1/merchant/20000/convertamount'\
|
28
28
|
'?amount=123&source=USD&target=EUR&dummy=%C3%A9%26%25%3D')
|
29
29
|
end
|
30
30
|
end
|
@@ -17,10 +17,10 @@ describe 'DefaultConnectionIdempotence' do
|
|
17
17
|
call_context = CallContext.new(idempotence_key)
|
18
18
|
request = create_payment_request
|
19
19
|
|
20
|
-
stub_request(:post, 'https://api-
|
20
|
+
stub_request(:post, 'https://eu.sandbox.api-ingenico.com/v1/20000/payments')
|
21
21
|
.with(headers: {'X-GCS-Idempotence-Key' => idempotence_key})
|
22
22
|
.to_return(status: 201, body: response_body,
|
23
|
-
headers: base_headers.merge({'Content-Type' => 'application/json', 'Location' => 'api-
|
23
|
+
headers: base_headers.merge({'Content-Type' => 'application/json', 'Location' => 'eu.sandbox.api-ingenico.com/v1/20000/payments/000002000020142549460000100001'}))
|
24
24
|
|
25
25
|
response = CLIENT.merchant('20000').payments.create(request, call_context)
|
26
26
|
|
@@ -37,12 +37,11 @@ describe 'DefaultConnectionIdempotence' do
|
|
37
37
|
call_context = CallContext.new(idempotence_key)
|
38
38
|
request = create_payment_request
|
39
39
|
|
40
|
-
|
41
|
-
stub_request(:post, 'https://api-sandbox.globalcollect.com/v1/20000/payments')
|
40
|
+
stub_request(:post, 'https://eu.sandbox.api-ingenico.com/v1/20000/payments')
|
42
41
|
.with(headers: {'X-GCS-Idempotence-Key' => idempotence_key})
|
43
42
|
.to_return(status: 201, body: response_body,
|
44
43
|
headers: base_headers.merge({'Content-Type' => 'application/json',
|
45
|
-
'Location' => 'api-
|
44
|
+
'Location' => 'eu.sandbox.api-ingenico.com/v1/20000/payments/000002000020142549460000100001',
|
46
45
|
'X-GCS-Idempotence-Request-Timestamp' => idempotence_timestamp}))
|
47
46
|
|
48
47
|
response = CLIENT.merchant('20000').payments.create(request, call_context)
|
@@ -60,7 +59,7 @@ describe 'DefaultConnectionIdempotence' do
|
|
60
59
|
call_context = CallContext.new(idempotence_key)
|
61
60
|
request = create_payment_request
|
62
61
|
|
63
|
-
stub_request(:post, 'https://api-
|
62
|
+
stub_request(:post, 'https://eu.sandbox.api-ingenico.com/v1/20000/payments')
|
64
63
|
.with(headers: {'X-GCS-Idempotence-Key' => idempotence_key})
|
65
64
|
.to_return(status: 402, body: response_body,
|
66
65
|
headers: base_headers.merge({'Content-Type' => 'application/json'}))
|
@@ -81,7 +80,7 @@ describe 'DefaultConnectionIdempotence' do
|
|
81
80
|
call_context = CallContext.new(idempotence_key)
|
82
81
|
request = create_payment_request
|
83
82
|
|
84
|
-
stub_request(:post, 'https://api-
|
83
|
+
stub_request(:post, 'https://eu.sandbox.api-ingenico.com/v1/20000/payments')
|
85
84
|
.with(headers: {'X-GCS-Idempotence-Key' => idempotence_key})
|
86
85
|
.to_return(status: 402, body: response_body,
|
87
86
|
headers: base_headers.merge({'Content-Type' => 'application/json',
|
@@ -103,7 +102,7 @@ describe 'DefaultConnectionIdempotence' do
|
|
103
102
|
call_context = CallContext.new(idempotence_key)
|
104
103
|
request = create_payment_request
|
105
104
|
|
106
|
-
stub_request(:post, 'https://api-
|
105
|
+
stub_request(:post, 'https://eu.sandbox.api-ingenico.com/v1/20000/payments')
|
107
106
|
.with(headers: {'X-GCS-Idempotence-Key' => idempotence_key})
|
108
107
|
.to_return(status: 409, body: response_body,
|
109
108
|
headers: base_headers.merge({'Content-Type' => 'application/json',
|
@@ -135,7 +135,7 @@ module ValidationDict
|
|
135
135
|
message =~ RESPONSE_START
|
136
136
|
id = $1 # capture id from the regular expression above
|
137
137
|
expect(message).to match(STATUS_201)
|
138
|
-
expect(message).to match(%r(Location="api-
|
138
|
+
expect(message).to match(%r(Location="eu\.sandbox\.api-ingenico\.com/v1/1234/payments/000000123410000595980000100001"))
|
139
139
|
expect(message).to match(DATA_JSON_HEADER)
|
140
140
|
# expect(message).to match(DUMMY_HEADER)
|
141
141
|
expect(message).to match(DATEHEADER)
|
@@ -163,7 +163,7 @@ module ValidationDict
|
|
163
163
|
message =~ RESPONSE_START
|
164
164
|
id = $1 # capture id from the regular expression above
|
165
165
|
expect(message).to match(STATUS_201)
|
166
|
-
expect(message).to match(%r(Location="api-
|
166
|
+
expect(message).to match(%r(Location="eu\.sandbox\.api-ingenico\.com/v1/1234/payments/000000123410000595980000100001"))
|
167
167
|
expect(message).to match(DATA_JSON_HEADER)
|
168
168
|
# expect(message).to match(DUMMY_HEADER)
|
169
169
|
expect(message).to match(DATEHEADER)
|
@@ -260,7 +260,7 @@ describe 'DefaultConnectionLogging' do
|
|
260
260
|
it 'should be able to log a simple request' do
|
261
261
|
response_body = IO.read(resource_prefix + 'testConnection.json')
|
262
262
|
|
263
|
-
stub_request(:get, 'https://api-
|
263
|
+
stub_request(:get, 'https://eu.sandbox.api-ingenico.com/v1/1234/services/testconnection')
|
264
264
|
.to_return(status: 200, body: response_body,
|
265
265
|
headers: base_headers.merge({'Content-Type' => 'application/json'}))
|
266
266
|
|
@@ -277,7 +277,7 @@ describe 'DefaultConnectionLogging' do
|
|
277
277
|
it 'can log a GET request with parameters' do
|
278
278
|
response_body = IO.read(resource_prefix + 'convertAmount.json')
|
279
279
|
|
280
|
-
stub_request(:get, 'https://api-
|
280
|
+
stub_request(:get, 'https://eu.sandbox.api-ingenico.com/v1/1234/services/convert/amount?source=EUR&target=USD&amount=1000')
|
281
281
|
.to_return(status: 200, body: response_body,
|
282
282
|
headers: base_headers.merge({'Content-Type' => 'application/json'}))
|
283
283
|
|
@@ -297,7 +297,7 @@ describe 'DefaultConnectionLogging' do
|
|
297
297
|
|
298
298
|
# tests delete token
|
299
299
|
it 'can log DELETE requests' do
|
300
|
-
stub_request(:delete, 'https://api-
|
300
|
+
stub_request(:delete, 'https://eu.sandbox.api-ingenico.com/v1/1234/tokens/5678')
|
301
301
|
.to_return(status: 204, headers: base_headers)
|
302
302
|
|
303
303
|
CLIENT.enable_logging(logger)
|
@@ -313,10 +313,10 @@ describe 'DefaultConnectionLogging' do
|
|
313
313
|
response_body = IO.read(resource_prefix + 'createPayment.json')
|
314
314
|
request = create_payment_request
|
315
315
|
|
316
|
-
stub_request(:post, 'https://api-
|
316
|
+
stub_request(:post, 'https://eu.sandbox.api-ingenico.com/v1/1234/payments')
|
317
317
|
.to_return(status: 201, body: response_body,
|
318
318
|
headers: base_headers.merge({'Content-Type' => 'application/json',
|
319
|
-
'Location' => 'api-
|
319
|
+
'Location' => 'eu.sandbox.api-ingenico.com/v1/1234/payments/000000123410000595980000100001'}))
|
320
320
|
|
321
321
|
CLIENT.enable_logging(logger)
|
322
322
|
response = CLIENT.merchant('1234').payments.create(request)
|
@@ -331,10 +331,10 @@ describe 'DefaultConnectionLogging' do
|
|
331
331
|
response_body = IO.read(resource_prefix + 'createPayment.unicode.json')
|
332
332
|
request = create_payment_request
|
333
333
|
|
334
|
-
stub_request(:post, 'https://api-
|
334
|
+
stub_request(:post, 'https://eu.sandbox.api-ingenico.com/v1/1234/payments')
|
335
335
|
.to_return(status: 201, body: response_body,
|
336
336
|
headers: base_headers.merge({'Content-Type' => 'application/json',
|
337
|
-
'Location' => 'api-
|
337
|
+
'Location' => 'eu.sandbox.api-ingenico.com/v1/1234/payments/000000123410000595980000100001'}))
|
338
338
|
|
339
339
|
CLIENT.enable_logging(logger)
|
340
340
|
response = CLIENT.merchant('1234').payments.create(request)
|
@@ -351,7 +351,7 @@ describe 'DefaultConnectionLogging' do
|
|
351
351
|
response_body = IO.read(resource_prefix + 'createPayment.failure.invalidCardNumber.json')
|
352
352
|
request = create_payment_request
|
353
353
|
|
354
|
-
stub_request(:post, 'https://api-
|
354
|
+
stub_request(:post, 'https://eu.sandbox.api-ingenico.com/v1/1234/payments')
|
355
355
|
.to_return(status: 400, body: response_body,
|
356
356
|
headers: base_headers.merge({'Content-Type' => 'application/json'}))
|
357
357
|
|
@@ -366,7 +366,7 @@ describe 'DefaultConnectionLogging' do
|
|
366
366
|
response_body = IO.read(resource_prefix + 'createPayment.failure.rejected.json')
|
367
367
|
request = create_payment_request
|
368
368
|
|
369
|
-
stub_request(:post, 'https://api-
|
369
|
+
stub_request(:post, 'https://eu.sandbox.api-ingenico.com/v1/1234/payments')
|
370
370
|
.to_return(status: 402, body: response_body,
|
371
371
|
headers: base_headers.merge({'Content-Type' => 'application/json'}))
|
372
372
|
|
@@ -380,7 +380,7 @@ describe 'DefaultConnectionLogging' do
|
|
380
380
|
it 'logs general HTTP errors' do
|
381
381
|
response_body = IO.read(resource_prefix + 'unknownServerError.json')
|
382
382
|
|
383
|
-
stub_request(:get, 'https://api-
|
383
|
+
stub_request(:get, 'https://eu.sandbox.api-ingenico.com/v1/1234/services/testconnection')
|
384
384
|
.to_return(status: 500, body: response_body,
|
385
385
|
headers: base_headers.merge({'Content-Type' => 'application/json'}))
|
386
386
|
|
@@ -394,7 +394,7 @@ describe 'DefaultConnectionLogging' do
|
|
394
394
|
it 'logs non-json' do
|
395
395
|
response_body = IO.read(resource_prefix + 'notFound.html')
|
396
396
|
|
397
|
-
stub_request(:get, 'https://api-
|
397
|
+
stub_request(:get, 'https://eu.sandbox.api-ingenico.com/v1/1234/services/testconnection')
|
398
398
|
.to_return(status: 404, body: response_body,
|
399
399
|
headers: base_headers.merge({'Content-Type' => 'text/html'}))
|
400
400
|
|
@@ -406,7 +406,7 @@ describe 'DefaultConnectionLogging' do
|
|
406
406
|
|
407
407
|
# tests a read timeout
|
408
408
|
it 'logs timeouts' do
|
409
|
-
stub_request(:get, 'https://api-
|
409
|
+
stub_request(:get, 'https://eu.sandbox.api-ingenico.com/v1/1234/services/testconnection')
|
410
410
|
.to_raise(HTTPClient::ReceiveTimeoutError)
|
411
411
|
|
412
412
|
CLIENT.enable_logging(logger)
|
@@ -427,7 +427,7 @@ describe 'DefaultConnectionLogging' do
|
|
427
427
|
it 'can log requests individually' do
|
428
428
|
response_body = IO.read(resource_prefix + 'testConnection.json')
|
429
429
|
|
430
|
-
stub_request(:get, 'https://api-
|
430
|
+
stub_request(:get, 'https://eu.sandbox.api-ingenico.com/v1/1234/services/testconnection')
|
431
431
|
.to_return{ |request| CLIENT.disable_logging
|
432
432
|
{body: response_body, status: 200, headers: base_headers.merge({'Content-type' => 'application/json'})}}
|
433
433
|
|
@@ -446,7 +446,7 @@ describe 'DefaultConnectionLogging' do
|
|
446
446
|
it 'can log responses individually' do
|
447
447
|
response_body = IO.read(resource_prefix + 'testConnection.json')
|
448
448
|
|
449
|
-
stub_request(:get, 'https://api-
|
449
|
+
stub_request(:get, 'https://eu.sandbox.api-ingenico.com/v1/1234/services/testconnection')
|
450
450
|
.to_return{ |request| CLIENT.enable_logging(logger)
|
451
451
|
{body: response_body, status: 200, headers: base_headers.merge({'Content-type' => 'application/json'})}}
|
452
452
|
|
@@ -462,7 +462,7 @@ describe 'DefaultConnectionLogging' do
|
|
462
462
|
end
|
463
463
|
|
464
464
|
it 'can log errors individually' do
|
465
|
-
stub_request(:get, 'https://api-
|
465
|
+
stub_request(:get, 'https://eu.sandbox.api-ingenico.com/v1/1234/services/testconnection')
|
466
466
|
.to_return{ |request| CLIENT.enable_logging(logger)
|
467
467
|
raise HTTPClient::ReceiveTimeoutError.new}
|
468
468
|
|
data/spec/lib/factory_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe 'Factory' do
|
|
7
7
|
it 'can initialize configurations' do
|
8
8
|
configuration = Factory.create_configuration(PROPERTIES_URI, API_KEY_ID, SECRET_API_KEY)
|
9
9
|
|
10
|
-
expect(configuration.api_endpoint).to eq('https://api-
|
10
|
+
expect(configuration.api_endpoint).to eq('https://eu.sandbox.api-ingenico.com')
|
11
11
|
expect(configuration.authorization_type).to eq('v1HMAC')
|
12
12
|
expect(configuration.connect_timeout).to eq(-1)
|
13
13
|
expect(configuration.socket_timeout).to eq(-1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: connect-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ingenico ePayments
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -419,6 +419,7 @@ files:
|
|
419
419
|
- lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input.rb
|
420
420
|
- lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input_base.rb
|
421
421
|
- lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_output.rb
|
422
|
+
- lib/ingenico/connect/sdk/domain/payment/redirect_payment_product4101_specific_input.rb
|
422
423
|
- lib/ingenico/connect/sdk/domain/payment/redirect_payment_product809_specific_input.rb
|
423
424
|
- lib/ingenico/connect/sdk/domain/payment/redirect_payment_product816_specific_input.rb
|
424
425
|
- lib/ingenico/connect/sdk/domain/payment/redirect_payment_product840_specific_input.rb
|