connect-sdk-ruby 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/connect-sdk-ruby.gemspec +1 -1
  3. data/examples/merchant/payments/approve_payment_example.rb +1 -1
  4. data/examples/merchant/payments/create_payment_example.rb +1 -1
  5. data/examples/merchant/payments/refund_payment_example.rb +2 -2
  6. data/examples/merchant/payouts/create_payout_example.rb +1 -1
  7. data/examples/merchant/productgroups/get_payment_product_group_example.rb +3 -3
  8. data/examples/merchant/productgroups/get_payment_product_groups_example.rb +3 -3
  9. data/examples/merchant/products/get_directory_example.rb +1 -1
  10. data/examples/merchant/products/get_payment_product_example.rb +3 -3
  11. data/examples/merchant/products/get_payment_products_example.rb +3 -3
  12. data/examples/merchant/riskassessments/risk_assessment_bank_account_example.rb +1 -1
  13. data/examples/merchant/riskassessments/risk_assessment_cards_example.rb +1 -1
  14. data/examples/merchant/services/convert_amount_example.rb +1 -1
  15. data/examples/merchant/tokens/update_token_example.rb +1 -1
  16. data/lib/ingenico/connect/sdk/merchant/merchant_client.rb +16 -16
  17. data/lib/ingenico/connect/sdk/merchant/payments/payments_client.rb +5 -17
  18. data/lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb +4 -12
  19. data/lib/ingenico/connect/sdk/merchant/productgroups/find_productgroups_params.rb +15 -16
  20. data/lib/ingenico/connect/sdk/merchant/productgroups/get_productgroup_params.rb +15 -16
  21. data/lib/ingenico/connect/sdk/merchant/productgroups/productgroups_client.rb +3 -5
  22. data/lib/ingenico/connect/sdk/merchant/products/directory_params.rb +3 -4
  23. data/lib/ingenico/connect/sdk/merchant/products/find_products_params.rb +15 -16
  24. data/lib/ingenico/connect/sdk/merchant/products/get_product_params.rb +15 -16
  25. data/lib/ingenico/connect/sdk/merchant/products/networks_params.rb +0 -1
  26. data/lib/ingenico/connect/sdk/merchant/products/products_client.rb +5 -11
  27. data/lib/ingenico/connect/sdk/merchant/services/convert_amount_params.rb +4 -5
  28. data/lib/ingenico/connect/sdk/merchant/services/services_client.rb +2 -6
  29. data/lib/ingenico/connect/sdk/merchant/tokens/delete_token_params.rb +0 -1
  30. data/lib/ingenico/connect/sdk/merchant/tokens/tokens_client.rb +19 -25
  31. data/lib/ingenico/connect/sdk/meta_data_provider.rb +1 -1
  32. data/lib/ingenico/connect/sdk/request_header.rb +14 -1
  33. data/spec/integration/multiline_header_spec.rb +8 -2
  34. data/spec/lib/defaultimpl/default_connection_logger_spec.rb +2 -2
  35. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fbce0636a60191953016983f15d8e0a3f02347e
4
- data.tar.gz: 5676833dcc4cd193c438d52cf3ba4dd3b867db89
3
+ metadata.gz: b5f2472449a29e66bef937d3be0c4346af2c7ca9
4
+ data.tar.gz: 2cbb453a1ff614fbddabb4d88e5a6535901f9db8
5
5
  SHA512:
6
- metadata.gz: 25c09dbb1b0906082d3523e86710d36356272864b1a6d53d336ff1c15451025afa6d2773ffd77401dcc74970780e610f4047030cecd2ff315e86010cf40263cd
7
- data.tar.gz: 7ad7c5a3edfff7dc69feb9ff095dd977f17cdff43c11269a21cf389ae8b9960c580faf78035d7586492f1410555a3e70f52b962b949c38407ed0aecd06341971
6
+ metadata.gz: 22ffcac8ecb66987b285b7c1b9fe38d729688d8a1abb9815396663611f7667b98279e511ec6e9e6f0c2375cb81f37692d6ecf54b9774c167d36d99157c14e5a0
7
+ data.tar.gz: 0b72832ff357bed4bce56938e3ee2e57b5b48cd686381b6cd31033bab13ab80b8ad03a88dbfe5efe16afafd145ca8ad683c856f09a71645db91dfedf15bc19fe
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'connect-sdk-ruby'
3
- spec.version = '1.5.0'
3
+ spec.version = '1.5.1'
4
4
  spec.authors = ['Ingenico ePayments']
5
5
  spec.email = ['github@epay.ingenico.com']
6
6
  spec.summary = %q{SDK to communicate with the GlobalCollect platform using the Ingenico Connect Server API}
@@ -3,8 +3,8 @@
3
3
  # https://developer.globalcollect.com/documentation/api/server/
4
4
  #
5
5
  require 'ingenico/connect/sdk/factory'
6
- require 'ingenico/connect/sdk/domain/payment/approve_payment_request'
7
6
  require 'ingenico/connect/sdk/domain/payment/approve_payment_non_sepa_direct_debit_payment_method_specific_input'
7
+ require 'ingenico/connect/sdk/domain/payment/approve_payment_request'
8
8
  require 'ingenico/connect/sdk/domain/payment/order_approve_payment'
9
9
  require 'ingenico/connect/sdk/domain/payment/order_references_approve_payment'
10
10
 
@@ -9,10 +9,10 @@ require 'ingenico/connect/sdk/domain/definitions/address'
9
9
  require 'ingenico/connect/sdk/domain/definitions/amount_of_money'
10
10
  require 'ingenico/connect/sdk/domain/definitions/card'
