acquiring-sdk-ruby 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/acquiring-sdk-ruby.gemspec +1 -1
  3. data/lib/worldline/acquiring/sdk/authentication/oauth2_authenticator.rb +16 -11
  4. data/lib/worldline/acquiring/sdk/authentication/oauth2_scopes.rb +73 -0
  5. data/lib/worldline/acquiring/sdk/communication/metadata_provider.rb +1 -1
  6. data/lib/worldline/acquiring/sdk/communicator_configuration.rb +8 -1
  7. data/lib/worldline/acquiring/sdk/v1/domain/additional_response_data.rb +41 -0
  8. data/lib/worldline/acquiring/sdk/v1/domain/api_account_verification_response.rb +9 -0
  9. data/lib/worldline/acquiring/sdk/v1/domain/api_action_response.rb +9 -0
  10. data/lib/worldline/acquiring/sdk/v1/domain/api_action_response_for_refund.rb +9 -0
  11. data/lib/worldline/acquiring/sdk/v1/domain/api_balance_inquiry_response.rb +18 -0
  12. data/lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb +0 -7
  13. data/lib/worldline/acquiring/sdk/v1/domain/api_payment_response.rb +9 -19
  14. data/lib/worldline/acquiring/sdk/v1/domain/api_payment_summary_for_response.rb +0 -7
  15. data/lib/worldline/acquiring/sdk/v1/domain/api_refund_resource.rb +0 -7
  16. data/lib/worldline/acquiring/sdk/v1/domain/api_refund_response.rb +12 -10
  17. data/lib/worldline/acquiring/sdk/v1/domain/api_refund_summary_for_response.rb +0 -7
  18. data/lib/worldline/acquiring/sdk/v1/domain/card_payment_data.rb +9 -0
  19. data/lib/worldline/acquiring/sdk/v1/domain/geo_coordinates.rb +41 -0
  20. data/lib/worldline/acquiring/sdk/v1/domain/plain_card_data.rb +7 -0
  21. data/lib/worldline/acquiring/sdk/v1/domain/point_of_sale_data_for_response.rb +12 -0
  22. data/lib/worldline/acquiring/sdk/v1/domain/service_location_address.rb +55 -0
  23. data/lib/worldline/acquiring/sdk/v1/domain/service_location_data.rb +45 -0
  24. data/lib/worldline/acquiring/sdk/v1/domain/sub_operation.rb +0 -7
  25. data/lib/worldline/acquiring/sdk/v1/domain/sub_operation_for_refund.rb +0 -7
  26. data/lib/worldline/acquiring/sdk/v1/domain/terminal_data.rb +14 -0
  27. data/spec/integration/custom_oauth2_scopes_spec.rb +52 -0
  28. data/spec/lib/authentication/oauth2_scopes_spec.rb +66 -0
  29. data/spec/lib/communicator_configuration_spec.rb +23 -0
  30. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36681ad9c630f5e667db37fcda5058541f78838eb6a6c794b5a1b4dd19e4c8cf
4
- data.tar.gz: 773d18aae4376f8c782f689c124936f65cced602cf3fc81d2605361efcd33df6
3
+ metadata.gz: 65d7222393ac5f2bc3d6fa6738fef483ffd4f9b0dcb77ed5ad390961553accb5
4
+ data.tar.gz: 97b45c00cea7585aed7b908cd9b1dd91c22a1060e3519a576217df7fd04e53ab
5
5
  SHA512:
6
- metadata.gz: 7d10ebce4a8a1f3b079c4b0ddd75aa11504fedf1d26cf5d746a7b4e8a722800110192bd5fff42cdc9f91f356c50293f1d0df4db2243e4ce3b0b9bbdfabb5b3aa
7
- data.tar.gz: e9701ccaf887c4343a131781e45c81ab60ec800687f6ae7bbbda991a9fedc0cdeb8fcfa7b43670998d2c81c36c7574e734a6fefa40a2e827e9b6576365c137de
6
+ metadata.gz: 7b50b4baee7d42009803815a3d589fb7603933b7b8d6b3f85cfb5dbcdce0db817437cdea48a494126bd9192107e6889639a181e0a44d078ee035c194b727e54a
7
+ data.tar.gz: 6afbcb7fbbab00f166160127c25777539f6a44a34bb47e4ee3dbadff1058e2a3699d0cecf079a24462904207d5ed16a63a95254c4d105a0f8bcd83f1978622ff
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'acquiring-sdk-ruby'
3
- spec.version = '1.1.0'
3
+ spec.version = '1.3.0'
4
4
  spec.authors = ['Worldline Acquiring']
