connect-sdk-ruby 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54d2e018476618a5435789d3793312366ee8febd
4
- data.tar.gz: 5f7bc50af6e8c0498e0c93080422a9537b37534d
3
+ metadata.gz: 85c0d7f702a3ef4aa7a1bf4e2c83ebc9c2199aaa
4
+ data.tar.gz: 88edb5adb9229f3036aa266fdd9f7fa66269d0f7
5
5
  SHA512:
6
- metadata.gz: 23ef22881eac022eda873d7d320eb418457ef9cddef220ec27b60dec0ffe7aa92b40b99289f81bc9113f44e787de49004a8f65da3d0938e317fc7a9b5ab10c06
7
- data.tar.gz: ea436be7d2cf7f322b9905922c5af602757f937266723ede447fbcf641992d15cdc3848c018a5940ac02a06d3a1d2b2f9ebdd2ffb52b4bf14cb076e4f592abfe
6
+ metadata.gz: 09402138eb1e17e54f88208f7d5ea73defd4ec165fa56708e198b786d25b3007ca1f70dde785fe6358c7821455aba3a0419ec9c944d9faadf2abe72270e55cac
7
+ data.tar.gz: 8de8c3c286df14bc037b046abe1158eb634ac31583dad110360d958269143106b0befadaae812baeac504c00130445a6d9ec9b264d44a764c715358e3173f9e0
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'connect-sdk-ruby'
3
- spec.version = '1.6.0'
3
+ spec.version = '1.7.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 GlobalCollect platform using the Ingenico Connect Server API}
@@ -0,0 +1,38 @@
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/factory'
6
+ require 'ingenico/connect/sdk/domain/definitions/card_without_cvv'
7
+ require 'ingenico/connect/sdk/domain/payment/complete_payment_card_payment_method_specific_input'
8
+ require 'ingenico/connect/sdk/domain/payment/complete_payment_request'
9
+
10
+ Definitions = Ingenico::Connect::SDK::Domain::Definitions
11
+ Payment = Ingenico::Connect::SDK::Domain::Payment
12
+
13
+ def example
14
+ get_client do |client|
15
+ card = Definitions::CardWithoutCvv.new
16
+ card.card_number = '67030000000000003'
17
+ card.cardholder_name = 'Wile E. Coyote'
18
+ card.expiry_date = '1220'
19
+
20
+ card_payment_method_specific_input = Payment::CompletePaymentCardPaymentMethodSpecificInput.new
21
+ card_payment_method_specific_input.card = card
22
+
23
+ body = Payment::CompletePaymentRequest.new
24
+ body.card_payment_method_specific_input = card_payment_method_specific_input
25
+
26
+ response = client.merchant('merchantId').payments().complete('paymentId', body)
27
+ end
28
+ end
29
+
30
+ def get_client
31
+ api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
32
+ secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
33
+ configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
34
+ yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
35
+ ensure
36
+ # Free networking resources when done
37
+ client.close unless client.nil?
38
+ end
@@ -0,0 +1,22 @@
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/factory'
6
+
7
+
8
+ def example
9
+ get_client do |client|
10
+ response = client.merchant('merchantId').payments().third_party_status('paymentId')
11
+ end
12
+ end
13
+
14
+ def get_client
15
+ api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
16
+ secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
17
+ configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
18
+ yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
19
+ ensure
20
+ # Free networking resources when done
21
+ client.close unless client.nil?
22
+ end
@@ -15,6 +15,7 @@ def example
15
15
  query.locale = 'en_US'
16
16
  query.amount = 1000
17
17
  query.is_recurring = true
18
+ query.force_basic_flow = false
18
19
  query.add_hide('fields')
19
20
 
20
21
  response = client.merchant('merchantId').products().get(1, query)
@@ -4,7 +4,7 @@ module Ingenico::Connect::SDK::Domain::Metadata
4
4
 
5
5
  # Represents metadata part of shopping carts.
6
6
  class ShoppingCartExtension < Ingenico::Connect::SDK::DataObject
7
- def initialize(creator, name, version)
7
+ def initialize(creator, name, version, extension_id=nil)
8
8
  raise ArgumentError.new if creator.nil? or creator.strip.empty?