11
11
  require 'ingenico/connect/sdk/domain/definitions/company_information'
12
- require 'ingenico/connect/sdk/domain/payment/create_payment_request'
13
12
  require 'ingenico/connect/sdk/domain/payment/address_personal'
14
13
  require 'ingenico/connect/sdk/domain/payment/card_payment_method_specific_input'
15
14
  require 'ingenico/connect/sdk/domain/payment/contact_details'
15
+ require 'ingenico/connect/sdk/domain/payment/create_payment_request'
16
16
  require 'ingenico/connect/sdk/domain/payment/customer'
17
17
  require 'ingenico/connect/sdk/domain/payment/line_item'
18
18
  require 'ingenico/connect/sdk/domain/payment/line_item_invoice_data'
@@ -10,14 +10,14 @@ require 'ingenico/connect/sdk/domain/definitions/bank_account_iban'
10
10
  require 'ingenico/connect/sdk/domain/definitions/contact_details_base'
11
11
  require 'ingenico/connect/sdk/domain/payment/address_personal'
12
12
  require 'ingenico/connect/sdk/domain/payment/personal_name'
13
- require 'ingenico/connect/sdk/domain/refund/refund_request'
14
13
  require 'ingenico/connect/sdk/domain/refund/bank_refund_method_specific_input'
15
14
  require 'ingenico/connect/sdk/domain/refund/refund_customer'
16
15
  require 'ingenico/connect/sdk/domain/refund/refund_references'
16
+ require 'ingenico/connect/sdk/domain/refund/refund_request'
17
17
 
18
18
  Definitions = Ingenico::Connect::SDK::Domain::Definitions
19
- Refund = Ingenico::Connect::SDK::Domain::Refund
20
19
  Payment = Ingenico::Connect::SDK::Domain::Payment
20
+ Refund = Ingenico::Connect::SDK::Domain::Refund
21
21
 
22
22
  def example
23
23
  get_client do |client|
@@ -16,8 +16,8 @@ require 'ingenico/connect/sdk/domain/payout/payout_customer'
16
16
  require 'ingenico/connect/sdk/domain/payout/payout_references'
17
17
 
18
18
  Definitions = Ingenico::Connect::SDK::Domain::Definitions
19
- Payout = Ingenico::Connect::SDK::Domain::Payout
20
19
  Payment = Ingenico::Connect::SDK::Domain::Payment
20
+ Payout = Ingenico::Connect::SDK::Domain::Payout
21
21
 
22
22
  def example
23
23
  get_client do |client|
@@ -10,11 +10,11 @@ Productgroups = Ingenico::Connect::SDK::Merchant::Productgroups
10
10
  def example
11
11
  get_client do |client|
12
12
  query = Productgroups::GetProductgroupParams.new
13
- query.amount = 1000
14
- query.is_recurring = true
15
13
  query.country_code = 'NL'
16
- query.locale = 'en_US'
17
14
  query.currency_code = 'EUR'
15
+ query.locale = 'en_US'
16
+ query.amount = 1000
17
+ query.is_recurring = true
18
18
  query.add_hide('fields')
19
19
 
20
20
  response = client.merchant('merchantId').productgroups().get('cards', query)
@@ -10,11 +10,11 @@ Productgroups = Ingenico::Connect::SDK::Merchant::Productgroups
10
10
  def example
11
11
  get_client do |client|
12
12
  query = Productgroups::FindProductgroupsParams.new
13
- query.amount = 1000
14
- query.is_recurring = true
15
13
  query.country_code = 'NL'
16
- query.locale = 'en_US'
17
14
  query.currency_code = 'EUR'
15
+ query.locale = 'en_US'
16
+ query.amount = 1000
17
+ query.is_recurring = true
18
18
  query.add_hide('fields')
19
19
 
20
20
  response = client.merchant('merchantId').productgroups().find(query)
@@ -10,8 +10,8 @@ Products = Ingenico::Connect::SDK::Merchant::Products
10
10
  def example
11
11
  get_client do |client|
12
12
  query = Products::DirectoryParams.new
13
- query.currency_code = 'EUR'
14
13
  query.country_code = 'NL'
14
+ query.currency_code = 'EUR'
15
15
 
16
16
  response = client.merchant('merchantId').products().directory(809, query)
17
17
  end
@@ -10,11 +10,11 @@ Products = Ingenico::Connect::SDK::Merchant::Products
10
10
  def example
11
11
  get_client do |client|
12
12
  query = Products::GetProductParams.new
13
- query.amount = 1000
14
- query.is_recurring = true
15
13
  query.country_code = 'US'
16
- query.locale = 'en_US'
17
14
  query.currency_code = 'USD'
15
+ query.locale = 'en_US'
16
+ query.amount = 1000
17
+ query.is_recurring = true
18
18
  query.add_hide('fields')
19
19
 
20
20
  response = client.merchant('merchantId').products().get(1, query)
@@ -10,11 +10,11 @@ Products = Ingenico::Connect::SDK::Merchant::Products
10
10
  def example
11
11
  get_client do |client|
12
12
  query = Products::FindProductsParams.new
13
- query.amount = 1000
14
- query.is_recurring = true
15
13
  query.country_code = 'US'
16
- query.locale = 'en_US'
17
14
  query.currency_code = 'USD'
15
+ query.locale = 'en_US'
16
+ query.amount = 1000
17
+ query.is_recurring = true
18
18
  query.add_hide('fields')
19
19
 
20
20
  response = client.merchant('merchantId').products().find(query)
