connect-sdk-ruby 2.17.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/examples/merchant/payments/complete_payment_example.rb +1 -1
- data/examples/merchant/payments/create_payment_example.rb +1 -1
- data/examples/merchant/riskassessments/risk_assessment_cards_example.rb +1 -1
- data/examples/merchant/tokens/update_token_example.rb +1 -1
- data/lib/ingenico/connect/sdk/api_resource.rb +2 -2
- data/lib/ingenico/connect/sdk/domain/definitions/additional_order_input_airline_data.rb +9 -0
- data/lib/ingenico/connect/sdk/domain/definitions/lodging_charge.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/definitions/lodging_data.rb +147 -0
- data/lib/ingenico/connect/sdk/domain/definitions/lodging_room.rb +88 -0
- data/lib/ingenico/connect/sdk/domain/payment/additional_order_input.rb +9 -0
- data/lib/ingenico/connect/sdk/domain/payment/decrypted_payment_data.rb +2 -0
- data/lib/ingenico/connect/sdk/domain/payment/exemption_output.rb +46 -0
- data/lib/ingenico/connect/sdk/domain/payment/non_sepa_direct_debit_payment_method_specific_input.rb +7 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input.rb +9 -0
- data/lib/ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_output.rb +16 -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/domain/payment/sepa_direct_debit_payment_method_specific_input.rb +7 -0
- data/lib/ingenico/connect/sdk/domain/payment/three_d_secure_results.rb +9 -0
- data/lib/ingenico/connect/sdk/domain/services/payment_context.rb +7 -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/payment_products_spec.rb +13 -0
- 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 +7 -2
@@ -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
|
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'integration_setup'
|
3
3
|
require 'webmock/rspec'
|
4
4
|
require 'ingenico/connect/sdk/merchant/products/directory_params'
|
5
|
+
require 'ingenico/connect/sdk/merchant/products/find_products_params'
|
5
6
|
|
6
7
|
describe 'PaymentProducts' do
|
7
8
|
|
@@ -10,6 +11,18 @@ describe 'PaymentProducts' do
|
|
10
11
|
|
11
12
|
it 'can be accessed' do
|
12
13
|
|
14
|
+
params = Ingenico::Connect::SDK::Merchant::Products::FindProductsParams.new
|
15
|
+
params.country_code = 'NL'
|
16
|
+
params.currency_code = 'EUR'
|
17
|
+
|
18
|
+
Integration.init_client(false) do |client|
|
19
|
+
response = client.merchant(Integration::MERCHANT_ID).products.find(params)
|
20
|
+
expect(response.payment_products.length).to be > 0
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'has directories that can be accessed' do
|
25
|
+
|
13
26
|
params = Ingenico::Connect::SDK::Merchant::Products::DirectoryParams.new
|
14
27
|
params.country_code = 'NL'
|
15
28
|
params.currency_code = 'EUR'
|
@@ -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
|
|