9
9
  raise ArgumentError.new if name.nil? or name.strip.empty?
10
10
  raise ArgumentError.new if version.nil? or version.to_s.strip.empty?
@@ -12,10 +12,11 @@ module Ingenico::Connect::SDK::Domain::Metadata
12
12
  @creator = creator
13
13
  @name = name
14
14
  @version = version.to_s
15
+ @extension_id = extension_id
15
16
  end
16
17
 
17
18
  # Constructs a new ShoppingCartExtension from parameter hash
18
- # the hash should contain a _creator_, _name_ and _version_
19
+ # the hash should contain a _creator_, _name_, _version_ and _extensionId_
19
20
  #--
20
21
  # Overridden so ShoppingCartExtension can retain mandatory default arguments
21
22
  #++
@@ -23,7 +24,8 @@ module Ingenico::Connect::SDK::Domain::Metadata
23
24
  creator = hash['creator'] if hash.has_key?('creator')
24
25
  name = hash['name'] if hash.has_key?('name')
25
26
  version = hash['version'] if hash.has_key?('version')
26
- self.new(creator, name, version)
27
+ extension_id = hash['extensionId'] if hash.has_key?('extensionId')
28
+ self.new(creator, name, version, extension_id)
27
29
  end
28
30
 
29
31
  # Converts the shopping cart metadata to a hash
@@ -32,6 +34,7 @@ module Ingenico::Connect::SDK::Domain::Metadata
32
34
  add_to_hash(hash, 'creator', @creator)
33
35
  add_to_hash(hash, 'name', @name)
34
36
  add_to_hash(hash, 'version', @version)
37
+ add_to_hash(hash, 'extensionId', @extension_id)
35
38
  hash
36
39
  end
37
40
 
@@ -41,8 +44,9 @@ module Ingenico::Connect::SDK::Domain::Metadata
41
44
  @creator = hash['creator'] if hash.has_key?('creator')
42
45
  @name = hash['name'] if hash.has_key?('name')
43
46
  @version = hash['version'] if hash.has_key?('version')
47
+ @extension_id = hash['extensionId'] if hash.has_key?('extensionId')
44
48
  end
45
49
 
46
- attr_reader :creator, :name, :version
50
+ attr_reader :creator, :name, :version, :extension_id
47
51
  end
48
52
  end
@@ -0,0 +1,35 @@
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
+ require 'ingenico/connect/sdk/domain/definitions/card_without_cvv'
7
+
8
+ module Ingenico::Connect::SDK
9
+ module Domain
10
+ module Payment
11
+
12
+ class CompletePaymentCardPaymentMethodSpecificInput < Ingenico::Connect::SDK::DataObject
13
+
14
+ # {Ingenico::Connect::SDK::Domain::Definitions::CardWithoutCvv}
15
+ attr_accessor :card
16
+
17
+ def to_h
18
+ hash = super
19
+ add_to_hash(hash, 'card', @card)
20
+ hash
21
+ end
22
+
23
+ def from_hash(hash)
24
+ super
25
+ if hash.has_key?('card')
26
+ if !(hash['card'].is_a? Hash)
27
+ raise TypeError, "value '%s' is not a Hash" % [hash['card']]
28
+ end
29
+ @card = Ingenico::Connect::SDK::Domain::Definitions::CardWithoutCvv.new_from_hash(hash['card'])
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
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
+ require 'ingenico/connect/sdk/domain/payment/complete_payment_card_payment_method_specific_input'
7
+
8
+ module Ingenico::Connect::SDK
9
+ module Domain
10
+ module Payment
11
+
12
+ class CompletePaymentRequest < Ingenico::Connect::SDK::DataObject
13
+
14
+ # {Ingenico::Connect::SDK::Domain::Payment::CompletePaymentCardPaymentMethodSpecificInput}
15
+ attr_accessor :card_payment_method_specific_input
16
+
17
+ def to_h
18
+ hash = super
19
+ add_to_hash(hash, 'cardPaymentMethodSpecificInput', @card_payment_method_specific_input)
20
+ hash
21
+ end
22
+
23
+ def from_hash(hash)
24
+ super
25
+ if hash.has_key?('cardPaymentMethodSpecificInput')
26
+ if !(hash['cardPaymentMethodSpecificInput'].is_a? Hash)
27
+ raise TypeError, "value '%s' is not a Hash" % [hash['cardPaymentMethodSpecificInput']]
28
+ end
29
+ @card_payment_method_specific_input = Ingenico::Connect::SDK::Domain::Payment::CompletePaymentCardPaymentMethodSpecificInput.new_from_hash(hash['cardPaymentMethodSpecificInput'])
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,15 @@
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/domain/payment/create_payment_result'
6
+
7
+ module Ingenico::Connect::SDK
8
+ module Domain
9
+ module Payment
10
+
11
+ class CompletePaymentResponse < Ingenico::Connect::SDK::Domain::Payment::CreatePaymentResult
12
+ end
13
+ end
14
+ end
15
+ end
@@ -5,6 +5,7 @@
5
5
  require 'ingenico/connect/sdk/data_object'