@@ -6,9 +6,9 @@ require 'ingenico/connect/sdk/factory'
6
6
  require 'ingenico/connect/sdk/domain/definitions/address'
7
7
  require 'ingenico/connect/sdk/domain/definitions/amount_of_money'
8
8
  require 'ingenico/connect/sdk/domain/definitions/bank_account_bban'
9
- require 'ingenico/connect/sdk/domain/riskassessments/risk_assessment_bank_account'
10
9
  require 'ingenico/connect/sdk/domain/riskassessments/customer_risk_assessment'
11
10
  require 'ingenico/connect/sdk/domain/riskassessments/order_risk_assessment'
11
+ require 'ingenico/connect/sdk/domain/riskassessments/risk_assessment_bank_account'
12
12
 
13
13
  Definitions = Ingenico::Connect::SDK::Domain::Definitions
14
14
  Riskassessments = Ingenico::Connect::SDK::Domain::Riskassessments
@@ -9,9 +9,9 @@ require 'ingenico/connect/sdk/domain/definitions/airline_data'
9
9
  require 'ingenico/connect/sdk/domain/definitions/airline_flight_leg'
10
10
  require 'ingenico/connect/sdk/domain/definitions/amount_of_money'
11
11
  require 'ingenico/connect/sdk/domain/definitions/card'
12
- require 'ingenico/connect/sdk/domain/riskassessments/risk_assessment_card'
13
12
  require 'ingenico/connect/sdk/domain/riskassessments/customer_risk_assessment'
14
13
  require 'ingenico/connect/sdk/domain/riskassessments/order_risk_assessment'
14
+ require 'ingenico/connect/sdk/domain/riskassessments/risk_assessment_card'
15
15
 
16
16
  Definitions = Ingenico::Connect::SDK::Domain::Definitions
17
17
  Riskassessments = Ingenico::Connect::SDK::Domain::Riskassessments
@@ -11,8 +11,8 @@ def example
11
11
  get_client do |client|
12
12
  query = Services::ConvertAmountParams.new
13
13
  query.source = 'EUR'
14
- query.amount = 100
15
14
  query.target = 'USD'
15
+ query.amount = 100
16
16
 
17
17
  response = client.merchant('merchantId').services().convert_amount(query)
18
18
  end
@@ -6,12 +6,12 @@ require 'ingenico/connect/sdk/factory'
6
6
  require 'ingenico/connect/sdk/domain/definitions/address'
7
7
  require 'ingenico/connect/sdk/domain/definitions/card_without_cvv'
8
8
  require 'ingenico/connect/sdk/domain/definitions/company_information'
9
- require 'ingenico/connect/sdk/domain/token/update_token_request'
10
9
  require 'ingenico/connect/sdk/domain/token/customer_token'
11
10
  require 'ingenico/connect/sdk/domain/token/personal_information_token'
12
11
  require 'ingenico/connect/sdk/domain/token/personal_name_token'
13
12
  require 'ingenico/connect/sdk/domain/token/token_card'
14
13
  require 'ingenico/connect/sdk/domain/token/token_card_data'
14
+ require 'ingenico/connect/sdk/domain/token/update_token_request'
15
15
 
16
16
  Definitions = Ingenico::Connect::SDK::Domain::Definitions
17
17
  Token = Ingenico::Connect::SDK::Domain::Token
@@ -26,14 +26,6 @@ module Ingenico::Connect::SDK
26
26
  super(parent, path_context)
27
27
  end
28
28
 
29
- # Resource /{{merchantId}}/hostedcheckouts
30
- #
31
- # Create new hosted checkout
32
- # Returns:: {Ingenico::Connect::SDK::Merchant::Hostedcheckouts::HostedcheckoutsClient}
33
- def hostedcheckouts
34
- Ingenico::Connect::SDK::Merchant::Hostedcheckouts::HostedcheckoutsClient.new(self, nil)
35
- end
36
-
37
29
  # Resource /{{merchantId}}/payments
38
30
  #
39
31
  # Create, cancel and approve payments
@@ -50,14 +42,6 @@ module Ingenico::Connect::SDK
50
42
  Ingenico::Connect::SDK::Merchant::Payouts::PayoutsClient.new(self, nil)
51
43
  end
52
44
 
53
- # Resource /{{merchantId}}/productgroups
54
- #
55
- # Get information about payment product groups
56
- # Returns:: {Ingenico::Connect::SDK::Merchant::Productgroups::ProductgroupsClient}
57
- def productgroups
58
- Ingenico::Connect::SDK::Merchant::Productgroups::ProductgroupsClient.new(self, nil)
59
- end
60
-
61
45
  # Resource /{{merchantId}}/products
62
46
  #
63
47
  # Get information about payment products
@@ -66,6 +50,14 @@ module Ingenico::Connect::SDK
66
50
  Ingenico::Connect::SDK::Merchant::Products::ProductsClient.new(self, nil)
67
51
  end
68
52
 
53
+ # Resource /{{merchantId}}/productgroups
54
+ #
55
+ # Get information about payment product groups
56
+ # Returns:: {Ingenico::Connect::SDK::Merchant::Productgroups::ProductgroupsClient}
57
+ def productgroups
58
+ Ingenico::Connect::SDK::Merchant::Productgroups::ProductgroupsClient.new(self, nil)
59
+ end
60
+
69
61
  # Resource /{{merchantId}}/refunds
70
62
  #
71
63
  # Create, cancel and approve refunds
@@ -105,6 +97,14 @@ module Ingenico::Connect::SDK
105
97
  def tokens
106
98
  Ingenico::Connect::SDK::Merchant::Tokens::TokensClient.new(self, nil)