5
5
  spec.email = ['github.acquiring@worldline.com']
6
6
  spec.summary = %q{SDK to communicate with the Worldline Acquiring platform using the Worldline Acquiring API}
@@ -1,6 +1,7 @@
1
1
  require 'concurrent'
2
2
  require 'worldline/acquiring/sdk/authentication/authenticator'
3
3
  require 'worldline/acquiring/sdk/authentication/oauth2_exception'
4
+ require 'worldline/acquiring/sdk/authentication/oauth2_scopes'
4
5
  require 'worldline/acquiring/sdk/communication/default_connection'
5
6
  require 'worldline/acquiring/sdk/communication/request_header'
6
7
 
@@ -17,7 +18,7 @@ module Worldline
17
18
 
18
19
  def initialize(path, scopes)
19
20
  @path = path
20
- @scopes = scopes.join(' ')
21
+ @scopes = scopes
21
22
  end
22
23
 
23
24
  attr_reader :path
@@ -39,10 +40,7 @@ module Worldline
39
40
  # While at the moment all scopes fit in one request, keep this code so we can easily add more token types if necessary.
40
41
  # The empty path will ensure that all paths will match, as each full path ends with an empty string.
41
42
  TOKEN_TYPES = [
42
- TokenType.new('', [
43
- 'processing_payment', 'processing_refund', 'processing_credittransfer', 'processing_accountverification',
44
- 'processing_balanceinquiry', 'processing_operation_reverse', 'processing_dcc_rate', 'services_ping'
45
- ]),
43
+ TokenType.new('', OAuth2Scopes.all.join(' ')),
46
44
  ]
47
45
 
48
46
  public
@@ -67,14 +65,21 @@ module Worldline
67
65
  @connect_timeout = communicator_configuration.connect_timeout
68
66
  @socket_timeout = communicator_configuration.socket_timeout
69
67
  @proxy_configuration = communicator_configuration.proxy_configuration
68
+
69
+ oauth2_scopes = communicator_configuration.oauth2_scopes
70
+ if oauth2_scopes.nil? || oauth2_scopes.empty?
71
+ @path_to_scopes_mapper = lambda { |path| get_token_type(path).scopes }
72
+ else
73
+ @path_to_scopes_mapper = lambda { |_| oauth2_scopes }
74
+ end
70
75
  end
71
76
 
72
77
  # @param http_method [String, nil] 'GET', 'PUT', 'POST' or 'DELETE' indicating which HTTP method will be used with the request
73
78
  # @param resource_uri [URI::HTTP, nil] URI object that includes #path and #query of the URL that will be used, #query may be *nil*
74
79
  # @param request_headers [Array<Worldline::Acquiring::SDK::Communication::RequestHeader>, nil] all headers used by the request
75
80
  def get_authorization(http_method, resource_uri, request_headers)
76
- token_type = get_token_type(resource_uri&.path)
77
- access_token = @access_tokens.compute(token_type.path) { |existing_token| get_valid_access_token(existing_token, token_type) }
81
+ scopes = @path_to_scopes_mapper.call(resource_uri&.path)
82
+ access_token = @access_tokens.compute(scopes) { |existing_token| get_valid_access_token(existing_token, scopes) }
78
83
  "Bearer #{access_token.token}"
79
84
  end
80
85
 
@@ -89,9 +94,9 @@ module Worldline
89
94
  raise ArgumentError.new("scope could not be found for path '#{full_path}'")
90
95
  end
91
96
 
92
- def get_valid_access_token(existing_token, token_type)
97
+ def get_valid_access_token(existing_token, scopes)
93
98
  if is_token_invalid(existing_token)
94
- return get_access_token(token_type)
99
+ return get_access_token(scopes)
95
100
  end
96
101
  existing_token
97
102
  end
@@ -100,9 +105,9 @@ module Worldline
100
105
  not access_token or access_token.expiration < Time.now
101
106
  end
102
107
 
103
- def get_access_token(token_type)
108
+ def get_access_token(scopes)
104
109
  request_headers = [RequestHeader.new('Content-Type', 'application/x-www-form-urlencoded')]
105
- request_body = "grant_type=client_credentials&client_id=#{@client_id}&client_secret=#{@client_secret}&scope=#{token_type.scopes}"
110
+ request_body = "grant_type=client_credentials&client_id=#{@client_id}&client_secret=#{@client_secret}&scope=#{scopes}"
106
111
 
107
112
  start_time = Time.now
108
113
 