6
6
  require 'ingenico/connect/sdk/domain/definitions/key_value_pair'
7
7
  require 'ingenico/connect/sdk/domain/payment/redirect_data'
8
+ require 'ingenico/connect/sdk/domain/product/payment_product_field'
8
9
 
9
10
  module Ingenico::Connect::SDK
10
11
  module Domain
@@ -15,6 +16,9 @@ module Ingenico::Connect::SDK
15
16
  # String
16
17
  attr_accessor :action_type
17
18
 
19
+ # Array of {Ingenico::Connect::SDK::Domain::Product::PaymentProductField}
20
+ attr_accessor :form_fields
21
+
18
22
  # {Ingenico::Connect::SDK::Domain::Payment::RedirectData}
19
23
  attr_accessor :redirect_data
20
24
 
@@ -27,6 +31,7 @@ module Ingenico::Connect::SDK
27
31
  def to_h
28
32
  hash = super
29
33
  add_to_hash(hash, 'actionType', @action_type)
34
+ add_to_hash(hash, 'formFields', @form_fields)
30
35
  add_to_hash(hash, 'redirectData', @redirect_data)
31
36
  add_to_hash(hash, 'renderingData', @rendering_data)
32
37
  add_to_hash(hash, 'showData', @show_data)
@@ -38,6 +43,15 @@ module Ingenico::Connect::SDK
38
43
  if hash.has_key?('actionType')
39
44
  @action_type = hash['actionType']
40
45
  end
46
+ if hash.has_key?('formFields')
47
+ if !(hash['formFields'].is_a? Array)
48
+ raise TypeError, "value '%s' is not an Array" % [hash['formFields']]
49
+ end
50
+ @form_fields = []
51
+ hash['formFields'].each do |e|
52
+ @form_fields << Ingenico::Connect::SDK::Domain::Product::PaymentProductField.new_from_hash(e)
53
+ end
54
+ end
41
55
  if hash.has_key?('redirectData')
42
56
  if !(hash['redirectData'].is_a? Hash)
43
57
  raise TypeError, "value '%s' is not a Hash" % [hash['redirectData']]
@@ -0,0 +1,31 @@
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
+ class ThirdPartyStatusResponse < Ingenico::Connect::SDK::DataObject
12
+
13
+ # String
14
+ attr_accessor :third_party_status
15
+
16
+ def to_h
17
+ hash = super
18
+ add_to_hash(hash, 'thirdPartyStatus', @third_party_status)
19
+ hash
20
+ end
21
+
22
+ def from_hash(hash)
23
+ super
24
+ if hash.has_key?('thirdPartyStatus')
25
+ @third_party_status = hash['thirdPartyStatus']
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -103,13 +103,14 @@ module Ingenico::Connect::SDK
103
103
  end
104
104
 
105
105
  def get_shopping_cart_extension(properties, prefix)
106
- creator= properties[prefix + '.shoppingCartExtension.creator']
107
- name= properties[prefix + '.shoppingCartExtension.name']
108
- version= properties[prefix + '.shoppingCartExtension.version']
109
- if creator.nil? && name.nil? && version.nil?
106
+ creator = properties[prefix + '.shoppingCartExtension.creator']
107
+ name = properties[prefix + '.shoppingCartExtension.name']
108
+ version = properties[prefix + '.shoppingCartExtension.version']
109
+ extension_id = properties[prefix + '.shoppingCartExtension.extensionId']
110
+ if creator.nil? && name.nil? && version.nil? && extension_id.nil?
110
111
  nil