107
99
  end
100
+
101
+ # Resource /{{merchantId}}/hostedcheckouts
102
+ #
103
+ # Create new hosted checkout
104
+ # Returns:: {Ingenico::Connect::SDK::Merchant::Hostedcheckouts::HostedcheckoutsClient}
105
+ def hostedcheckouts
106
+ Ingenico::Connect::SDK::Merchant::Hostedcheckouts::HostedcheckoutsClient.new(self, nil)
107
+ end
108
108
  end
109
109
  end
110
110
  end
@@ -126,10 +126,7 @@ module Ingenico::Connect::SDK
126
126
  Ingenico::Connect::SDK::Domain::Payment::PaymentApprovalResponse,
127
127
  context)
128
128
  rescue ResponseException => e
129
- error_type = {
130
- 402 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
131
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
132
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
129
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
133
130
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
134
131
  raise create_exception(e.status_code, e.body, error_object, context)
135
132
  end
@@ -162,9 +159,7 @@ module Ingenico::Connect::SDK
162
159
  Ingenico::Connect::SDK::Domain::Payment::CancelPaymentResponse,
163
160
  context)
164
161
  rescue ResponseException => e
165
- error_type = {
166
- 402 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
167
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
162
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
168
163
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
169
164
  raise create_exception(e.status_code, e.body, error_object, context)
170
165
  end
@@ -197,9 +192,7 @@ module Ingenico::Connect::SDK
197
192
  Ingenico::Connect::SDK::Domain::Payment::CancelApprovalPaymentResponse,
198
193
  context)
199
194
  rescue ResponseException => e
200
- error_type = {
201
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
202
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
195
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
203
196
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
204
197
  raise create_exception(e.status_code, e.body, error_object, context)
205
198
  end
@@ -232,10 +225,7 @@ module Ingenico::Connect::SDK
232
225
  Ingenico::Connect::SDK::Domain::Payment::PaymentResponse,
233
226
  context)
234
227
  rescue ResponseException => e
235
- error_type = {
236
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
237
- 405 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
238
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
228
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
239
229
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
240
230
  raise create_exception(e.status_code, e.body, error_object, context)
241
231
  end
@@ -307,9 +297,7 @@ module Ingenico::Connect::SDK
307
297
  Ingenico::Connect::SDK::Domain::Token::CreateTokenResponse,
308
298
  context)
309
299
  rescue ResponseException => e
310
- error_type = {
311
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
312
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
300
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
313
301
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
314
302
  raise create_exception(e.status_code, e.body, error_object, context)
315
303
  end
@@ -81,9 +81,7 @@ module Ingenico::Connect::SDK
81
81
  Ingenico::Connect::SDK::Domain::Payout::PayoutResponse,
82
82
  context)
83
83
  rescue ResponseException => e
84
- error_type = {
85
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
86
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
84
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
87
85
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
88
86
  raise create_exception(e.status_code, e.body, error_object, context)
89
87
  end
@@ -117,9 +115,7 @@ module Ingenico::Connect::SDK
117
115
  Ingenico::Connect::SDK::Domain::Payout::PayoutResponse,
118
116
  context)
119
117
  rescue ResponseException => e
120
- error_type = {
121
- 402 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
122
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
118
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
123
119
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
124
120
  raise create_exception(e.status_code, e.body, error_object, context)
125
121
  end
@@ -151,9 +147,7 @@ module Ingenico::Connect::SDK
151
147
  nil,
152
148
  context)
153
149
  rescue ResponseException => e
154
- error_type = {
155
- 402 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
156
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
150
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
157
151
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
158
152
  raise create_exception(e.status_code, e.body, error_object, context)
159
153
  end
@@ -185,9 +179,7 @@ module Ingenico::Connect::SDK
185
179
  nil,
186
180
  context)
187
181
  rescue ResponseException => e
