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.
- checksums.yaml +4 -4
- data/acquiring-sdk-ruby.gemspec +1 -1
- data/lib/worldline/acquiring/sdk/authentication/oauth2_authenticator.rb +16 -11
- data/lib/worldline/acquiring/sdk/authentication/oauth2_scopes.rb +73 -0
- data/lib/worldline/acquiring/sdk/communication/metadata_provider.rb +1 -1
- data/lib/worldline/acquiring/sdk/communicator_configuration.rb +8 -1
- data/lib/worldline/acquiring/sdk/v1/domain/additional_response_data.rb +41 -0
- data/lib/worldline/acquiring/sdk/v1/domain/api_account_verification_response.rb +9 -0
- data/lib/worldline/acquiring/sdk/v1/domain/api_action_response.rb +9 -0
- data/lib/worldline/acquiring/sdk/v1/domain/api_action_response_for_refund.rb +9 -0
- data/lib/worldline/acquiring/sdk/v1/domain/api_balance_inquiry_response.rb +18 -0
- data/lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb +0 -7
- data/lib/worldline/acquiring/sdk/v1/domain/api_payment_response.rb +9 -19
- data/lib/worldline/acquiring/sdk/v1/domain/api_payment_summary_for_response.rb +0 -7
- data/lib/worldline/acquiring/sdk/v1/domain/api_refund_resource.rb +0 -7
- data/lib/worldline/acquiring/sdk/v1/domain/api_refund_response.rb +12 -10
- data/lib/worldline/acquiring/sdk/v1/domain/api_refund_summary_for_response.rb +0 -7
- data/lib/worldline/acquiring/sdk/v1/domain/card_payment_data.rb +9 -0
- data/lib/worldline/acquiring/sdk/v1/domain/geo_coordinates.rb +41 -0
- data/lib/worldline/acquiring/sdk/v1/domain/plain_card_data.rb +7 -0
- data/lib/worldline/acquiring/sdk/v1/domain/point_of_sale_data_for_response.rb +12 -0
- data/lib/worldline/acquiring/sdk/v1/domain/service_location_address.rb +55 -0
- data/lib/worldline/acquiring/sdk/v1/domain/service_location_data.rb +45 -0
- data/lib/worldline/acquiring/sdk/v1/domain/sub_operation.rb +0 -7
- data/lib/worldline/acquiring/sdk/v1/domain/sub_operation_for_refund.rb +0 -7
- data/lib/worldline/acquiring/sdk/v1/domain/terminal_data.rb +14 -0
- data/spec/integration/custom_oauth2_scopes_spec.rb +52 -0
- data/spec/lib/authentication/oauth2_scopes_spec.rb +66 -0
- data/spec/lib/communicator_configuration_spec.rb +23 -0
- metadata +11 -2
@@ -20,7 +20,6 @@ module Worldline
|
|
20
20
|
# @attr [String] referenced_payment_id
|
21
21
|
# @attr [Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses] references
|
22
22
|
# @attr [String] refund_id
|
23
|
-
# @attr [String] retry_after
|
24
23
|
# @attr [String] status
|
25
24
|
# @attr [DateTime] status_timestamp
|
26
25
|
# @attr [Worldline::Acquiring::SDK::V1::Domain::AmountData] total_authorized_amount
|
@@ -38,8 +37,6 @@ module Worldline
|
|
38
37
|
|
39
38
|
attr_accessor :refund_id
|
40
39
|
|
41
|
-
attr_accessor :retry_after
|
42
|
-
|
43
40
|
attr_accessor :status
|
44
41
|
|
45
42
|
attr_accessor :status_timestamp
|
@@ -55,7 +52,6 @@ module Worldline
|
|
55
52
|
hash['referencedPaymentId'] = @referenced_payment_id unless @referenced_payment_id.nil?
|
56
53
|
hash['references'] = @references.to_h unless @references.nil?
|
57
54
|
hash['refundId'] = @refund_id unless @refund_id.nil?
|
58
|
-
hash['retryAfter'] = @retry_after unless @retry_after.nil?
|
59
55
|
hash['status'] = @status unless @status.nil?
|
60
56
|
hash['statusTimestamp'] = @status_timestamp.iso8601(3) unless @status_timestamp.nil?
|
61
57
|
hash['totalAuthorizedAmount'] = @total_authorized_amount.to_h unless @total_authorized_amount.nil?
|
@@ -88,9 +84,6 @@ module Worldline
|
|
88
84
|
if hash.has_key? 'refundId'
|
89
85
|
@refund_id = hash['refundId']
|
90
86
|
end
|
91
|
-
if hash.has_key? 'retryAfter'
|
92
|
-
@retry_after = hash['retryAfter']
|
93
|
-
end
|
94
87
|
if hash.has_key? 'status'
|
95
88
|
@status = hash['status']
|
96
89
|
end
|
@@ -4,9 +4,10 @@
|
|
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
|
-
require 'worldline/acquiring/sdk/v1/domain/
|
10
|
+
require 'worldline/acquiring/sdk/v1/domain/card_payment_data_for_response'
|
10
11
|
require 'worldline/acquiring/sdk/v1/domain/emv_data_item'
|
11
12
|
|
12
13
|
module Worldline
|
@@ -14,8 +15,9 @@ module Worldline
|
|
14
15
|
module SDK
|
15
16
|
module V1
|
16
17
|
module Domain
|
18
|
+
# @attr [Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData] additional_response_data
|
17
19
|
# @attr [String] authorization_code
|
18
|
-
# @attr [Worldline::Acquiring::SDK::V1::Domain::
|
20
|
+
# @attr [Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResponse] card_payment_data
|
19
21
|
# @attr [Array<Worldline::Acquiring::SDK::V1::Domain::EmvDataItem>] emv_data
|
20
22
|
# @attr [String] operation_id
|
21
23
|
# @attr [String] referenced_payment_id
|
@@ -25,12 +27,13 @@ module Worldline
|
|
25
27
|
# @attr [String] response_code
|
26
28
|
# @attr [String] response_code_category
|
27
29
|
# @attr [String] response_code_description
|
28
|
-
# @attr [String] retry_after
|
29
30
|
# @attr [String] status
|
30
31
|
# @attr [DateTime] status_timestamp
|
31
32
|
# @attr [Worldline::Acquiring::SDK::V1::Domain::AmountData] total_authorized_amount
|
32
33
|
class ApiRefundResponse < Worldline::Acquiring::SDK::Domain::DataObject
|
33
34
|
|
35
|
+
attr_accessor :additional_response_data
|
36
|
+
|
34
37
|
attr_accessor :authorization_code
|
35
38
|
|
36
39
|
attr_accessor :card_payment_data
|
@@ -53,8 +56,6 @@ module Worldline
|
|
53
56
|
|
54
57
|
attr_accessor :response_code_description
|
55
58
|
|
56
|
-
attr_accessor :retry_after
|
57
|
-
|
58
59
|
attr_accessor :status
|
59
60
|
|
60
61
|
attr_accessor :status_timestamp
|
@@ -64,6 +65,7 @@ module Worldline
|
|
64
65
|
# @return (Hash)
|
65
66
|
def to_h
|
66
67
|
hash = super
|
68
|
+
hash['additionalResponseData'] = @additional_response_data.to_h unless @additional_response_data.nil?
|
67
69
|
hash['authorizationCode'] = @authorization_code unless @authorization_code.nil?
|
68
70
|
hash['cardPaymentData'] = @card_payment_data.to_h unless @card_payment_data.nil?
|
69
71
|
hash['emvData'] = @emv_data.collect{|val| val.to_h} unless @emv_data.nil?
|
@@ -75,7 +77,6 @@ module Worldline
|
|
75
77
|
hash['responseCode'] = @response_code unless @response_code.nil?
|
76
78
|
hash['responseCodeCategory'] = @response_code_category unless @response_code_category.nil?
|
77
79
|
hash['responseCodeDescription'] = @response_code_description unless @response_code_description.nil?
|
78
|
-
hash['retryAfter'] = @retry_after unless @retry_after.nil?
|
79
80
|
hash['status'] = @status unless @status.nil?
|
80
81
|
hash['statusTimestamp'] = @status_timestamp.iso8601(3) unless @status_timestamp.nil?
|
81
82
|
hash['totalAuthorizedAmount'] = @total_authorized_amount.to_h unless @total_authorized_amount.nil?
|
@@ -84,12 +85,16 @@ module Worldline
|
|
84
85
|
|
85
86
|
def from_hash(hash)
|
86
87
|
super
|
88
|
+
if hash.has_key? 'additionalResponseData'
|
89
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['additionalResponseData']] unless hash['additionalResponseData'].is_a? Hash
|
90
|
+
@additional_response_data = Worldline::Acquiring::SDK::V1::Domain::AdditionalResponseData.new_from_hash(hash['additionalResponseData'])
|
91
|
+
end
|
87
92
|
if hash.has_key? 'authorizationCode'
|
88
93
|
@authorization_code = hash['authorizationCode']
|
89
94
|
end
|
90
95
|
if hash.has_key? 'cardPaymentData'
|
91
96
|
raise TypeError, "value '%s' is not a Hash" % [hash['cardPaymentData']] unless hash['cardPaymentData'].is_a? Hash
|
92
|
-
@card_payment_data = Worldline::Acquiring::SDK::V1::Domain::
|
97
|
+
@card_payment_data = Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResponse.new_from_hash(hash['cardPaymentData'])
|
93
98
|
end
|
94
99
|
if hash.has_key? 'emvData'
|
95
100
|
raise TypeError, "value '%s' is not an Array" % [hash['emvData']] unless hash['emvData'].is_a? Array
|
@@ -123,9 +128,6 @@ module Worldline
|
|
123
128
|
if hash.has_key? 'responseCodeDescription'
|
124
129
|
@response_code_description = hash['responseCodeDescription']
|
125
130
|
end
|
126
|
-
if hash.has_key? 'retryAfter'
|
127
|
-
@retry_after = hash['retryAfter']
|
128
|
-
end
|
129
131
|
if hash.has_key? 'status'
|
130
132
|
@status = hash['status']
|
131
133
|
end
|
@@ -13,7 +13,6 @@ module Worldline
|
|
13
13
|
module Domain
|
14
14
|
# @attr [Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses] references
|
15
15
|
# @attr [String] refund_id
|
16
|
-
# @attr [String] retry_after
|
17
16
|
# @attr [String] status
|
18
17
|
# @attr [DateTime] status_timestamp
|
19
18
|
class ApiRefundSummaryForResponse < Worldline::Acquiring::SDK::Domain::DataObject
|
@@ -22,8 +21,6 @@ module Worldline
|
|
22
21
|
|
23
22
|
attr_accessor :refund_id
|
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['references'] = @references.to_h unless @references.nil?
|
35
32
|
hash['refundId'] = @refund_id unless @refund_id.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
|
if hash.has_key? 'refundId'
|
49
45
|
@refund_id = hash['refundId']
|
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
|
@@ -7,6 +7,7 @@ require 'worldline/acquiring/sdk/v1/domain/e_commerce_data'
|
|
7
7
|
require 'worldline/acquiring/sdk/v1/domain/network_token_data'
|
8
8
|
require 'worldline/acquiring/sdk/v1/domain/plain_card_data'
|
9
9
|
require 'worldline/acquiring/sdk/v1/domain/point_of_sale_data'
|
10
|
+
require 'worldline/acquiring/sdk/v1/domain/service_location_data'
|
10
11
|
|
11
12
|
module Worldline
|
12
13
|
module Acquiring
|
@@ -24,6 +25,7 @@ module Worldline
|
|
24
25
|
# @attr [Worldline::Acquiring::SDK::V1::Domain::ECommerceData] ecommerce_data
|
25
26
|
# @attr [Worldline::Acquiring::SDK::V1::Domain::NetworkTokenData] network_token_data
|
26
27
|
# @attr [Worldline::Acquiring::SDK::V1::Domain::PointOfSaleData] point_of_sale_data
|
28
|
+
# @attr [Worldline::Acquiring::SDK::V1::Domain::ServiceLocationData] service_location_data
|
27
29
|
# @attr [String] wallet_id
|
28
30
|
class CardPaymentData < Worldline::Acquiring::SDK::Domain::DataObject
|
29
31
|
|
@@ -49,6 +51,8 @@ module Worldline
|
|
49
51
|
|
50
52
|
attr_accessor :point_of_sale_data
|
51
53
|
|
54
|
+
attr_accessor :service_location_data
|
55
|
+
|
52
56
|
attr_accessor :wallet_id
|
53
57
|
|
54
58
|
# @return (Hash)
|
@@ -65,6 +69,7 @@ module Worldline
|
|
65
69
|
hash['ecommerceData'] = @ecommerce_data.to_h unless @ecommerce_data.nil?
|
66
70
|
hash['networkTokenData'] = @network_token_data.to_h unless @network_token_data.nil?
|
67
71
|
hash['pointOfSaleData'] = @point_of_sale_data.to_h unless @point_of_sale_data.nil?
|
72
|
+
hash['serviceLocationData'] = @service_location_data.to_h unless @service_location_data.nil?
|
68
73
|
hash['walletId'] = @wallet_id unless @wallet_id.nil?
|
69
74
|
hash
|
70
75
|
end
|
@@ -109,6 +114,10 @@ module Worldline
|
|
109
114
|
raise TypeError, "value '%s' is not a Hash" % [hash['pointOfSaleData']] unless hash['pointOfSaleData'].is_a? Hash
|
110
115
|
@point_of_sale_data = Worldline::Acquiring::SDK::V1::Domain::PointOfSaleData.new_from_hash(hash['pointOfSaleData'])
|
111
116
|
end
|
117
|
+
if hash.has_key? 'serviceLocationData'
|
118
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['serviceLocationData']] unless hash['serviceLocationData'].is_a? Hash
|
119
|
+
@service_location_data = Worldline::Acquiring::SDK::V1::Domain::ServiceLocationData.new_from_hash(hash['serviceLocationData'])
|
120
|
+
end
|
112
121
|
if hash.has_key? 'walletId'
|
113
122
|
@wallet_id = hash['walletId']
|
114
123
|
end
|
@@ -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 [float] latitude
|
12
|
+
# @attr [float] longitude
|
13
|
+
class GeoCoordinates < Worldline::Acquiring::SDK::Domain::DataObject
|
14
|
+
|
15
|
+
attr_accessor :latitude
|
16
|
+
|
17
|
+
attr_accessor :longitude
|
18
|
+
|
19
|
+
# @return (Hash)
|
20
|
+
def to_h
|
21
|
+
hash = super
|
22
|
+
hash['latitude'] = @latitude unless @latitude.nil?
|
23
|
+
hash['longitude'] = @longitude unless @longitude.nil?
|
24
|
+
hash
|
25
|
+
end
|
26
|
+
|
27
|
+
def from_hash(hash)
|
28
|
+
super
|
29
|
+
if hash.has_key? 'latitude'
|
30
|
+
@latitude = hash['latitude']
|
31
|
+
end
|
32
|
+
if hash.has_key? 'longitude'
|
33
|
+
@longitude = hash['longitude']
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -10,6 +10,7 @@ module Worldline
|
|
10
10
|
module Domain
|
11
11
|
# @attr [String] card_number
|
12
12
|
# @attr [String] card_security_code
|
13
|
+
# @attr [Integer] card_sequence_number
|
13
14
|
# @attr [String] expiry_date
|
14
15
|
class PlainCardData < Worldline::Acquiring::SDK::Domain::DataObject
|
15
16
|
|
@@ -17,6 +18,8 @@ module Worldline
|
|
17
18
|
|
18
19
|
attr_accessor :card_security_code
|
19
20
|
|
21
|
+
attr_accessor :card_sequence_number
|
22
|
+
|
20
23
|
attr_accessor :expiry_date
|
21
24
|
|
22
25
|
# @return (Hash)
|
@@ -24,6 +27,7 @@ module Worldline
|
|
24
27
|
hash = super
|
25
28
|
hash['cardNumber'] = @card_number unless @card_number.nil?
|
26
29
|
hash['cardSecurityCode'] = @card_security_code unless @card_security_code.nil?
|
30
|
+
hash['cardSequenceNumber'] = @card_sequence_number unless @card_sequence_number.nil?
|
27
31
|
hash['expiryDate'] = @expiry_date unless @expiry_date.nil?
|
28
32
|
hash
|
29
33
|
end
|
@@ -36,6 +40,9 @@ module Worldline
|
|
36
40
|
if hash.has_key? 'cardSecurityCode'
|
37
41
|
@card_security_code = hash['cardSecurityCode']
|
38
42
|
end
|
43
|
+
if hash.has_key? 'cardSequenceNumber'
|
44
|
+
@card_sequence_number = hash['cardSequenceNumber']
|
45
|
+
end
|
39
46
|
if hash.has_key? 'expiryDate'
|
40
47
|
@expiry_date = hash['expiryDate']
|
41
48
|
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/emv_data_item'
|
5
6
|
|
6
7
|
module Worldline
|
7
8
|
module Acquiring
|
8
9
|
module SDK
|
9
10
|
module V1
|
10
11
|
module Domain
|
12
|
+
# @attr [Array<Worldline::Acquiring::SDK::V1::Domain::EmvDataItem>] emv_data
|
11
13
|
# @attr [String] pan_last4_digits
|
12
14
|
# @attr [Integer] pin_retry_counter
|
13
15
|
class PointOfSaleDataForResponse < Worldline::Acquiring::SDK::Domain::DataObject
|
14
16
|
|
17
|
+
attr_accessor :emv_data
|
18
|
+
|
15
19
|
attr_accessor :pan_last4_digits
|
16
20
|
|
17
21
|
attr_accessor :pin_retry_counter
|
@@ -19,6 +23,7 @@ module Worldline
|
|
19
23
|
# @return (Hash)
|
20
24
|
def to_h
|
21
25
|
hash = super
|
26
|
+
hash['emvData'] = @emv_data.collect{|val| val.to_h} unless @emv_data.nil?
|
22
27
|
hash['panLast4Digits'] = @pan_last4_digits unless @pan_last4_digits.nil?
|
23
28
|
hash['pinRetryCounter'] = @pin_retry_counter unless @pin_retry_counter.nil?
|
24
29
|
hash
|
@@ -26,6 +31,13 @@ module Worldline
|
|
26
31
|
|
27
32
|
def from_hash(hash)
|
28
33
|
super
|
34
|
+
if hash.has_key? 'emvData'
|
35
|
+
raise TypeError, "value '%s' is not an Array" % [hash['emvData']] unless hash['emvData'].is_a? Array
|
36
|
+
@emv_data = []
|
37
|
+
hash['emvData'].each do |e|
|
38
|
+
@emv_data << Worldline::Acquiring::SDK::V1::Domain::EmvDataItem.new_from_hash(e)
|
39
|
+
end
|
40
|
+
end
|
29
41
|
if hash.has_key? 'panLast4Digits'
|
30
42
|
@pan_last4_digits = hash['panLast4Digits']
|
31
43
|
end
|
@@ -0,0 +1,55 @@
|
|
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] city
|
12
|
+
# @attr [String] country_code
|
13
|
+
# @attr [String] country_subdivision_code
|
14
|
+
# @attr [String] postal_code
|
15
|
+
class ServiceLocationAddress < Worldline::Acquiring::SDK::Domain::DataObject
|
16
|
+
|
17
|
+
attr_accessor :city
|
18
|
+
|
19
|
+
attr_accessor :country_code
|
20
|
+
|
21
|
+
attr_accessor :country_subdivision_code
|
22
|
+
|
23
|
+
attr_accessor :postal_code
|
24
|
+
|
25
|
+
# @return (Hash)
|
26
|
+
def to_h
|
27
|
+
hash = super
|
28
|
+
hash['city'] = @city unless @city.nil?
|
29
|
+
hash['countryCode'] = @country_code unless @country_code.nil?
|
30
|
+
hash['countrySubdivisionCode'] = @country_subdivision_code unless @country_subdivision_code.nil?
|
31
|
+
hash['postalCode'] = @postal_code unless @postal_code.nil?
|
32
|
+
hash
|
33
|
+
end
|
34
|
+
|
35
|
+
def from_hash(hash)
|
36
|
+
super
|
37
|
+
if hash.has_key? 'city'
|
38
|
+
@city = hash['city']
|
39
|
+
end
|
40
|
+
if hash.has_key? 'countryCode'
|
41
|
+
@country_code = hash['countryCode']
|
42
|
+
end
|
43
|
+
if hash.has_key? 'countrySubdivisionCode'
|
44
|
+
@country_subdivision_code = hash['countrySubdivisionCode']
|
45
|
+
end
|
46
|
+
if hash.has_key? 'postalCode'
|
47
|
+
@postal_code = hash['postalCode']
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#
|
2
|
+
# This file was automatically generated.
|
3
|
+
#
|
4
|
+
require 'worldline/acquiring/sdk/domain/data_object'
|
5
|
+
require 'worldline/acquiring/sdk/v1/domain/geo_coordinates'
|
6
|
+
require 'worldline/acquiring/sdk/v1/domain/service_location_address'
|
7
|
+
|
8
|
+
module Worldline
|
9
|
+
module Acquiring
|
10
|
+
module SDK
|
11
|
+
module V1
|
12
|
+
module Domain
|
13
|
+
# @attr [Worldline::Acquiring::SDK::V1::Domain::ServiceLocationAddress] address
|
14
|
+
# @attr [Worldline::Acquiring::SDK::V1::Domain::GeoCoordinates] geo_coordinates
|
15
|
+
class ServiceLocationData < Worldline::Acquiring::SDK::Domain::DataObject
|
16
|
+
|
17
|
+
attr_accessor :address
|
18
|
+
|
19
|
+
attr_accessor :geo_coordinates
|
20
|
+
|
21
|
+
# @return (Hash)
|
22
|
+
def to_h
|
23
|
+
hash = super
|
24
|
+
hash['address'] = @address.to_h unless @address.nil?
|
25
|
+
hash['geoCoordinates'] = @geo_coordinates.to_h unless @geo_coordinates.nil?
|
26
|
+
hash
|
27
|
+
end
|
28
|
+
|
29
|
+
def from_hash(hash)
|
30
|
+
super
|
31
|
+
if hash.has_key? 'address'
|
32
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['address']] unless hash['address'].is_a? Hash
|
33
|
+
@address = Worldline::Acquiring::SDK::V1::Domain::ServiceLocationAddress.new_from_hash(hash['address'])
|
34
|
+
end
|
35
|
+
if hash.has_key? 'geoCoordinates'
|
36
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['geoCoordinates']] unless hash['geoCoordinates'].is_a? Hash
|
37
|
+
@geo_coordinates = Worldline::Acquiring::SDK::V1::Domain::GeoCoordinates.new_from_hash(hash['geoCoordinates'])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -19,7 +19,6 @@ module Worldline
|
|
19
19
|
# @attr [String] response_code
|
20
20
|
# @attr [String] response_code_category
|
21
21
|
# @attr [String] response_code_description
|
22
|
-
# @attr [String] retry_after
|
23
22
|
class SubOperation < Worldline::Acquiring::SDK::Domain::DataObject
|
24
23
|
|
25
24
|
attr_accessor :amount
|
@@ -38,8 +37,6 @@ module Worldline
|
|
38
37
|
|
39
38
|
attr_accessor :response_code_description
|
40
39
|
|
41
|
-
attr_accessor :retry_after
|
42
|
-
|
43
40
|
# @return (Hash)
|
44
41
|
def to_h
|
45
42
|
hash = super
|
@@ -51,7 +48,6 @@ module Worldline
|
|
51
48
|
hash['responseCode'] = @response_code unless @response_code.nil?
|
52
49
|
hash['responseCodeCategory'] = @response_code_category unless @response_code_category.nil?
|
53
50
|
hash['responseCodeDescription'] = @response_code_description unless @response_code_description.nil?
|
54
|
-
hash['retryAfter'] = @retry_after unless @retry_after.nil?
|
55
51
|
hash
|
56
52
|
end
|
57
53
|
|
@@ -82,9 +78,6 @@ module Worldline
|
|
82
78
|
if hash.has_key? 'responseCodeDescription'
|
83
79
|
@response_code_description = hash['responseCodeDescription']
|
84
80
|
end
|
85
|
-
if hash.has_key? 'retryAfter'
|
86
|
-
@retry_after = hash['retryAfter']
|
87
|
-
end
|
88
81
|
end
|
89
82
|
end
|
90
83
|
end
|
@@ -18,7 +18,6 @@ module Worldline
|
|
18
18
|
# @attr [String] response_code
|
19
19
|
# @attr [String] response_code_category
|
20
20
|
# @attr [String] response_code_description
|
21
|
-
# @attr [String] retry_after
|
22
21
|
class SubOperationForRefund < Worldline::Acquiring::SDK::Domain::DataObject
|
23
22
|
|
24
23
|
attr_accessor :amount
|
@@ -35,8 +34,6 @@ module Worldline
|
|
35
34
|
|
36
35
|
attr_accessor :response_code_description
|
37
36
|
|
38
|
-
attr_accessor :retry_after
|
39
|
-
|
40
37
|
# @return (Hash)
|
41
38
|
def to_h
|
42
39
|
hash = super
|
@@ -47,7 +44,6 @@ module Worldline
|
|
47
44
|
hash['responseCode'] = @response_code unless @response_code.nil?
|
48
45
|
hash['responseCodeCategory'] = @response_code_category unless @response_code_category.nil?
|
49
46
|
hash['responseCodeDescription'] = @response_code_description unless @response_code_description.nil?
|
50
|
-
hash['retryAfter'] = @retry_after unless @retry_after.nil?
|
51
47
|
hash
|
52
48
|
end
|
53
49
|
|
@@ -75,9 +71,6 @@ module Worldline
|
|
75
71
|
if hash.has_key? 'responseCodeDescription'
|
76
72
|
@response_code_description = hash['responseCodeDescription']
|
77
73
|
end
|
78
|
-
if hash.has_key? 'retryAfter'
|
79
|
-
@retry_after = hash['retryAfter']
|
80
|
-
end
|
81
74
|
end
|
82
75
|
end
|
83
76
|
end
|
@@ -12,6 +12,8 @@ module Worldline
|
|
12
12
|
# @attr [Array<String>] card_reading_capabilities
|
13
13
|
# @attr [String] cardholder_activated_terminal_level
|
14
14
|
# @attr [true/false] is_attended_terminal
|
15
|
+
# @attr [true/false] is_offline_approved
|
16
|
+
# @attr [String] offline_authorization_response_code
|
15
17
|
# @attr [String] pin_entry_capability
|
16
18
|
# @attr [String] terminal_id
|
17
19
|
# @attr [String] terminal_location
|
@@ -25,6 +27,10 @@ module Worldline
|
|
25
27
|
|
26
28
|
attr_accessor :is_attended_terminal
|
27
29
|
|
30
|
+
attr_accessor :is_offline_approved
|
31
|
+
|
32
|
+
attr_accessor :offline_authorization_response_code
|
33
|
+
|
28
34
|
attr_accessor :pin_entry_capability
|
29
35
|
|
30
36
|
attr_accessor :terminal_id
|
@@ -38,6 +44,8 @@ module Worldline
|
|
38
44
|
hash['cardReadingCapabilities'] = @card_reading_capabilities unless @card_reading_capabilities.nil?
|
39
45
|
hash['cardholderActivatedTerminalLevel'] = @cardholder_activated_terminal_level unless @cardholder_activated_terminal_level.nil?
|
40
46
|
hash['isAttendedTerminal'] = @is_attended_terminal unless @is_attended_terminal.nil?
|
47
|
+
hash['isOfflineApproved'] = @is_offline_approved unless @is_offline_approved.nil?
|
48
|
+
hash['offlineAuthorizationResponseCode'] = @offline_authorization_response_code unless @offline_authorization_response_code.nil?
|
41
49
|
hash['pinEntryCapability'] = @pin_entry_capability unless @pin_entry_capability.nil?
|
42
50
|
hash['terminalId'] = @terminal_id unless @terminal_id.nil?
|
43
51
|
hash['terminalLocation'] = @terminal_location unless @terminal_location.nil?
|
@@ -62,6 +70,12 @@ module Worldline
|
|
62
70
|
if hash.has_key? 'isAttendedTerminal'
|
63
71
|
@is_attended_terminal = hash['isAttendedTerminal']
|
64
72
|
end
|
73
|
+
if hash.has_key? 'isOfflineApproved'
|
74
|
+
@is_offline_approved = hash['isOfflineApproved']
|
75
|
+
end
|
76
|
+
if hash.has_key? 'offlineAuthorizationResponseCode'
|
77
|
+
@offline_authorization_response_code = hash['offlineAuthorizationResponseCode']
|
78
|
+
end
|
65
79
|
if hash.has_key? 'pinEntryCapability'
|
66
80
|
@pin_entry_capability = hash['pinEntryCapability']
|
67
81
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'yaml'
|
3
|
+
require 'integration_setup'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
|
6
|
+
describe 'custom OAuth2 scopes' do
|
7
|
+
|
8
|
+
before(:context){WebMock.allow_net_connect!}
|
9
|
+
after(:context){WebMock.disable_net_connect!}
|
10
|
+
|
11
|
+
['processing_dcc_rate', 'processing_dcc_rate services_ping', '', nil].each do |oauth2_scopes|
|
12
|
+
it "'#{oauth2_scopes || 'nil'}' are valid" do
|
13
|
+
configuration = Integration.init_communicator_configuration
|
14
|
+
configuration.oauth2_scopes = oauth2_scopes
|
15
|
+
|
16
|
+
Factory.create_client_from_configuration(configuration) do |client|
|
17
|
+
request = Integration.get_dcc_rate_request
|
18
|
+
response = client.v1.acquirer(Integration::ACQUIRER_ID).merchant(Integration::MERCHANT_ID).dynamic_currency_conversion.request_dcc_rate(request)
|
19
|
+
|
20
|
+
expect(response.proposal).to_not be_nil
|
21
|
+
expect(response.proposal.original_amount).to_not be_nil
|
22
|
+
expect(response.proposal.original_amount.amount).to eq(request.transaction.amount.amount)
|
23
|
+
expect(response.proposal.original_amount.currency_code).to eq(request.transaction.amount.currency_code)
|
24
|
+
expect(response.proposal.original_amount.number_of_decimals).to eq(request.transaction.amount.number_of_decimals)
|
25
|
+
expect(response.proposal.resulting_amount.currency_code).to eq(request.target_currency)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'misses required scope' do
|
31
|
+
configuration = Integration.init_communicator_configuration
|
32
|
+
configuration.oauth2_scopes = 'services_ping'
|
33
|
+
|
34
|
+
Factory.create_client_from_configuration(configuration) do |client|
|
35
|
+
request = Integration.get_dcc_rate_request
|
36
|
+
expect{client.v1.acquirer(Integration::ACQUIRER_ID).merchant(Integration::MERCHANT_ID).dynamic_currency_conversion.request_dcc_rate(request)}
|
37
|
+
.to raise_error(Worldline::Acquiring::SDK::V1::AuthorizationException)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'has an invalid scope' do
|
42
|
+
configuration = Integration.init_communicator_configuration
|
43
|
+
configuration.oauth2_scopes = 'processing_dcc_rate invalid_scope'
|
44
|
+
|
45
|
+
Factory.create_client_from_configuration(configuration) do |client|
|
46
|
+
request = Integration.get_dcc_rate_request
|
47
|
+
expect {client.v1.acquirer(Integration::ACQUIRER_ID).merchant(Integration::MERCHANT_ID).dynamic_currency_conversion.request_dcc_rate(request)}
|
48
|
+
.to raise_error(Worldline::Acquiring::SDK::Authentication::OAuth2Exception)
|
49
|
+
.with_message(/There was an error while retrieving the OAuth2 access token: invalid_scope - .*/)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'OAuth2Scopes' do
|
4
|
+
|
5
|
+
it 'all should contain the correct scopes' do
|
6
|
+
all_scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.all
|
7
|
+
expect(all_scopes).to include('processing_payment')
|
8
|
+
expect(all_scopes).to include('processing_dcc_rate')
|
9
|
+
expect(all_scopes).to include('services_ping')
|
10
|
+
|
11
|
+
all_scopes_string = all_scopes.join(' ')
|
12
|
+
expect(all_scopes_string.length).to be <= 260
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'for v1 should contain the correct scopes' do
|
16
|
+
scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.for_api_version('v1')
|
17
|
+
expect(scopes).to include('processing_payment')
|
18
|
+
expect(scopes).to include('processing_dcc_rate')
|
19
|
+
expect(scopes).to include('services_ping')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'for an unknown API version should contain no scopes' do
|
23
|
+
scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.for_api_version('v-1')
|
24
|
+
expect(scopes).to eq([])
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'for v1 processPayment should contain the correct scopes' do
|
28
|
+
scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.for_operation('v1', 'processPayment')
|
29
|
+
expect(scopes).to include('processing_payment')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'for v1 requestDccRate should contain the correct scopes' do
|
33
|
+
scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.for_operation('v1', 'requestDccRate')
|
34
|
+
expect(scopes).to include('processing_dcc_rate')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'for an unknown operation should contain no scopes' do
|
38
|
+
scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.for_operation('v1', 'unknown')
|
39
|
+
expect(scopes).to eq([])
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'for an unknown API version should contain no scopes' do
|
43
|
+
scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.for_operation('v-1', 'processPayment')
|
44
|
+
expect(scopes).to eq([])
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'for multiple v1 operations should contain the correct scopes' do
|
48
|
+
scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.for_operations('v1', 'processPayment', 'requestDccRate', 'unknown')
|
49
|
+
expect(scopes).to include('processing_payment')
|
50
|
+
expect(scopes).to include('processing_dcc_rate')
|
51
|
+
expect(scopes).not_to include('services_ping')
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'for multiple operations of an unknown API version should contain no scopes' do
|
55
|
+
scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.for_operations('v-1', 'processPayment', 'requestDccRate')
|
56
|
+
expect(scopes).to eq([])
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'for filtered operations should contain the correct scopes' do
|
60
|
+
operation_ids = [ 'processPayment', 'requestDccRate', 'unknown' ]
|
61
|
+
scopes = Worldline::Acquiring::SDK::Authentication::OAuth2Scopes.for_filtered_operations(lambda { |api_version, operation_id| api_version == 'v1' && operation_ids.include?(operation_id) })
|
62
|
+
expect(scopes).to include('processing_payment')
|
63
|
+
expect(scopes).to include('processing_dcc_rate')
|
64
|
+
expect(scopes).not_to include('services_ping')
|
65
|
+
end
|
66
|
+
end
|