111
112
  else
112
- Domain::Metadata::ShoppingCartExtension.new(creator, name, version)
113
+ Domain::Metadata::ShoppingCartExtension.new(creator, name, version, extension_id)
113
114
  end
114
115
  end
115
116
 
@@ -9,10 +9,12 @@ require 'ingenico/connect/sdk/domain/capture/captures_response'
9
9
  require 'ingenico/connect/sdk/domain/errors/error_response'
10
10
  require 'ingenico/connect/sdk/domain/payment/cancel_approval_payment_response'
11
11
  require 'ingenico/connect/sdk/domain/payment/cancel_payment_response'
12
+ require 'ingenico/connect/sdk/domain/payment/complete_payment_response'
12
13
  require 'ingenico/connect/sdk/domain/payment/create_payment_response'
13
14
  require 'ingenico/connect/sdk/domain/payment/payment_approval_response'
14
15
  require 'ingenico/connect/sdk/domain/payment/payment_error_response'
15
16
  require 'ingenico/connect/sdk/domain/payment/payment_response'
17
+ require 'ingenico/connect/sdk/domain/payment/third_party_status_response'
16
18
  require 'ingenico/connect/sdk/domain/refund/refund_error_response'
17
19
  require 'ingenico/connect/sdk/domain/refund/refund_response'
18
20
  require 'ingenico/connect/sdk/domain/token/create_token_response'
@@ -199,6 +201,72 @@ module Ingenico::Connect::SDK
199
201
  raise create_exception(e.status_code, e.body, error_object, context)
200
202
  end
201
203
 
204
+ # Resource /{{merchantId}}/payments/{{paymentId}}/complete
205
+ #
206
+ # {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/payments/complete.html Complete payment}
207
+ # payment_id:: String
208
+ # body:: {Ingenico::Connect::SDK::Domain::Payment::CompletePaymentRequest}
209
+ # context:: {Ingenico::Connect::SDK::CallContext}
210
+ # Returns:: {Ingenico::Connect::SDK::Domain::Payment::CompletePaymentResponse}
211
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
212
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
213
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
214
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
215
+ # or there was a conflict (HTTP status code 404, 409 or 410)
216
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
217
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
218
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
219
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
220
+ def complete(payment_id, body, context=nil)
221
+ path_context = {
222
+ 'paymentId' => payment_id,
223
+ }
224
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/complete', path_context)
225
+ return @communicator.post(
226
+ uri,
227
+ client_headers,
228
+ nil,
229
+ body,
230
+ Ingenico::Connect::SDK::Domain::Payment::CompletePaymentResponse,
231
+ context)
232
+ rescue ResponseException => e
233
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
234
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
235
+ raise create_exception(e.status_code, e.body, error_object, context)
236
+ end
237
+
238
+ # Resource /{{merchantId}}/payments/{{paymentId}}/thirdpartystatus
239
+ #
240
+ # {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/payments/thirdPartyStatus.html Third party status poll}
241
+ # payment_id:: String
242
+ # context:: {Ingenico::Connect::SDK::CallContext}
243
+ # Returns:: {Ingenico::Connect::SDK::Domain::Payment::ThirdPartyStatusResponse}
244
+ # Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
245
+ # Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
246
+ # Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
247
+ # Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
248
+ # or there was a conflict (HTTP status code 404, 409 or 410)
249
+ # Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the GlobalCollect platform,
250
+ # the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
251
+ # or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
252
+ # Raises:: {Ingenico::Connect::SDK::ApiException} if the GlobalCollect platform returned any other error
253
+ def third_party_status(payment_id, context=nil)
254
+ path_context = {
255
+ 'paymentId' => payment_id,
256
+ }
257
+ uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/thirdpartystatus', path_context)
258
+ return @communicator.get(
259
+ uri,
260
+ client_headers,
261
+ nil,
262
+ Ingenico::Connect::SDK::Domain::Payment::ThirdPartyStatusResponse,
263
+ context)
264
+ rescue ResponseException => e
265
+ error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
266
+ error_object = @communicator.marshaller.unmarshal(e.body, error_type)
267
+ raise create_exception(e.status_code, e.body, error_object, context)
268
+ end
269
+
202
270
  # Resource /{{merchantId}}/payments/{{paymentId}}/cancel