188
- error_type = {
189
- 405 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
190
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
182
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
191
183
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
192
184
  raise create_exception(e.status_code, e.body, error_object, context)
193
185
  end
@@ -11,24 +11,23 @@ module Ingenico::Connect::SDK
11
11
  # Query parameters for {https://developer.globalcollect.com/documentation/api/server/#__merchantId__productgroups_get Get payment product groups}
12
12
  class FindProductgroupsParams < Ingenico::Connect::SDK::ParamRequest
13
13
 
14
- # Integer
15
- attr_accessor :amount
16
-
17
- # Array of String
18
- attr_accessor :hide
19
-
20
- # true/false
21
- attr_accessor :is_recurring
22
-
23
14
  # String
24
15
  attr_accessor :country_code
25
16
 
26
17
  # String
27
- attr_accessor :locale
18
+ attr_accessor :currency_code
28
19
 
29
20
  # String
30
- attr_accessor :currency_code
31
- attr_accessor :amount, :hide, :is_recurring, :country_code, :locale, :currency_code
21
+ attr_accessor :locale
22
+
23
+ # Integer
24
+ attr_accessor :amount
25
+
26
+ # true/false
27
+ attr_accessor :is_recurring
28
+
29
+ # Array of String
30
+ attr_accessor :hide
32
31
 
33
32
  # Adds the parameter _value_ to the _hide_ Array
34
33
  def add_hide(value)
@@ -41,12 +40,12 @@ module Ingenico::Connect::SDK
41
40
  # Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
42
41
  def to_request_parameters
43
42
  result = []
44
- add_parameter(result, 'amount', @amount)
45
- add_parameter(result, 'hide', @hide)
46
- add_parameter(result, 'isRecurring', @is_recurring)
47
43
  add_parameter(result, 'countryCode', @country_code)
48
- add_parameter(result, 'locale', @locale)
49
44
  add_parameter(result, 'currencyCode', @currency_code)
45
+ add_parameter(result, 'locale', @locale)
46
+ add_parameter(result, 'amount', @amount)
47
+ add_parameter(result, 'isRecurring', @is_recurring)
48
+ add_parameter(result, 'hide', @hide)
50
49
  result
51
50
  end
52
51
  end
@@ -11,24 +11,23 @@ module Ingenico::Connect::SDK
11
11
  # Query parameters for {https://developer.globalcollect.com/documentation/api/server/#__merchantId__productgroups__paymentProductGroupId__get Get payment product group}
12
12
  class GetProductgroupParams < Ingenico::Connect::SDK::ParamRequest
13
13
 
14
- # Integer
15
- attr_accessor :amount
16
-
17
- # Array of String
18
- attr_accessor :hide
19
-
20
- # true/false
21
- attr_accessor :is_recurring
22
-
23
14
  # String
24
15
  attr_accessor :country_code
25
16
 
26
17
  # String
27
- attr_accessor :locale
18
+ attr_accessor :currency_code
28
19
 
29
20
  # String
30
- attr_accessor :currency_code
31
- attr_accessor :amount, :hide, :is_recurring, :country_code, :locale, :currency_code
21
+ attr_accessor :locale
22
+
23
+ # Integer
24
+ attr_accessor :amount
25
+
26
+ # true/false
27
+ attr_accessor :is_recurring
28
+
29
+ # Array of String
30
+ attr_accessor :hide
32
31
 
33
32
  # Adds the parameter _value_ to the _hide_ Array
34
33
  def add_hide(value)
@@ -41,12 +40,12 @@ module Ingenico::Connect::SDK
41
40
  # Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
42
41
  def to_request_parameters
43
42
  result = []
44
- add_parameter(result, 'amount', @amount)
45
- add_parameter(result, 'hide', @hide)
46
- add_parameter(result, 'isRecurring', @is_recurring)
47
43
  add_parameter(result, 'countryCode', @country_code)
48
- add_parameter(result, 'locale', @locale)
49
44
  add_parameter(result, 'currencyCode', @currency_code)
45
+ add_parameter(result, 'locale', @locale)
46
+ add_parameter(result, 'amount', @amount)
47
+ add_parameter(result, 'isRecurring', @is_recurring)
48
+ add_parameter(result, 'hide', @hide)
50
49
  result
51
50
  end
52
51
  end
@@ -24,7 +24,7 @@ module Ingenico::Connect::SDK
24
24
  # Resource /{{merchantId}}/productgroups
25
25
  #
26
26
  # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__productgroups_get Get payment product groups}
27
- # query:: {Ingenico::Connect::SDK::Merchant::Productgroups::FindParams}
27
+ # query:: {Ingenico::Connect::SDK::Merchant::Productgroups::FindProductgroupsParams}
28
28
  # context:: {Ingenico::Connect::SDK::CallContext}
29
29
  # Returns:: {Ingenico::Connect::SDK::Domain::Product::PaymentProductGroups}
30
30
  # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
@@ -54,7 +54,7 @@ module Ingenico::Connect::SDK
54
54
  #
55
55
  # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__productgroups__paymentProductGroupId__get Get payment product group}
56
56
  # payment_product_group_id:: String
57
- # query:: {Ingenico::Connect::SDK::Merchant::Productgroups::GetParams}
57
+ # query:: {Ingenico::Connect::SDK::Merchant::Productgroups::GetProductgroupParams}
58
58
  # context:: {Ingenico::Connect::SDK::CallContext}
59
59
  # Returns:: {Ingenico::Connect::SDK::Domain::Product::PaymentProductGroupResponse}
60
60
  # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
@@ -78,9 +78,7 @@ module Ingenico::Connect::SDK
78
78
  Ingenico::Connect::SDK::Domain::Product::PaymentProductGroupResponse,
79
79
  context)
80
80
  rescue ResponseException => e