@@ -0,0 +1,73 @@
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ module Worldline
5
+ module Acquiring
6
+ module SDK
7
+ module Authentication
8
+ module OAuth2Scopes
9
+ private
10
+
11
+ SCOPES_BY_OPERATION = {
12
+ "v1" => {
13
+ "processPayment" => ["processing_payment"],
14
+ "getPaymentStatus" => ["processing_payment"],
15
+ "simpleCaptureOfPayment" => ["processing_payment"],
16
+ "reverseAuthorization" => ["processing_payment"],
17
+ "incrementPayment" => ["processing_payment"],
18
+ "createRefund" => ["processing_refund"],
19
+ "processStandaloneRefund" => ["processing_refund"],
20
+ "getRefund" => ["processing_refund"],
21
+ "captureRefund" => ["processing_refund"],
22
+ "reverseRefundAuthorization" => ["processing_refund"],
23
+ "processAccountVerification" => ["processing_accountverification"],
24
+ "processBalanceInquiry" => ["processing_balanceinquiry"],
25
+ "technicalReversal" => ["processing_operation_reverse"],
26
+ "requestDccRate" => ["processing_dcc_rate"],
27
+ "ping" => ["services_ping"]
28
+ }
29
+ }
30
+
31
+ ALL_SCOPES = SCOPES_BY_OPERATION.values.map { |m| m.values }.flatten.uniq.freeze
32
+
33
+ public
34
+
35
+ # Returns all available scopes.
36
+ def self.all
37
+ ALL_SCOPES
38
+ end
39
+
40
+ # Returns all scopes needed for all operations of the given API version.
41
+ def self.for_api_version(api_version)
42
+ operations = SCOPES_BY_OPERATION[api_version] || {}
43
+ operations.values.flatten.uniq.freeze
44
+ end
45
+
46
+ # Returns all scopes needed for the given operation of the given API version.
47
+ def self.for_operation(api_version, operation_id)
48
+ operations = SCOPES_BY_OPERATION[api_version] || {}
49
+ scopes = operations[operation_id] || []
50
+ scopes.uniq.freeze
51
+ end
52
+
53
+ # Returns all scopes needed for the given operations of the given API version.
54
+ def self.for_operations(api_version, *operation_ids)
55
+ operations = SCOPES_BY_OPERATION[api_version] || {}
56
+ operation_ids.map { |operation_id| operations[operation_id] || [] }.flatten.uniq.freeze
57
+ end
58
+
59
+ # Returns all scopes needed for the operations that pass the given filter.
60
+ # The first argument to the filter is the API version, the second is the operation id.
61
+ def self.for_filtered_operations(filter)
62
+ SCOPES_BY_OPERATION.keys.map { |api_version|
63
+ operations = SCOPES_BY_OPERATION[api_version]
64
+ operations.keys
65
+ .filter { |operation_id| filter.call(api_version, operation_id) }
66
+ .map { |operation_id| operations[operation_id] }
67
+ }.flatten.uniq.freeze
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -14,7 +14,7 @@ module Worldline
14
14
  class MetadataProvider
15
15
  private
16
16
 
17
- SDK_VERSION = '1.1.0'.freeze
17
+ SDK_VERSION = '1.3.0'.freeze
18
18
  SERVER_META_INFO_HEADER = 'X-WL-ServerMetaInfo'.freeze
19
19
  PROHIBITED_HEADERS = [SERVER_META_INFO_HEADER, 'Date', 'Content-Type', 'Authorization'].sort!.freeze
20
20
  CHARSET = 'utf-8'.freeze
@@ -11,6 +11,7 @@ module Worldline
11
11
  # @attr [String] authorization_secret A secret used for authorization. The meaning of this secret is different for each authorization type.
12
12
  # For instance, for OAuth2 this is the client secret
13
13
  # @attr [String] oauth2_token_uri The OAuth2 token URI
14
+ # @attr [String] oauth2_scopes The OAuth2 scopes; leave empty to let the SDK provide a set of defaults
14
15
  # @attr [String] authorization_type String representing the authentication algorithm used
15
16
  # @attr [Integer] connect_timeout The number of seconds before a connection attempt with the Worldline Acquiring platform times out.
16
17
  # @attr [Integer] socket_timeout The number of seconds before a timeout occurs when transmitting data to or from the Worldline Acquiring platform.
@@ -50,6 +51,7 @@ module Worldline
50
51
  # @param oauth2_client_secret [String, nil] The OAuth2 client secret.
51
52
  # This is an alias for _authorization_secret_.
52
53
  # @param oauth2_token_uri [String, nil] The OAuth2 token URI.
54
+ # @param oauth2_scopes [String, nil] The OAuth2 scopes; leave empty to let the SDK provide a set of defaults
53
55
  # @param authorization_type [String, nil] string describing the authorization protocol to follow.