203
271
  #
204
272
  # {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/payments/cancel.html Cancel payment}
@@ -234,7 +302,7 @@ module Ingenico::Connect::SDK
234
302
 
235
303
  # Resource /{{merchantId}}/payments/{{paymentId}}/cancelapproval
236
304
  #
237
- # {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/payments/cancelapproval.html Undo capture payment request}
305
+ # {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/payments/cancelapproval.html Undo capture payment}
238
306
  # payment_id:: String
239
307
  # context:: {Ingenico::Connect::SDK::CallContext}
240
308
  # Returns:: {Ingenico::Connect::SDK::Domain::Payment::CancelApprovalPaymentResponse}
@@ -29,6 +29,9 @@ module Ingenico::Connect::SDK
29
29
  # Array of String
30
30
  attr_accessor :hide
31
31
 
32
+ # true/false
33
+ attr_accessor :force_basic_flow
34
+
32
35
  # Adds the parameter _value_ to the _hide_ Array
33
36
  def add_hide(value)
34
37
  unless @hide
@@ -46,6 +49,7 @@ module Ingenico::Connect::SDK
46
49
  add_parameter(result, 'amount', @amount)
47
50
  add_parameter(result, 'isRecurring', @is_recurring)
48
51
  add_parameter(result, 'hide', @hide)
52
+ add_parameter(result, 'forceBasicFlow', @force_basic_flow)
49
53
  result
50
54
  end
51
55
  end
@@ -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.6.0'
8
+ @@SDK_VERSION = '1.7.0'
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
@@ -157,7 +157,8 @@ describe 'CommunicatorConfiguration' do
157
157
  connect.api.integrator: Ingenico.Integrator
158
158
  connect.api.shoppingCartExtension.creator: Ingenico.Creator
159
159
  connect.api.shoppingCartExtension.name: Ingenico.ShoppingCarts
160
- connect.api.shoppingCartExtension.version: 1.0'
160
+ connect.api.shoppingCartExtension.version: 1.0
161
+ connect.api.shoppingCartExtension.extensionId: ExtensionId'
161
162
  config = YAML.load(yaml)
162
163
 
163
164
  communicator_config = CommunicatorConfiguration.new(properties: config)
@@ -175,5 +176,6 @@ describe 'CommunicatorConfiguration' do
175
176
  expect(communicator_config.shopping_cart_extension.creator).to eq('Ingenico.Creator')
176
177
  expect(communicator_config.shopping_cart_extension.name).to eq('Ingenico.ShoppingCarts')
177
178
  expect(communicator_config.shopping_cart_extension.version).to eq('1.0')
179
+ expect(communicator_config.shopping_cart_extension.extension_id).to eq('ExtensionId')
178
180
  end
179
181
  end
@@ -8,6 +8,27 @@ describe 'MetaDataProvider' do
8
8
  RequestHeader ||= Ingenico::Connect::SDK::RequestHeader
9
9
 
10
10
  it 'can give meta_data_headers with a full shopping cart' do
11
+ shopping_cart_extension = Ingenico::Connect::SDK::Domain::Metadata::ShoppingCartExtension.new('Ingenico.creator', 'Extension', '1.0', 'ExtensionId')
12
+ meta_data_provider = MetaDataProvider.new('Ingenico', shopping_cart_extension: shopping_cart_extension)
13
+
14
+ request_headers = meta_data_provider.meta_data_headers
15
+ expect(request_headers.length).to eq(1)
16
+ expect(request_headers.length).to eq(1)
17
+
18
+ # Server meta info is stored in json format and encoded using utf-8 and base64
19
+ server_meta_info_json = Base64.strict_decode64(request_headers[0].value).force_encoding('utf-8')
20
+ server_meta_info = Ingenico::Connect::SDK::DefaultImpl::DefaultMarshaller.INSTANCE.unmarshal(server_meta_info_json, MetaDataProvider::ServerMetaInfo)
21
+
22
+ expect(server_meta_info.platform_identifier).to eq(meta_data_provider.send(:get_platform_identifier))
23
+ expect(server_meta_info.sdk_identifier).to eq(meta_data_provider.send(:get_sdk_identifier))
24
+ expect(server_meta_info.sdk_creator).to eq('Ingenico')
25
+ expect(server_meta_info.shopping_cart_extension.creator).to eq(shopping_cart_extension.creator)
26
+ expect(server_meta_info.shopping_cart_extension.name).to eq(shopping_cart_extension.name)
27
+ expect(server_meta_info.shopping_cart_extension.version).to eq(shopping_cart_extension.version)
28
+ expect(server_meta_info.shopping_cart_extension.extension_id).to eq(shopping_cart_extension.extension_id)
29
+ end
30
+
31
+ it 'can give meta_data_headers with a full shopping cart without an extension id' do
11
32
  shopping_cart_extension = Ingenico::Connect::SDK::Domain::Metadata::ShoppingCartExtension.new('Ingenico.creator', 'Extension', '1.0')