81
- error_type = {
82
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
83
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
81
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
84
82
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
85
83
  raise create_exception(e.status_code, e.body, error_object, context)
86
84
  end
@@ -12,17 +12,16 @@ module Ingenico::Connect::SDK
12
12
  class DirectoryParams < Ingenico::Connect::SDK::ParamRequest
13
13
 
14
14
  # String
15
- attr_accessor :currency_code
15
+ attr_accessor :country_code
16
16
 
17
17
  # String
18
- attr_accessor :country_code
19
- attr_accessor :currency_code, :country_code
18
+ attr_accessor :currency_code
20
19
 
21
20
  # Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
22
21
  def to_request_parameters
23
22
  result = []
24
- add_parameter(result, 'currencyCode', @currency_code)
25
23
  add_parameter(result, 'countryCode', @country_code)
24
+ add_parameter(result, 'currencyCode', @currency_code)
26
25
  result
27
26
  end
28
27
  end
@@ -11,24 +11,23 @@ module Ingenico::Connect::SDK
11
11
  # Query parameters for {https://developer.globalcollect.com/documentation/api/server/#__merchantId__products_get Get payment products}
12
12
  class FindProductsParams < Ingenico::Connect::SDK::ParamRequest
13
13
 
14
- # Integer
15
- attr_accessor :amount
16
-
17
- # Array of String
18
- attr_accessor :hide
19
-
20
- # true/false
21
- attr_accessor :is_recurring
22
-
23
14
  # String
24
15
  attr_accessor :country_code
25
16
 
26
17
  # String
27
- attr_accessor :locale
18
+ attr_accessor :currency_code
28
19
 
29
20
  # String
30
- attr_accessor :currency_code
31
- attr_accessor :amount, :hide, :is_recurring, :country_code, :locale, :currency_code
21
+ attr_accessor :locale
22
+
23
+ # Integer
24
+ attr_accessor :amount
25
+
26
+ # true/false
27
+ attr_accessor :is_recurring
28
+
29
+ # Array of String
30
+ attr_accessor :hide
32
31
 
33
32
  # Adds the parameter _value_ to the _hide_ Array
34
33
  def add_hide(value)
@@ -41,12 +40,12 @@ module Ingenico::Connect::SDK
41
40
  # Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
42
41
  def to_request_parameters
43
42
  result = []
44
- add_parameter(result, 'amount', @amount)
45
- add_parameter(result, 'hide', @hide)
46
- add_parameter(result, 'isRecurring', @is_recurring)
47
43
  add_parameter(result, 'countryCode', @country_code)
48
- add_parameter(result, 'locale', @locale)
49
44
  add_parameter(result, 'currencyCode', @currency_code)
45
+ add_parameter(result, 'locale', @locale)
46
+ add_parameter(result, 'amount', @amount)
47
+ add_parameter(result, 'isRecurring', @is_recurring)
48
+ add_parameter(result, 'hide', @hide)
50
49
  result
51
50
  end
52
51
  end
@@ -11,24 +11,23 @@ module Ingenico::Connect::SDK
11
11
  # Query parameters for {https://developer.globalcollect.com/documentation/api/server/#__merchantId__products__paymentProductId__get Get payment product}
12
12
  class GetProductParams < Ingenico::Connect::SDK::ParamRequest
13
13
 
14
- # Integer
15
- attr_accessor :amount
16
-
17
- # Array of String
18
- attr_accessor :hide
19
-
20
- # true/false
21
- attr_accessor :is_recurring
22
-
23
14
  # String
24
15
  attr_accessor :country_code
25
16
 
26
17
  # String
27
- attr_accessor :locale
18
+ attr_accessor :currency_code
28
19
 
29
20
  # String
30
- attr_accessor :currency_code
31
- attr_accessor :amount, :hide, :is_recurring, :country_code, :locale, :currency_code
21
+ attr_accessor :locale
22
+
23
+ # Integer
24
+ attr_accessor :amount
25
+
26
+ # true/false
27
+ attr_accessor :is_recurring
28
+
29
+ # Array of String
30
+ attr_accessor :hide
32
31
 
33
32
  # Adds the parameter _value_ to the _hide_ Array
34
33
  def add_hide(value)
@@ -41,12 +40,12 @@ module Ingenico::Connect::SDK
41
40
  # Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
42
41
  def to_request_parameters
43
42
  result = []
44
- add_parameter(result, 'amount', @amount)
45
- add_parameter(result, 'hide', @hide)
46
- add_parameter(result, 'isRecurring', @is_recurring)
47
43
  add_parameter(result, 'countryCode', @country_code)
48
- add_parameter(result, 'locale', @locale)
49
44
  add_parameter(result, 'currencyCode', @currency_code)
45
+ add_parameter(result, 'locale', @locale)
46
+ add_parameter(result, 'amount', @amount)
47
+ add_parameter(result, 'isRecurring', @is_recurring)
48
+ add_parameter(result, 'hide', @hide)
50
49
  result
51
50
  end
52
51
  end
@@ -22,7 +22,6 @@ module Ingenico::Connect::SDK
22
22
 
23
23
  # true/false
24
24
  attr_accessor :is_recurring
25
- attr_accessor :country_code, :currency_code, :amount, :is_recurring
26
25
 
27
26
  # Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
28
27
  def to_request_parameters
@@ -27,7 +27,7 @@ module Ingenico::Connect::SDK
27
27
  # Resource /{{merchantId}}/products
28
28
  #
29
29
  # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__products_get Get payment products}
30
- # query:: {Ingenico::Connect::SDK::Merchant::Products::FindParams}
30
+ # query:: {Ingenico::Connect::SDK::Merchant::Products::FindProductsParams}
31
31
  # context:: {Ingenico::Connect::SDK::CallContext}
32
32
  # Returns:: {Ingenico::Connect::SDK::Domain::Product::PaymentProducts}
33
33
  # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
@@ -57,7 +57,7 @@ module Ingenico::Connect::SDK
57
57
  #
58
58
  # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__products__paymentProductId__get Get payment product}
59
59
  # payment_product_id:: Integer
60
- # query:: {Ingenico::Connect::SDK::Merchant::Products::GetParams}
60
+ # query:: {Ingenico::Connect::SDK::Merchant::Products::GetProductParams}
61
61
  # context:: {Ingenico::Connect::SDK::CallContext}
62
62
  # Returns:: {Ingenico::Connect::SDK::Domain::Product::PaymentProductResponse}
63
63
  # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
@@ -114,9 +114,7 @@ module Ingenico::Connect::SDK
114
114
  Ingenico::Connect::SDK::Domain::Product::Directory,
115
115
  context)
116
116
  rescue ResponseException => e
117
- error_type = {
118
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
119
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
117
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
120
118
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
121
119
  raise create_exception(e.status_code, e.body, error_object, context)
122
120
  end
@@ -149,9 +147,7 @@ module Ingenico::Connect::SDK
149
147
  Ingenico::Connect::SDK::Domain::Product::PaymentProductNetworksResponse,
150
148
  context)
151
149
  rescue ResponseException => e