54
56
  # @param connect_timeout [Integer, nil] the number of seconds before a connection attempt with the Worldline Acquiring platform times out.
55
57
  # @param socket_timeout [Integer, nil] the number of seconds before a timeout occurs when transmitting data to or from the Worldline Acquiring platform.
@@ -61,7 +63,7 @@ module Worldline
61
63
  # @param shopping_cart_extension [Worldline::Acquiring::SDK::Domain::ShoppingCartExtension, nil] stores shopping cart-related metadata.
62
64
  def initialize(properties: nil, api_endpoint: nil,
63
65
  authorization_id: nil, authorization_secret: nil,
64
- oauth2_client_id: nil, oauth2_client_secret: nil, oauth2_token_uri: nil,
66
+ oauth2_client_id: nil, oauth2_client_secret: nil, oauth2_token_uri: nil, oauth2_scopes: nil,
65
67
  authorization_type: nil,
66
68
  connect_timeout: nil, socket_timeout: nil,
67
69
  max_connections: nil, proxy_configuration: nil,
@@ -70,6 +72,7 @@ module Worldline
70
72
  @api_endpoint = get_endpoint(properties)
71
73
  @authorization_type = Authentication::AuthorizationType.get_authorization(properties['acquiring.api.authorizationType'])
72
74
  @oauth2_token_uri = properties['acquiring.api.oauth2.tokenUri']
75
+ @oauth2_scopes = properties['acquiring.api.oauth2.scopes']
73
76
  @connect_timeout = properties['acquiring.api.connectTimeout']
74
77
  @socket_timeout = properties['acquiring.api.socketTimeout']
75
78
  @max_connections = get_property(properties, 'acquiring.api.maxConnections', DEFAULT_MAX_CONNECTIONS)
@@ -104,6 +107,9 @@ module Worldline
104
107
  if oauth2_token_uri
105
108
  @oauth2_token_uri = oauth2_token_uri
106
109
  end
110
+ if oauth2_scopes
111
+ @oauth2_scopes = oauth2_scopes
112
+ end
107
113
  if authorization_type
108
114
  @authorization_type = authorization_type
109
115
  end
@@ -132,6 +138,7 @@ module Worldline
132
138
  attr_accessor :authorization_id
133
139
  attr_accessor :authorization_secret
134
140
  attr_accessor :oauth2_token_uri
141
+ attr_accessor :oauth2_scopes
135
142
  attr_accessor :authorization_type
136
143
 
137
144
  attr_accessor :connect_timeout
@@ -0,0 +1,41 @@
1
+ #
2
+ # This file was automatically generated.
3
+ #
4
+ require 'worldline/acquiring/sdk/domain/data_object'
5
+
6
+ module Worldline
7
+ module Acquiring
8
+ module SDK
9
+ module V1
10
+ module Domain
11
+ # @attr [String] merchant_advice_code
12
+ # @attr [String] merchant_advice_code_description
13
+ class AdditionalResponseData < Worldline::Acquiring::SDK::Domain::DataObject
14
+
15
+ attr_accessor :merchant_advice_code
16
+
17
+ attr_accessor :merchant_advice_code_description
18
+
19
+ # @return (Hash)
20
+ def to_h
21
+ hash = super
22
+ hash['merchantAdviceCode'] = @merchant_advice_code unless @merchant_advice_code.nil?
23
+ hash['merchantAdviceCodeDescription'] = @merchant_advice_code_description unless @merchant_advice_code_description.nil?
24
+ hash
25
+ end
26
+
27
+ def from_hash(hash)
28
+ super
29
+ if hash.has_key? 'merchantAdviceCode'
30
+ @merchant_advice_code = hash['merchantAdviceCode']
31
+ end
32
+ if hash.has_key? 'merchantAdviceCodeDescription'
33
+ @merchant_advice_code_description = hash['merchantAdviceCodeDescription']
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -2,6 +2,7 @@
2
2
  # This file was automatically generated.
3
3
  #
4
4
  require 'worldline/acquiring/sdk/domain/data_object'
5
+ require 'worldline/acquiring/sdk/v1/domain/additional_response_data'
5
6
  require 'worldline/acquiring/sdk/v1/domain/api_references_for_responses'
6
7
  require 'worldline/acquiring/sdk/v1/domain/card_payment_data_for_response'
7
8
 
@@ -10,6 +11,7 @@ module Worldline
10
11
  module SDK
11
12
  module V1
12
13
  module Domain
14
+ # @attr [Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData] additional_response_data
13
15
  # @attr [String] authorization_code
14
16
  # @attr [Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResponse] card_payment_data
15
17
  # @attr [String] operation_id
@@ -20,6 +22,8 @@ module Worldline
20
22
  # @attr [String] response_code_description
21
23
  class ApiAccountVerificationResponse < Worldline::Acquiring::SDK::Domain::DataObject
22
24
 
25
+ attr_accessor :additional_response_data
26
+
23
27
  attr_accessor :authorization_code
24
28
 
25
29
  attr_accessor :card_payment_data
@@ -39,6 +43,7 @@ module Worldline
39
43
  # @return (Hash)
40
44
  def to_h
41
45
  hash = super
46
+ hash['additionalResponseData'] = @additional_response_data.to_h unless @additional_response_data.nil?
42
47
  hash['authorizationCode'] = @authorization_code unless @authorization_code.nil?
43
48
  hash['cardPaymentData'] = @card_payment_data.to_h unless @card_payment_data.nil?
44
49
  hash['operationId'] = @operation_id unless @operation_id.nil?
@@ -52,6 +57,10 @@ module Worldline
52
57
 
53
58
  def from_hash(hash)
54
59
  super
60
+ if hash.has_key? 'additionalResponseData'
61
+ raise TypeError, "value '%s' is not a Hash" % [hash['additionalResponseData']] unless hash['additionalResponseData'].is_a? Hash
62
+ @additional_response_data = Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData.new_from_hash(hash['additionalResponseData'])
63
+ end
55
64
  if hash.has_key? 'authorizationCode'
56
65
  @authorization_code = hash['authorizationCode']
57
66
  end
@@ -2,6 +2,7 @@
2
2
  # This file was automatically generated.
3
3
  #
4
4
  require 'worldline/acquiring/sdk/domain/data_object'
5
+ require 'worldline/acquiring/sdk/v1/domain/additional_response_data'
5
6
  require 'worldline/acquiring/sdk/v1/domain/api_payment_summary_for_response'
6
7
 
7
8
  module Worldline
@@ -9,6 +10,7 @@ module Worldline
9
10
  module SDK
10
11
  module V1
11
12
  module Domain
13
+ # @attr [Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData] additional_response_data
12
14
  # @attr [String] operation_id
13
15
  # @attr [Worldline::Acquiring::SDK::V1::Domain::ApiPaymentSummaryForResponse] payment
14
16
  # @attr [String] responder
@@ -17,6 +19,8 @@ module Worldline
17
19
  # @attr [String] response_code_description
18
20
  class ApiActionResponse < Worldline::Acquiring::SDK::Domain::DataObject
19
21
 
22
+ attr_accessor :additional_response_data
23
+
20
24
  attr_accessor :operation_id
21
25
 
22
26
  attr_accessor :payment
@@ -32,6 +36,7 @@ module Worldline
32
36
  # @return (Hash)
33
37
  def to_h
34
38
  hash = super
39
+ hash['additionalResponseData'] = @additional_response_data.to_h unless @additional_response_data.nil?
35
40
  hash['operationId'] = @operation_id unless @operation_id.nil?
36
41
  hash['payment'] = @payment.to_h unless @payment.nil?
37
42
  hash['responder'] = @responder unless @responder.nil?
@@ -43,6 +48,10 @@ module Worldline
43
48
 
44
49
  def from_hash(hash)
45
50
  super
51
+ if hash.has_key? 'additionalResponseData'
52
+ raise TypeError, "value '%s' is not a Hash" % [hash['additionalResponseData']] unless hash['additionalResponseData'].is_a? Hash
53
+ @additional_response_data = Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData.new_from_hash(hash['additionalResponseData'])
54
+ end
46
55
  if hash.has_key? 'operationId'
47
56
  @operation_id = hash['operationId']
48
57
  end
@@ -2,6 +2,7 @@
2
2
  # This file was automatically generated.
3
3
  #
4
4
  require 'worldline/acquiring/sdk/domain/data_object'
5
+ require 'worldline/acquiring/sdk/v1/domain/additional_response_data'
5
6
  require 'worldline/acquiring/sdk/v1/domain/api_refund_summary_for_response'
6
7
 
7
8
  module Worldline
@@ -9,6 +10,7 @@ module Worldline
9
10
  module SDK
10
11
  module V1
11
12
  module Domain
13
+ # @attr [Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData] additional_response_data
12
14
  # @attr [String] operation_id
13
15
  # @attr [Worldline::Acquiring::SDK::V1::Domain::ApiRefundSummaryForResponse] refund
14
16
  # @attr [String] responder
@@ -17,6 +19,8 @@ module Worldline
17
19
  # @attr [String] response_code_description
18
20
  class ApiActionResponseForRefund < Worldline::Acquiring::SDK::Domain::DataObject
19
21
 
22
+ attr_accessor :additional_response_data
23
+
20
24
  attr_accessor :operation_id
21
25
 
22
26
  attr_accessor :refund
@@ -32,6 +36,7 @@ module Worldline
32
36
  # @return (Hash)
33
37
  def to_h
34
38
  hash = super
39
+ hash['additionalResponseData'] = @additional_response_data.to_h unless @additional_response_data.nil?
35
40
  hash['operationId'] = @operation_id unless @operation_id.nil?
36
41
  hash['refund'] = @refund.to_h unless @refund.nil?
37
42
  hash['responder'] = @responder unless @responder.nil?
@@ -43,6 +48,10 @@ module Worldline
43
48
 
44
49
  def from_hash(hash)
45
50
  super
51
+ if hash.has_key? 'additionalResponseData'
52
+ raise TypeError, "value '%s' is not a Hash" % [hash['additionalResponseData']] unless hash['additionalResponseData'].is_a? Hash
53
+ @additional_response_data = Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData.new_from_hash(hash['additionalResponseData'])
54
+ end
46
55
  if hash.has_key? 'operationId'
47
56
  @operation_id = hash['operationId']
48
57
  end
@@ -2,16 +2,20 @@
2
2
  # This file was automatically generated.
3
3
  #
4
4
  require 'worldline/acquiring/sdk/domain/data_object'
5
+ require 'worldline/acquiring/sdk/v1/domain/additional_response_data'
5
6
  require 'worldline/acquiring/sdk/v1/domain/amount_data'
6
7
  require 'worldline/acquiring/sdk/v1/domain/api_references_for_responses'
8
+ require 'worldline/acquiring/sdk/v1/domain/card_payment_data_for_response'
7
9
 
8
10
  module Worldline
9
11
  module Acquiring
10
12
  module SDK
11
13
  module V1
12
14
  module Domain
15
+ # @attr [Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData] additional_response_data
13
16
  # @attr [String] authorization_code
14
17
  # @attr [Worldline::Acquiring::SDK::V1::Domain::AmountData] available_amount
18
+ # @attr [Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResponse] card_payment_data
15
19
  # @attr [String] operation_id
16
20
  # @attr [Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses] references
17
21
  # @attr [String] responder
@@ -20,10 +24,14 @@ module Worldline
20
24
  # @attr [String] response_code_description
21
25
  class ApiBalanceInquiryResponse < Worldline::Acquiring::SDK::Domain::DataObject
22
26
 
27
+ attr_accessor :additional_response_data
28
+
23
29
  attr_accessor :authorization_code
24
30
 
25
31
  attr_accessor :available_amount
26
32
 
33
+ attr_accessor :card_payment_data
34
+
27
35
  attr_accessor :operation_id
28
36
 
29
37
  attr_accessor :references
@@ -39,8 +47,10 @@ module Worldline
39
47
  # @return (Hash)
40
48
  def to_h
41
49
  hash = super
50
+ hash['additionalResponseData'] = @additional_response_data.to_h unless @additional_response_data.nil?
42
51
  hash['authorizationCode'] = @authorization_code unless @authorization_code.nil?
43
52
  hash['availableAmount'] = @available_amount.to_h unless @available_amount.nil?
53
+ hash['cardPaymentData'] = @card_payment_data.to_h unless @card_payment_data.nil?
44
54
  hash['operationId'] = @operation_id unless @operation_id.nil?
45
55
  hash['references'] = @references.to_h unless @references.nil?
46
56
  hash['responder'] = @responder unless @responder.nil?
@@ -52,6 +62,10 @@ module Worldline
52
62
 
53
63
  def from_hash(hash)
54
64
  super
65
+ if hash.has_key? 'additionalResponseData'
66
+ raise TypeError, "value '%s' is not a Hash" % [hash['additionalResponseData']] unless hash['additionalResponseData'].is_a? Hash
67
+ @additional_response_data = Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData.new_from_hash(hash['additionalResponseData'])
68
+ end
55
69
  if hash.has_key? 'authorizationCode'
56
70
  @authorization_code = hash['authorizationCode']
57
71
  end
@@ -59,6 +73,10 @@ module Worldline
59
73
  raise TypeError, "value '%s' is not a Hash" % [hash['availableAmount']] unless hash['availableAmount'].is_a? Hash
60
74
  @available_amount = Worldline::Acquiring::SDK::V1::Domain::AmountData.new_from_hash(hash['availableAmount'])
61
75
  end
76
+ if hash.has_key? 'cardPaymentData'
77
+ raise TypeError, "value '%s' is not a Hash" % [hash['cardPaymentData']] unless hash['cardPaymentData'].is_a? Hash
78
+ @card_payment_data = Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResponse.new_from_hash(hash['cardPaymentData'])
79
+ end
62
80
  if hash.has_key? 'operationId'
63
81
  @operation_id = hash['operationId']
64
82
  end
@@ -19,7 +19,6 @@ module Worldline
19
19
  # @attr [Array<Worldline::Acquiring::SDK::V1::Domain::SubOperation>] operations
20
20
  # @attr [String] payment_id
21
21
  # @attr [Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses] references
22
- # @attr [String] retry_after
23
22
  # @attr [String] status
24
23
  # @attr [DateTime] status_timestamp
25
24
  # @attr [Worldline::Acquiring::SDK::V1::Domain::AmountData] total_authorized_amount
@@ -35,8 +34,6 @@ module Worldline
35
34
 
36
35
  attr_accessor :references
37
36
 
38
- attr_accessor :retry_after
39
-
40
37
  attr_accessor :status
41
38
 
42
39
  attr_accessor :status_timestamp
@@ -51,7 +48,6 @@ module Worldline
51
48
  hash['operations'] = @operations.collect{|val| val.to_h} unless @operations.nil?
52
49
  hash['paymentId'] = @payment_id unless @payment_id.nil?
53
50
  hash['references'] = @references.to_h unless @references.nil?
54
- hash['retryAfter'] = @retry_after unless @retry_after.nil?
55
51
  hash['status'] = @status unless @status.nil?
56
52
  hash['statusTimestamp'] = @status_timestamp.iso8601(3) unless @status_timestamp.nil?
57
53
  hash['totalAuthorizedAmount'] = @total_authorized_amount.to_h unless @total_authorized_amount.nil?
@@ -81,9 +77,6 @@ module Worldline
81
77
  raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
82
78
  @references = Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses.new_from_hash(hash['references'])
83
79
  end
84
- if hash.has_key? 'retryAfter'
85
- @retry_after = hash['retryAfter']
86
- end
87
80
  if hash.has_key? 'status'
88
81
  @status = hash['status']
89
82
  end
@@ -4,18 +4,18 @@
4
4
  require 'date'
5
5
 
6
6
  require 'worldline/acquiring/sdk/domain/data_object'
7
+ require 'worldline/acquiring/sdk/v1/domain/additional_response_data'
7
8
  require 'worldline/acquiring/sdk/v1/domain/amount_data'
8
9
  require 'worldline/acquiring/sdk/v1/domain/api_references_for_responses'
9
10
  require 'worldline/acquiring/sdk/v1/domain/card_payment_data_for_response'
10
- require 'worldline/acquiring/sdk/v1/domain/emv_data_item'
11
11
 
12
12
  module Worldline
13
13
  module Acquiring
14
14
  module SDK
15
15
  module V1
16
16
  module Domain
17
+ # @attr [Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData] additional_response_data
17
18
  # @attr [Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResponse] card_payment_data
18
- # @attr [Array<Worldline::Acquiring::SDK::V1::Domain::EmvDataItem>] emv_data
19
19
  # @attr [String] initial_authorization_code
20
20
  # @attr [String] operation_id
21
21
  # @attr [String] payment_id
@@ -24,15 +24,14 @@ module Worldline
24
24
  # @attr [String] response_code
25
25
  # @attr [String] response_code_category
26
26
  # @attr [String] response_code_description
27
- # @attr [String] retry_after
28
27
  # @attr [String] status
29
28
  # @attr [DateTime] status_timestamp
30
29
  # @attr [Worldline::Acquiring::SDK::V1::Domain::AmountData] total_authorized_amount
31
30
  class ApiPaymentResponse < Worldline::Acquiring::SDK::Domain::DataObject
32
31
 
33
- attr_accessor :card_payment_data
32
+ attr_accessor :additional_response_data
34
33
 
35
- attr_accessor :emv_data
34
+ attr_accessor :card_payment_data
36
35
 
37
36
  attr_accessor :initial_authorization_code
38
37
 
@@ -50,8 +49,6 @@ module Worldline
50
49
 
51
50
  attr_accessor :response_code_description
52
51
 
53
- attr_accessor :retry_after
54
-
55
52
  attr_accessor :status
56
53
 
57
54
  attr_accessor :status_timestamp
@@ -61,8 +58,8 @@ module Worldline
61
58
  # @return (Hash)
62
59
  def to_h
63
60
  hash = super
61
+ hash['additionalResponseData'] = @additional_response_data.to_h unless @additional_response_data.nil?
64
62
  hash['cardPaymentData'] = @card_payment_data.to_h unless @card_payment_data.nil?
65
- hash['emvData'] = @emv_data.collect{|val| val.to_h} unless @emv_data.nil?
66
63
  hash['initialAuthorizationCode'] = @initial_authorization_code unless @initial_authorization_code.nil?
67
64
  hash['operationId'] = @operation_id unless @operation_id.nil?
68
65
  hash['paymentId'] = @payment_id unless @payment_id.nil?
@@ -71,7 +68,6 @@ module Worldline
71
68
  hash['responseCode'] = @response_code unless @response_code.nil?
72
69
  hash['responseCodeCategory'] = @response_code_category unless @response_code_category.nil?
73
70
  hash['responseCodeDescription'] = @response_code_description unless @response_code_description.nil?
74
- hash['retryAfter'] = @retry_after unless @retry_after.nil?
75
71
  hash['status'] = @status unless @status.nil?
76
72
  hash['statusTimestamp'] = @status_timestamp.iso8601(3) unless @status_timestamp.nil?
77
73
  hash['totalAuthorizedAmount'] = @total_authorized_amount.to_h unless @total_authorized_amount.nil?
@@ -80,17 +76,14 @@ module Worldline
80
76
 
81
77
  def from_hash(hash)
82
78
  super
79
+ if hash.has_key? 'additionalResponseData'
80
+ raise TypeError, "value '%s' is not a Hash" % [hash['additionalResponseData']] unless hash['additionalResponseData'].is_a? Hash
81
+ @additional_response_data = Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData.new_from_hash(hash['additionalResponseData'])
82
+ end
83
83
  if hash.has_key? 'cardPaymentData'
84
84
  raise TypeError, "value '%s' is not a Hash" % [hash['cardPaymentData']] unless hash['cardPaymentData'].is_a? Hash
85
85
  @card_payment_data = Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResponse.new_from_hash(hash['cardPaymentData'])
86
86
  end
87
- if hash.has_key? 'emvData'
88
- raise TypeError, "value '%s' is not an Array" % [hash['emvData']] unless hash['emvData'].is_a? Array
89
- @emv_data = []
90
- hash['emvData'].each do |e|
91
- @emv_data << Worldline::Acquiring::SDK::V1::Domain::EmvDataItem.new_from_hash(e)
92
- end
93
- end
94
87
  if hash.has_key? 'initialAuthorizationCode'
95
88
  @initial_authorization_code = hash['initialAuthorizationCode']
96
89
  end
@@ -116,9 +109,6 @@ module Worldline
116
109
  if hash.has_key? 'responseCodeDescription'
117
110
  @response_code_description = hash['responseCodeDescription']
118
111
  end
119
- if hash.has_key? 'retryAfter'
120
- @retry_after = hash['retryAfter']
121
- end
122
112
  if hash.has_key? 'status'
123
113
  @status = hash['status']
124
114
  end
@@ -13,7 +13,6 @@ module Worldline
13
13
  module Domain
14
14
  # @attr [String] payment_id
15
15
  # @attr [Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses] references
16
- # @attr [String] retry_after
17
16
  # @attr [String] status
18
17
  # @attr [DateTime] status_timestamp
19
18
  class ApiPaymentSummaryForResponse < Worldline::Acquiring::SDK::Domain::DataObject
@@ -22,8 +21,6 @@ module Worldline
22
21
 
23
22
  attr_accessor :references
24
23
 
25
- attr_accessor :retry_after
26
-
27
24
  attr_accessor :status
28
25
 
29
26
  attr_accessor :status_timestamp
@@ -33,7 +30,6 @@ module Worldline
33
30
  hash = super
34
31
  hash['paymentId'] = @payment_id unless @payment_id.nil?
35
32
  hash['references'] = @references.to_h unless @references.nil?
36
- hash['retryAfter'] = @retry_after unless @retry_after.nil?
37
33
  hash['status'] = @status unless @status.nil?
38
34
  hash['statusTimestamp'] = @status_timestamp.iso8601(3) unless @status_timestamp.nil?
39
35
  hash
@@ -48,9 +44,6 @@ module Worldline
48
44
  raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
49
45
  @references = Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses.new_from_hash(hash['references'])
50
46
  end
51
- if hash.has_key? 'retryAfter'
52
- @retry_after = hash['retryAfter']
53
- end
54
47
  if hash.has_key? 'status'
55
48
  @status = hash['status']
56
49
  end