12
33
  meta_data_provider = MetaDataProvider.new('Ingenico', shopping_cart_extension: shopping_cart_extension)
13
34
 
@@ -25,6 +46,7 @@ describe 'MetaDataProvider' do
25
46
  expect(server_meta_info.shopping_cart_extension.creator).to eq(shopping_cart_extension.creator)
26
47
  expect(server_meta_info.shopping_cart_extension.name).to eq(shopping_cart_extension.name)
27
48
  expect(server_meta_info.shopping_cart_extension.version).to eq(shopping_cart_extension.version)
49
+ expect(server_meta_info.shopping_cart_extension.extension_id).to eq(shopping_cart_extension.extension_id)
28
50
  end
29
51
 
30
52
  it 'provides a server_meta_info header when no additional headers are provided' do
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.6.0
4
+ version: 1.7.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: 2017-06-27 00:00:00.000000000 Z
11
+ date: 2017-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -115,9 +115,11 @@ files:
115
115
  - examples/merchant/payments/cancel_approval_payment_example.rb
116
116
  - examples/merchant/payments/cancel_payment_example.rb
117
117
  - examples/merchant/payments/capture_payment_example.rb
118
+ - examples/merchant/payments/complete_payment_example.rb
118
119
  - examples/merchant/payments/create_payment_example.rb
119
120
  - examples/merchant/payments/get_payment_captures_example.rb
120
121
  - examples/merchant/payments/get_payment_example.rb
122
+ - examples/merchant/payments/get_third_party_status_example.rb
121
123
  - examples/merchant/payments/process_challenged_payment_example.rb
122
124
  - examples/merchant/payments/refund_payment_example.rb
123
125
  - examples/merchant/payments/tokenize_payment_example.rb
@@ -240,6 +242,9 @@ files:
240
242
  - lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_output.rb
241
243
  - lib/ingenico/connect/sdk/domain/payment/cash_payment_product1503_specific_input.rb
242
244
  - lib/ingenico/connect/sdk/domain/payment/cash_payment_product1504_specific_input.rb
245
+ - lib/ingenico/connect/sdk/domain/payment/complete_payment_card_payment_method_specific_input.rb
246
+ - lib/ingenico/connect/sdk/domain/payment/complete_payment_request.rb
247
+ - lib/ingenico/connect/sdk/domain/payment/complete_payment_response.rb
243
248
  - lib/ingenico/connect/sdk/domain/payment/contact_details.rb
244
249
  - lib/ingenico/connect/sdk/domain/payment/create_payment_request.rb
245
250
  - lib/ingenico/connect/sdk/domain/payment/create_payment_response.rb
@@ -301,6 +306,7 @@ files:
301
306
  - lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_method_specific_input.rb
302
307
  - lib/ingenico/connect/sdk/domain/payment/sepa_direct_debit_payment_method_specific_output.rb
303
308
  - lib/ingenico/connect/sdk/domain/payment/shopping_cart.rb
309
+ - lib/ingenico/connect/sdk/domain/payment/third_party_status_response.rb
304
310
  - lib/ingenico/connect/sdk/domain/payment/three_d_secure_results.rb
305
311
  - lib/ingenico/connect/sdk/domain/payment/tokenize_payment_request.rb
306
312
  - lib/ingenico/connect/sdk/domain/payout/abstract_payout_method_specific_input.rb