152
- error_type = {
153
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
154
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
150
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
155
151
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
156
152
  raise create_exception(e.status_code, e.body, error_object, context)
157
153
  end
@@ -183,9 +179,7 @@ module Ingenico::Connect::SDK
183
179
  Ingenico::Connect::SDK::Domain::Publickey::PublicKey,
184
180
  context)
185
181
  rescue ResponseException => e
186
- error_type = {
187
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
188
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
182
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
189
183
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
190
184
  raise create_exception(e.status_code, e.body, error_object, context)
191
185
  end
@@ -14,19 +14,18 @@ module Ingenico::Connect::SDK
14
14
  # String
15
15
  attr_accessor :source
16
16
 
17
- # Integer
18
- attr_accessor :amount
19
-
20
17
  # String
21
18
  attr_accessor :target
22
- attr_accessor :source, :amount, :target
19
+
20
+ # Integer
21
+ attr_accessor :amount
23
22
 
24
23
  # Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
25
24
  def to_request_parameters
26
25
  result = []
27
26
  add_parameter(result, 'source', @source)
28
- add_parameter(result, 'amount', @amount)
29
27
  add_parameter(result, 'target', @target)
28
+ add_parameter(result, 'amount', @amount)
30
29
  result
31
30
  end
32
31
  end
@@ -107,9 +107,7 @@ module Ingenico::Connect::SDK
107
107
  Ingenico::Connect::SDK::Domain::Services::GetIINDetailsResponse,
108
108
  context)
109
109
  rescue ResponseException => e
110
- error_type = {
111
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
112
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
110
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
113
111
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
114
112
  raise create_exception(e.status_code, e.body, error_object, context)
115
113
  end
@@ -137,9 +135,7 @@ module Ingenico::Connect::SDK
137
135
  Ingenico::Connect::SDK::Domain::Services::TestConnection,
138
136
  context)
139
137
  rescue ResponseException => e
140
- error_type = {
141
- 403 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
142
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
138
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
143
139
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
144
140
  raise create_exception(e.status_code, e.body, error_object, context)
145
141
  end
@@ -13,7 +13,6 @@ module Ingenico::Connect::SDK
13
13
 
14
14
  # String
15
15
  attr_accessor :mandate_cancel_date
16
- attr_accessor :mandate_cancel_date
17
16
 
18
17
  # Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
19
18
  def to_request_parameters
@@ -46,19 +46,17 @@ module Ingenico::Connect::SDK
46
46
  Ingenico::Connect::SDK::Domain::Token::CreateTokenResponse,
47
47
  context)
48
48
  rescue ResponseException => e
49
- error_type = {
50
- 403 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
51
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
49
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
52
50
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
53
51
  raise create_exception(e.status_code, e.body, error_object, context)
54
52
  end
55
53
 
56
54
  # Resource /{{merchantId}}/tokens/{{tokenId}}
57
55
  #
58
- # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__delete Delete token}
56
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__get Get token}
59
57
  # token_id:: String
60
- # query:: {Ingenico::Connect::SDK::Merchant::Tokens::DeleteParams}
61
58
  # context:: {Ingenico::Connect::SDK::CallContext}
59
+ # Returns:: {Ingenico::Connect::SDK::Domain::Token::TokenResponse}
62
60
  # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
63
61
  # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
64
62
  # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
@@ -68,31 +66,29 @@ module Ingenico::Connect::SDK
68
66
  # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
69
67
  # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
70
68
  # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
71
- def delete(token_id, query, context=nil)
69
+ def get(token_id, context=nil)
72
70
  path_context = {
73
71
  'tokenId' => token_id,
74
72
  }
75
73
  uri = instantiate_uri('/{apiVersion}/{merchantId}/tokens/{tokenId}', path_context)
76
- return @communicator.delete(
74
+ return @communicator.get(
77
75
  uri,
78
76
  client_headers,
79
- query,
80
77
  nil,
78
+ Ingenico::Connect::SDK::Domain::Token::TokenResponse,
81
79
  context)
82
80
  rescue ResponseException => e
83
- error_type = {
84
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
85
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
81
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
86
82
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
87
83
  raise create_exception(e.status_code, e.body, error_object, context)
88
84
  end
89
85
 
90
86
  # Resource /{{merchantId}}/tokens/{{tokenId}}
91
87
  #
92
- # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__get Get token}
88
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__put Update token}
93
89
  # token_id:: String
90
+ # body:: {Ingenico::Connect::SDK::Domain::Token::UpdateTokenRequest}
94
91
  # context:: {Ingenico::Connect::SDK::CallContext}
95
- # Returns:: {Ingenico::Connect::SDK::Domain::Token::TokenResponse}
96
92
  # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
97
93
  # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
98
94
  # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
@@ -102,30 +98,29 @@ module Ingenico::Connect::SDK
102
98
  # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
103
99
  # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
104
100
  # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
105
- def get(token_id, context=nil)
101
+ def update(token_id, body, context=nil)
106
102
  path_context = {
107
103
  'tokenId' => token_id,
108
104
  }
109
105
  uri = instantiate_uri('/{apiVersion}/{merchantId}/tokens/{tokenId}', path_context)
110
- return @communicator.get(
106
+ return @communicator.put(
111
107
  uri,
112
108
  client_headers,
113
109
  nil,
114
- Ingenico::Connect::SDK::Domain::Token::TokenResponse,
110
+ body,
111
+ nil,
115
112
  context)
116
113
  rescue ResponseException => e
117
- error_type = {
118
- 404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
119
- }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
114
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
120
115
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
121
116
  raise create_exception(e.status_code, e.body, error_object, context)
122
117
  end
123
118
 
124
119
  # Resource /{{merchantId}}/tokens/{{tokenId}}
125
120
  #
126
- # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__put Update token}
121
+ # {https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__delete Delete token}
127
122
  # token_id:: String
128
- # body:: {Ingenico::Connect::SDK::Domain::Token::UpdateTokenRequest}
123
+ # query:: {Ingenico::Connect::SDK::Merchant::Tokens::DeleteTokenParams}
129
124
  # context:: {Ingenico::Connect::SDK::CallContext}
130
125
  # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
131
126
  # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
@@ -136,16 +131,15 @@ module Ingenico::Connect::SDK
136
131
  # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
137
132
  # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
138
133
  # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
139
- def update(token_id, body, context=nil)
134
+ def delete(token_id, query, context=nil)
140
135
  path_context = {
141
136
  'tokenId' => token_id,
142
137
  }
143
138
  uri = instantiate_uri('/{apiVersion}/{merchantId}/tokens/{tokenId}', path_context)
144
- return @communicator.put(
139
+ return @communicator.delete(
145
140
  uri,
146
141
  client_headers,
147
- nil,
148
- body,
142
+ query,
149
143
  nil,
150
144
  context)
151
145
  rescue ResponseException => e
@@ -5,7 +5,7 @@ module Ingenico::Connect::SDK
5
5
 
6
6
  # Manages metadata about the server using the SDK
7
7
  class MetaDataProvider
8
- @@SDK_VERSION = '1.5.0'
8
+ @@SDK_VERSION = '1.5.1'
9
9
  @@SERVER_META_INFO_HEADER = 'X-GCS-ServerMetaInfo'
10
10
  @@PROHIBITED_HEADERS = [@@SERVER_META_INFO_HEADER, 'X-GCS-Idempotence-Key',
11
11
  'Date', 'Content-Type', 'Authorization'].sort!.freeze
@@ -10,7 +10,7 @@ module Ingenico::Connect::SDK
10
10
  raise ArgumentError.new('name is required')
11
11
  end
12
12
  @name = name
13
- @value = value
13
+ @value = normalize_value(value)
14
14
  end
15
15
 
16
16
  # HTTP header name
@@ -21,5 +21,18 @@ module Ingenico::Connect::SDK
21
21
  def to_s
22
22
  "#{name}:#{value}"
23
23
  end
24
+
25
+ private
26
+
27
+ def normalize_value(value)
28
+ if value.nil? || value.empty?
29
+ return value
30
+ end
31
+ # Replace all sequences of whitespace*-linebreak-whitespace* into a single linebreak-space
32
+ # This will ensure that:
33
+ # - no line ends with whitespace, because this causes authentication failures
34
+ # - each line starts with a single whitespace, so it is a valid header value
35
+ value.gsub(/[\s&&[^\r\n]]*(\r?\n)[\s&&[^\r\n]]*/, '\1 ');
36
+ end
24
37
  end
25
38
  end
@@ -16,15 +16,21 @@ describe 'multiline headers' do
16
16
  configuration = Integration.init_communicator_configuration
17
17
  meta_data_provider = Ingenico::Connect::SDK::MetaDataProvider.new('Ingenico', additional_request_headers:
18
18
  [Ingenico::Connect::SDK::RequestHeader.new('X-GCS-MultiLineHeader', multi_line_header)])
19
- session = Ingenico::Connect::SDK::Factory.create_session_from_configuration(configuration)
19
+ session = Ingenico::Connect::SDK::Factory.create_session_from_configuration(configuration, meta_data_provider:
20
+ meta_data_provider)
20
21
 
21
22
  params = Ingenico::Connect::SDK::Merchant::Products::DirectoryParams.new
22
23
  params.country_code = 'NL'
23
24
  params.currency_code = 'EUR'
24
25
 
25
- Integration.init_client(false) do |client|
26
+ init_client_from_session(session) do |client|
26
27
  response = client.merchant(Integration::MERCHANT_ID).products.directory(809, params)
27
28
  expect(response.entries.length).to be > 0
28
29
  end
29
30
  end
30
31
  end
32
+
33
+ def init_client_from_session(session)
34
+ yield client = Ingenico::Connect::SDK::Factory.create_client_from_session(session).with_client_meta_info('{"test":"test"}')
35
+ client.close
36
+ end
@@ -41,7 +41,7 @@ module ValidationDict
41
41
  message =~ REQUEST_START
42
42
  id = $1 # capture id from the regular expression above
43
43
  expect(message).to match(GET_METHOD)
44
- expect(message).to match(%r(uri: '/v1/1234/services/convert/amount\?source=EUR&amount=1000&target=USD'))
44
+ expect(message).to match(%r(uri: '/v1/1234/services/convert/amount\?source=EUR&target=USD&amount=1000'))
45
45
  validate_request_headers(message)
46
46
  return id
47
47
  end
@@ -248,7 +248,7 @@ describe 'DefaultConnectionLogging' do
248
248
  it 'can log a GET request with parameters' do
249
249
  response_body = IO.read(resource_prefix + 'convertAmount.json')
250
250
 
251
- stub_request(:get, 'https://api-sandbox.globalcollect.com/v1/1234/services/convert/amount?amount=1000&source=EUR&target=USD')
251
+ stub_request(:get, 'https://api-sandbox.globalcollect.com/v1/1234/services/convert/amount?source=EUR&target=USD&amount=1000')
252
252
  .to_return(status: 200, body: response_body,
253
253
  headers: base_headers.merge({'Content-Type' => 'application/json'}))
254
254
 
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: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ingenico ePayments
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient