onlinepayments-sdk-ruby 8.2.0 → 8.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/lib/onlinepayments/sdk/communication/metadata_provider.rb +1 -1
- data/lib/onlinepayments/sdk/communication/not_found_exception.rb +1 -1
- data/lib/onlinepayments/sdk/communication/response_exception.rb +2 -5
- data/lib/onlinepayments/sdk/communication/response_header.rb +5 -5
- data/lib/onlinepayments/sdk/communicator.rb +4 -4
- data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input.rb +9 -0
- data/lib/onlinepayments/sdk/domain/card_payment_method_specific_input_base.rb +9 -0
- data/lib/onlinepayments/sdk/domain/create_hosted_tokenization_response.rb +7 -0
- data/lib/onlinepayments/sdk/domain/hosted_checkout_specific_input.rb +7 -0
- data/lib/onlinepayments/sdk/domain/redirect_payment_method_specific_input.rb +9 -0
- data/lib/onlinepayments/sdk/domain/redirect_payment_product900_specific_input.rb +30 -0
- data/lib/onlinepayments/sdk/domain/sub_merchant.rb +60 -0
- data/lib/onlinepayments/sdk/domain/uploadable_file.rb +2 -2
- data/lib/onlinepayments/sdk/exception_factory.rb +1 -0
- data/lib/onlinepayments/sdk/json/default_marshaller.rb +2 -5
- data/lib/onlinepayments/sdk/logging/request_log_message_builder.rb +2 -3
- data/lib/onlinepayments/sdk/webhooks/signature_validation_exception.rb +3 -1
- data/onlinepayments-sdk-ruby.gemspec +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9ccabc322a19d78c7084553911d1c6df7c554f16316856ab61f2549fe96b5cff
|
|
4
|
+
data.tar.gz: c3b3990140d012901bed22f25b06713fc251d99e165314122978cd766eae369b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca82d1a77fe0dd53f69fb72a2d542a73fbd8711a065ba5a053f6c4642a80c4dbdfb7def3fbb693a4f412052c60eeda2fe5ae2e3974f49b6e300a2e66d4f36522
|
|
7
|
+
data.tar.gz: 32c2486c2a684adecd63b0d8c60188dc1107ac3c4ead2bf29ee2b9480f028ce1c10cc31dc4dff82058cb4ad8a780c665ee698d442d18d7e299638f49215d632a
|
|
@@ -13,7 +13,7 @@ module OnlinePayments
|
|
|
13
13
|
class MetadataProvider
|
|
14
14
|
private
|
|
15
15
|
|
|
16
|
-
SDK_VERSION = '8.
|
|
16
|
+
SDK_VERSION = '8.3.0'.freeze
|
|
17
17
|
SERVER_META_INFO_HEADER = 'X-GCS-ServerMetaInfo'.freeze
|
|
18
18
|
PROHIBITED_HEADERS = [SERVER_META_INFO_HEADER, 'X-GCS-Idempotence-Key', 'Date', 'Content-Type', 'Authorization'].sort!.freeze
|
|
19
19
|
CHARSET = 'utf-8'.freeze
|
|
@@ -14,12 +14,9 @@ module OnlinePayments
|
|
|
14
14
|
super('the Online Payments platform returned an error response')
|
|
15
15
|
@status_code = status_code
|
|
16
16
|
@headers = if headers.nil? or headers.empty?
|
|
17
|
-
|
|
17
|
+
[]
|
|
18
18
|
else
|
|
19
|
-
headers.
|
|
20
|
-
hash[header.name.downcase.to_sym] = header.dup.freeze
|
|
21
|
-
hash
|
|
22
|
-
end
|
|
19
|
+
headers.map { |h| h.dup.freeze }
|
|
23
20
|
end.freeze
|
|
24
21
|
@body = body
|
|
25
22
|
end
|
|
@@ -51,8 +51,8 @@ module OnlinePayments
|
|
|
51
51
|
def self.get_disposition_filename(headers)
|
|
52
52
|
header_value = get_header_value(headers, "Content-Disposition")
|
|
53
53
|
unless header_value.nil?
|
|
54
|
-
if header_value =~ /(?:^|;)\s*filename\s*=\s*(.*?)\s*(?:;|$)i
|
|
55
|
-
return trim_quotes($
|
|
54
|
+
if header_value =~ /(?:^|;)\s*filename\s*=\s*(.*?)\s*(?:;|$)/i
|
|
55
|
+
return trim_quotes($1)
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -63,10 +63,10 @@ module OnlinePayments
|
|
|
63
63
|
|
|
64
64
|
# Trims the single or double quotes at the beginning and end of parameter _filename_ if they exist
|
|
65
65
|
# If they don't exist, it returns the original _filename_ instead
|
|
66
|
-
def trim_quotes(filename)
|
|
66
|
+
def self.trim_quotes(filename)
|
|
67
67
|
unless filename.length < 2
|
|
68
|
-
if (filename.chars.first == '\'' && filename.chars.last == '\
|
|
69
|
-
|
|
68
|
+
if (filename.chars.first == '\'' && filename.chars.last == '\'') ||
|
|
69
|
+
(filename.chars.first == '"' && filename.chars.last == '"')
|
|
70
70
|
return filename[1...-1]
|
|
71
71
|
end
|
|
72
72
|
end
|
|
@@ -42,12 +42,12 @@ module OnlinePayments
|
|
|
42
42
|
raise ArgumentError.new('connection is required') unless connection
|
|
43
43
|
raise ArgumentError.new('authenticator is required') unless authenticator
|
|
44
44
|
raise ArgumentError.new('metadata_provider is required') unless metadata_provider
|
|
45
|
-
raise ArgumentError('marshaller is required') if marshaller.nil?
|
|
45
|
+
raise ArgumentError.new('marshaller is required') if marshaller.nil?
|
|
46
46
|
|
|
47
47
|
uri = URI(api_endpoint)
|
|
48
|
-
raise RuntimeError('api_endpoint should not contain a path') unless uri.path.nil? || uri.path.empty?
|
|
48
|
+
raise RuntimeError.new('api_endpoint should not contain a path') unless uri.path.nil? || uri.path.empty?
|
|
49
49
|
unless uri.userinfo.nil? && uri.query.nil? && uri.fragment.nil?
|
|
50
|
-
raise RuntimeError('api_endpoint should not contain user info, query or fragment')
|
|
50
|
+
raise RuntimeError.new('api_endpoint should not contain user info, query or fragment')
|
|
51
51
|
end
|
|
52
52
|
@api_endpoint = uri
|
|
53
53
|
@connection = connection
|
|
@@ -499,7 +499,7 @@ module OnlinePayments
|
|
|
499
499
|
|
|
500
500
|
def throw_exception_if_necessary(body, status_code, headers, request_path)
|
|
501
501
|
if status_code < 200 || status_code >= 300
|
|
502
|
-
if !body.nil? && !is_json(headers)
|
|
502
|
+
if !body.nil? && !body.empty? && !is_json(headers)
|
|
503
503
|
cause = Communication::ResponseException.new(status_code, headers, body)
|
|
504
504
|
if status_code == 404
|
|
505
505
|
raise Communication::NotFoundException.new(cause, 'The requested resource was not found; invalid path: ' +
|
|
@@ -14,6 +14,7 @@ require 'onlinepayments/sdk/domain/payment_product3012_specific_input'
|
|
|
14
14
|
require 'onlinepayments/sdk/domain/payment_product3013_specific_input'
|
|
15
15
|
require 'onlinepayments/sdk/domain/payment_product3208_specific_input'
|
|
16
16
|
require 'onlinepayments/sdk/domain/payment_product3209_specific_input'
|
|
17
|
+
require 'onlinepayments/sdk/domain/sub_merchant'
|
|
17
18
|
require 'onlinepayments/sdk/domain/three_d_secure'
|
|
18
19
|
|
|
19
20
|
module OnlinePayments
|
|
@@ -42,6 +43,7 @@ module OnlinePayments
|
|
|
42
43
|
# @attr [String] return_url
|
|
43
44
|
# @attr [String] scheme_reference_data
|
|
44
45
|
# @attr [true/false] skip_authentication
|
|
46
|
+
# @attr [OnlinePayments::SDK::Domain::SubMerchant] sub_merchant
|
|
45
47
|
# @attr [OnlinePayments::SDK::Domain::ThreeDSecure] three_d_secure
|
|
46
48
|
# @attr [String] token
|
|
47
49
|
# @attr [true/false] tokenize
|
|
@@ -97,6 +99,8 @@ module OnlinePayments
|
|
|
97
99
|
# @deprecated Use threeDSecure.skipAuthentication instead. * true = 3D Secure authentication will be skipped for this transaction. This setting should be used when isRecurring is set to true and recurringPaymentSequenceIndicator is set to recurring. * false = 3D Secure authentication will not be skipped for this transaction. Note: This is only possible if your account in our system is setup for 3D Secure authentication and if your configuration in our system allows you to override it per transaction.
|
|
98
100
|
attr_accessor :skip_authentication
|
|
99
101
|
|
|
102
|
+
attr_accessor :sub_merchant
|
|
103
|
+
|
|
100
104
|
attr_accessor :three_d_secure
|
|
101
105
|
|
|
102
106
|
attr_accessor :token
|
|
@@ -135,6 +139,7 @@ module OnlinePayments
|
|
|
135
139
|
hash['returnUrl'] = @return_url unless @return_url.nil?
|
|
136
140
|
hash['schemeReferenceData'] = @scheme_reference_data unless @scheme_reference_data.nil?
|
|
137
141
|
hash['skipAuthentication'] = @skip_authentication unless @skip_authentication.nil?
|
|
142
|
+
hash['subMerchant'] = @sub_merchant.to_h unless @sub_merchant.nil?
|
|
138
143
|
hash['threeDSecure'] = @three_d_secure.to_h unless @three_d_secure.nil?
|
|
139
144
|
hash['token'] = @token unless @token.nil?
|
|
140
145
|
hash['tokenize'] = @tokenize unless @tokenize.nil?
|
|
@@ -227,6 +232,10 @@ module OnlinePayments
|
|
|
227
232
|
if hash.has_key? 'skipAuthentication'
|
|
228
233
|
@skip_authentication = hash['skipAuthentication']
|
|
229
234
|
end
|
|
235
|
+
if hash.has_key? 'subMerchant'
|
|
236
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['subMerchant']] unless hash['subMerchant'].is_a? Hash
|
|
237
|
+
@sub_merchant = OnlinePayments::SDK::Domain::SubMerchant.new_from_hash(hash['subMerchant'])
|
|
238
|
+
end
|
|
230
239
|
if hash.has_key? 'threeDSecure'
|
|
231
240
|
raise TypeError, "value '%s' is not a Hash" % [hash['threeDSecure']] unless hash['threeDSecure'].is_a? Hash
|
|
232
241
|
@three_d_secure = OnlinePayments::SDK::Domain::ThreeDSecure.new_from_hash(hash['threeDSecure'])
|
|
@@ -13,6 +13,7 @@ require 'onlinepayments/sdk/domain/payment_product3013_specific_input'
|
|
|
13
13
|
require 'onlinepayments/sdk/domain/payment_product3208_specific_input'
|
|
14
14
|
require 'onlinepayments/sdk/domain/payment_product3209_specific_input'
|
|
15
15
|
require 'onlinepayments/sdk/domain/payment_product5100_specific_input'
|
|
16
|
+
require 'onlinepayments/sdk/domain/sub_merchant'
|
|
16
17
|
require 'onlinepayments/sdk/domain/three_d_secure_base'
|
|
17
18
|
|
|
18
19
|
module OnlinePayments
|
|
@@ -33,6 +34,7 @@ module OnlinePayments
|
|
|
33
34
|
# @attr [OnlinePayments::SDK::Domain::PaymentProduct5100SpecificInput] payment_product5100_specific_input
|
|
34
35
|
# @attr [Integer] payment_product_id
|
|
35
36
|
# @attr [OnlinePayments::SDK::Domain::CardRecurrenceDetails] recurring
|
|
37
|
+
# @attr [OnlinePayments::SDK::Domain::SubMerchant] sub_merchant
|
|
36
38
|
# @attr [OnlinePayments::SDK::Domain::ThreeDSecureBase] three_d_secure
|
|
37
39
|
# @attr [String] token
|
|
38
40
|
# @attr [true/false] tokenize
|
|
@@ -71,6 +73,8 @@ module OnlinePayments
|
|
|
71
73
|
|
|
72
74
|
attr_accessor :recurring
|
|
73
75
|
|
|
76
|
+
attr_accessor :sub_merchant
|
|
77
|
+
|
|
74
78
|
attr_accessor :three_d_secure
|
|
75
79
|
|
|
76
80
|
attr_accessor :token
|
|
@@ -101,6 +105,7 @@ module OnlinePayments
|
|
|
101
105
|
hash['paymentProduct5100SpecificInput'] = @payment_product5100_specific_input.to_h unless @payment_product5100_specific_input.nil?
|
|
102
106
|
hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil?
|
|
103
107
|
hash['recurring'] = @recurring.to_h unless @recurring.nil?
|
|
108
|
+
hash['subMerchant'] = @sub_merchant.to_h unless @sub_merchant.nil?
|
|
104
109
|
hash['threeDSecure'] = @three_d_secure.to_h unless @three_d_secure.nil?
|
|
105
110
|
hash['token'] = @token unless @token.nil?
|
|
106
111
|
hash['tokenize'] = @tokenize unless @tokenize.nil?
|
|
@@ -168,6 +173,10 @@ module OnlinePayments
|
|
|
168
173
|
raise TypeError, "value '%s' is not a Hash" % [hash['recurring']] unless hash['recurring'].is_a? Hash
|
|
169
174
|
@recurring = OnlinePayments::SDK::Domain::CardRecurrenceDetails.new_from_hash(hash['recurring'])
|
|
170
175
|
end
|
|
176
|
+
if hash.has_key? 'subMerchant'
|
|
177
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['subMerchant']] unless hash['subMerchant'].is_a? Hash
|
|
178
|
+
@sub_merchant = OnlinePayments::SDK::Domain::SubMerchant.new_from_hash(hash['subMerchant'])
|
|
179
|
+
end
|
|
171
180
|
if hash.has_key? 'threeDSecure'
|
|
172
181
|
raise TypeError, "value '%s' is not a Hash" % [hash['threeDSecure']] unless hash['threeDSecure'].is_a? Hash
|
|
173
182
|
@three_d_secure = OnlinePayments::SDK::Domain::ThreeDSecureBase.new_from_hash(hash['threeDSecure'])
|
|
@@ -11,6 +11,7 @@ module OnlinePayments
|
|
|
11
11
|
# @attr [String] hosted_tokenization_url
|
|
12
12
|
# @attr [Array<String>] invalid_tokens
|
|
13
13
|
# @attr [String] partial_redirect_url
|
|
14
|
+
# @attr [String] sri
|
|
14
15
|
class CreateHostedTokenizationResponse < OnlinePayments::SDK::Domain::DataObject
|
|
15
16
|
|
|
16
17
|
attr_accessor :expired_card_tokens
|
|
@@ -24,6 +25,8 @@ module OnlinePayments
|
|
|
24
25
|
# @deprecated Deprecated
|
|
25
26
|
attr_accessor :partial_redirect_url
|
|
26
27
|
|
|
28
|
+
attr_accessor :sri
|
|
29
|
+
|
|
27
30
|
# @return (Hash)
|
|
28
31
|
def to_h
|
|
29
32
|
hash = super
|
|
@@ -32,6 +35,7 @@ module OnlinePayments
|
|
|
32
35
|
hash['hostedTokenizationUrl'] = @hosted_tokenization_url unless @hosted_tokenization_url.nil?
|
|
33
36
|
hash['invalidTokens'] = @invalid_tokens unless @invalid_tokens.nil?
|
|
34
37
|
hash['partialRedirectUrl'] = @partial_redirect_url unless @partial_redirect_url.nil?
|
|
38
|
+
hash['sri'] = @sri unless @sri.nil?
|
|
35
39
|
hash
|
|
36
40
|
end
|
|
37
41
|
|
|
@@ -60,6 +64,9 @@ module OnlinePayments
|
|
|
60
64
|
if hash.has_key? 'partialRedirectUrl'
|
|
61
65
|
@partial_redirect_url = hash['partialRedirectUrl']
|
|
62
66
|
end
|
|
67
|
+
if hash.has_key? 'sri'
|
|
68
|
+
@sri = hash['sri']
|
|
69
|
+
end
|
|
63
70
|
end
|
|
64
71
|
end
|
|
65
72
|
end
|
|
@@ -10,6 +10,7 @@ module OnlinePayments
|
|
|
10
10
|
module SDK
|
|
11
11
|
module Domain
|
|
12
12
|
# @attr [Integer] allowed_number_of_payment_attempts
|
|
13
|
+
# @attr [true/false] auto_refund_split_payments
|
|
13
14
|
# @attr [OnlinePayments::SDK::Domain::CardPaymentMethodSpecificInputForHostedCheckout] card_payment_method_specific_input
|
|
14
15
|
# @attr [true/false] is_new_unscheduled_card_on_file_series
|
|
15
16
|
# @attr [true/false] is_recurring
|
|
@@ -25,6 +26,8 @@ module OnlinePayments
|
|
|
25
26
|
|
|
26
27
|
attr_accessor :allowed_number_of_payment_attempts
|
|
27
28
|
|
|
29
|
+
attr_accessor :auto_refund_split_payments
|
|
30
|
+
|
|
28
31
|
attr_accessor :card_payment_method_specific_input
|
|
29
32
|
|
|
30
33
|
attr_accessor :is_new_unscheduled_card_on_file_series
|
|
@@ -51,6 +54,7 @@ module OnlinePayments
|
|
|
51
54
|
def to_h
|
|
52
55
|
hash = super
|
|
53
56
|
hash['allowedNumberOfPaymentAttempts'] = @allowed_number_of_payment_attempts unless @allowed_number_of_payment_attempts.nil?
|
|
57
|
+
hash['autoRefundSplitPayments'] = @auto_refund_split_payments unless @auto_refund_split_payments.nil?
|
|
54
58
|
hash['cardPaymentMethodSpecificInput'] = @card_payment_method_specific_input.to_h unless @card_payment_method_specific_input.nil?
|
|
55
59
|
hash['isNewUnscheduledCardOnFileSeries'] = @is_new_unscheduled_card_on_file_series unless @is_new_unscheduled_card_on_file_series.nil?
|
|
56
60
|
hash['isRecurring'] = @is_recurring unless @is_recurring.nil?
|
|
@@ -70,6 +74,9 @@ module OnlinePayments
|
|
|
70
74
|
if hash.has_key? 'allowedNumberOfPaymentAttempts'
|
|
71
75
|
@allowed_number_of_payment_attempts = hash['allowedNumberOfPaymentAttempts']
|
|
72
76
|
end
|
|
77
|
+
if hash.has_key? 'autoRefundSplitPayments'
|
|
78
|
+
@auto_refund_split_payments = hash['autoRefundSplitPayments']
|
|
79
|
+
end
|
|
73
80
|
if hash.has_key? 'cardPaymentMethodSpecificInput'
|
|
74
81
|
raise TypeError, "value '%s' is not a Hash" % [hash['cardPaymentMethodSpecificInput']] unless hash['cardPaymentMethodSpecificInput'].is_a? Hash
|
|
75
82
|
@card_payment_method_specific_input = OnlinePayments::SDK::Domain::CardPaymentMethodSpecificInputForHostedCheckout.new_from_hash(hash['cardPaymentMethodSpecificInput'])
|
|
@@ -24,6 +24,7 @@ require 'onlinepayments/sdk/domain/redirect_payment_product5412_specific_input'
|
|
|
24
24
|
require 'onlinepayments/sdk/domain/redirect_payment_product5601_specific_input'
|
|
25
25
|
require 'onlinepayments/sdk/domain/redirect_payment_product809_specific_input'
|
|
26
26
|
require 'onlinepayments/sdk/domain/redirect_payment_product840_specific_input'
|
|
27
|
+
require 'onlinepayments/sdk/domain/redirect_payment_product900_specific_input'
|
|
27
28
|
require 'onlinepayments/sdk/domain/redirection_data'
|
|
28
29
|
|
|
29
30
|
module OnlinePayments
|
|
@@ -52,6 +53,7 @@ module OnlinePayments
|
|
|
52
53
|
# @attr [OnlinePayments::SDK::Domain::RedirectPaymentProduct5601SpecificInput] payment_product5601_specific_input
|
|
53
54
|
# @attr [OnlinePayments::SDK::Domain::RedirectPaymentProduct809SpecificInput] payment_product809_specific_input
|
|
54
55
|
# @attr [OnlinePayments::SDK::Domain::RedirectPaymentProduct840SpecificInput] payment_product840_specific_input
|
|
56
|
+
# @attr [OnlinePayments::SDK::Domain::RedirectPaymentProduct900SpecificInput] payment_product900_specific_input
|
|
55
57
|
# @attr [Integer] payment_product_id
|
|
56
58
|
# @attr [OnlinePayments::SDK::Domain::RedirectionData] redirection_data
|
|
57
59
|
# @attr [true/false] requires_approval
|
|
@@ -105,6 +107,8 @@ module OnlinePayments
|
|
|
105
107
|
|
|
106
108
|
attr_accessor :payment_product840_specific_input
|
|
107
109
|
|
|
110
|
+
attr_accessor :payment_product900_specific_input
|
|
111
|
+
|
|
108
112
|
attr_accessor :payment_product_id
|
|
109
113
|
|
|
110
114
|
attr_accessor :redirection_data
|
|
@@ -141,6 +145,7 @@ module OnlinePayments
|
|
|
141
145
|
hash['paymentProduct5601SpecificInput'] = @payment_product5601_specific_input.to_h unless @payment_product5601_specific_input.nil?
|
|
142
146
|
hash['paymentProduct809SpecificInput'] = @payment_product809_specific_input.to_h unless @payment_product809_specific_input.nil?
|
|
143
147
|
hash['paymentProduct840SpecificInput'] = @payment_product840_specific_input.to_h unless @payment_product840_specific_input.nil?
|
|
148
|
+
hash['paymentProduct900SpecificInput'] = @payment_product900_specific_input.to_h unless @payment_product900_specific_input.nil?
|
|
144
149
|
hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil?
|
|
145
150
|
hash['redirectionData'] = @redirection_data.to_h unless @redirection_data.nil?
|
|
146
151
|
hash['requiresApproval'] = @requires_approval unless @requires_approval.nil?
|
|
@@ -242,6 +247,10 @@ module OnlinePayments
|
|
|
242
247
|
raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct840SpecificInput']] unless hash['paymentProduct840SpecificInput'].is_a? Hash
|
|
243
248
|
@payment_product840_specific_input = OnlinePayments::SDK::Domain::RedirectPaymentProduct840SpecificInput.new_from_hash(hash['paymentProduct840SpecificInput'])
|
|
244
249
|
end
|
|
250
|
+
if hash.has_key? 'paymentProduct900SpecificInput'
|
|
251
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct900SpecificInput']] unless hash['paymentProduct900SpecificInput'].is_a? Hash
|
|
252
|
+
@payment_product900_specific_input = OnlinePayments::SDK::Domain::RedirectPaymentProduct900SpecificInput.new_from_hash(hash['paymentProduct900SpecificInput'])
|
|
253
|
+
end
|
|
245
254
|
if hash.has_key? 'paymentProductId'
|
|
246
255
|
@payment_product_id = hash['paymentProductId']
|
|
247
256
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file was automatically generated.
|
|
3
|
+
#
|
|
4
|
+
require 'onlinepayments/sdk/domain/data_object'
|
|
5
|
+
|
|
6
|
+
module OnlinePayments
|
|
7
|
+
module SDK
|
|
8
|
+
module Domain
|
|
9
|
+
# @attr [String] capture_trigger
|
|
10
|
+
class RedirectPaymentProduct900SpecificInput < OnlinePayments::SDK::Domain::DataObject
|
|
11
|
+
|
|
12
|
+
attr_accessor :capture_trigger
|
|
13
|
+
|
|
14
|
+
# @return (Hash)
|
|
15
|
+
def to_h
|
|
16
|
+
hash = super
|
|
17
|
+
hash['captureTrigger'] = @capture_trigger unless @capture_trigger.nil?
|
|
18
|
+
hash
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def from_hash(hash)
|
|
22
|
+
super
|
|
23
|
+
if hash.has_key? 'captureTrigger'
|
|
24
|
+
@capture_trigger = hash['captureTrigger']
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file was automatically generated.
|
|
3
|
+
#
|
|
4
|
+
require 'onlinepayments/sdk/domain/address'
|
|
5
|
+
require 'onlinepayments/sdk/domain/data_object'
|
|
6
|
+
|
|
7
|
+
module OnlinePayments
|
|
8
|
+
module SDK
|
|
9
|
+
module Domain
|
|
10
|
+
# @attr [OnlinePayments::SDK::Domain::Address] address
|
|
11
|
+
# @attr [String] company_identification_number
|
|
12
|
+
# @attr [String] company_name
|
|
13
|
+
# @attr [String] merchant_category_code
|
|
14
|
+
# @attr [String] merchant_id
|
|
15
|
+
class SubMerchant < OnlinePayments::SDK::Domain::DataObject
|
|
16
|
+
|
|
17
|
+
attr_accessor :address
|
|
18
|
+
|
|
19
|
+
attr_accessor :company_identification_number
|
|
20
|
+
|
|
21
|
+
attr_accessor :company_name
|
|
22
|
+
|
|
23
|
+
attr_accessor :merchant_category_code
|
|
24
|
+
|
|
25
|
+
attr_accessor :merchant_id
|
|
26
|
+
|
|
27
|
+
# @return (Hash)
|
|
28
|
+
def to_h
|
|
29
|
+
hash = super
|
|
30
|
+
hash['address'] = @address.to_h unless @address.nil?
|
|
31
|
+
hash['companyIdentificationNumber'] = @company_identification_number unless @company_identification_number.nil?
|
|
32
|
+
hash['companyName'] = @company_name unless @company_name.nil?
|
|
33
|
+
hash['merchantCategoryCode'] = @merchant_category_code unless @merchant_category_code.nil?
|
|
34
|
+
hash['merchantId'] = @merchant_id unless @merchant_id.nil?
|
|
35
|
+
hash
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def from_hash(hash)
|
|
39
|
+
super
|
|
40
|
+
if hash.has_key? 'address'
|
|
41
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['address']] unless hash['address'].is_a? Hash
|
|
42
|
+
@address = OnlinePayments::SDK::Domain::Address.new_from_hash(hash['address'])
|
|
43
|
+
end
|
|
44
|
+
if hash.has_key? 'companyIdentificationNumber'
|
|
45
|
+
@company_identification_number = hash['companyIdentificationNumber']
|
|
46
|
+
end
|
|
47
|
+
if hash.has_key? 'companyName'
|
|
48
|
+
@company_name = hash['companyName']
|
|
49
|
+
end
|
|
50
|
+
if hash.has_key? 'merchantCategoryCode'
|
|
51
|
+
@merchant_category_code = hash['merchantCategoryCode']
|
|
52
|
+
end
|
|
53
|
+
if hash.has_key? 'merchantId'
|
|
54
|
+
@merchant_id = hash['merchantId']
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -13,9 +13,9 @@ module OnlinePayments
|
|
|
13
13
|
class UploadableFile
|
|
14
14
|
|
|
15
15
|
def initialize(file_name, content, content_type, content_length = -1)
|
|
16
|
-
raise ArgumentError.new("file_name is required") if file_name.nil?
|
|
16
|
+
raise ArgumentError.new("file_name is required") if file_name.nil? || file_name.strip.empty?
|
|
17
17
|
raise ArgumentError.new("content is required") if content.nil?
|
|
18
|
-
raise ArgumentError.new("content_type is required") if content_type.nil?
|
|
18
|
+
raise ArgumentError.new("content_type is required") if content_type.nil? || content_type.strip.empty?
|
|
19
19
|
|
|
20
20
|
@file_name = file_name
|
|
21
21
|
@content = content
|
|
@@ -36,6 +36,7 @@ module OnlinePayments
|
|
|
36
36
|
if error_object.is_a?(OnlinePayments::SDK::Domain::ProblemDetailsResponse)
|
|
37
37
|
return ProblemDetailsException.new(status_code, response_body, error_object)
|
|
38
38
|
end
|
|
39
|
+
return ApiException.new(status_code, response_body, nil, nil) if error_object.nil?
|
|
39
40
|
raise ArgumentError.new("unsupported error object type: " + error_object.class.name) unless error_object.is_a?(OnlinePayments::SDK::Domain::ErrorResponse)
|
|
40
41
|
create_exception_from_response_fields(status_code, response_body, error_object.error_id, error_object.errors, context)
|
|
41
42
|
end
|
|
@@ -12,16 +12,13 @@ module OnlinePayments
|
|
|
12
12
|
|
|
13
13
|
# Marshals the _request_object_ to a JSON string using request_object#to_h
|
|
14
14
|
def marshal(request_object)
|
|
15
|
+
return 'null' if request_object.nil?
|
|
15
16
|
::JSON.pretty_generate(request_object.to_h)
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
# Unmarshals a JSON string into an object of type _klass_ using klass.new_from_hash
|
|
19
20
|
def unmarshal(json_string, klass)
|
|
20
|
-
if json_string.nil?
|
|
21
|
-
return nil
|
|
22
|
-
elsif json_string.length == 0
|
|
23
|
-
return ''
|
|
24
|
-
end
|
|
21
|
+
return nil if json_string.nil? || json_string.empty?
|
|
25
22
|
if klass.respond_to?(:new_from_hash)
|
|
26
23
|
klass.new_from_hash(::JSON.load(json_string))
|
|
27
24
|
else
|
|
@@ -36,13 +36,12 @@ module OnlinePayments
|
|
|
36
36
|
private
|
|
37
37
|
|
|
38
38
|
def format_uri
|
|
39
|
-
'' unless @uri && @uri.path
|
|
39
|
+
return '' unless @uri && @uri.path
|
|
40
40
|
if @uri.query.nil?
|
|
41
41
|
@uri.path
|
|
42
42
|
else
|
|
43
|
-
"#{@uri.path}?#{@uri.query}"
|
|
43
|
+
"#{@uri.path}?#{@uri.query}"
|
|
44
44
|
end
|
|
45
|
-
# @uri.path + '?' + empty_if_null(@uri.query)
|
|
46
45
|
end
|
|
47
46
|
end
|
|
48
47
|
end
|
|
@@ -10,7 +10,9 @@ module OnlinePayments
|
|
|
10
10
|
# @option args [String] :message the error message
|
|
11
11
|
# @option args [RuntimeError] :cause an Error object that causes the Exception
|
|
12
12
|
def initialize(args)
|
|
13
|
-
|
|
13
|
+
msg = args[:message]
|
|
14
|
+
msg = args[:cause].to_s if msg.nil? && !args[:cause].nil?
|
|
15
|
+
super(msg)
|
|
14
16
|
# store backtrace info if exception given
|
|
15
17
|
set_backtrace(args[:cause].backtrace) unless args[:cause].nil?
|
|
16
18
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |spec|
|
|
2
2
|
spec.name = 'onlinepayments-sdk-ruby'
|
|
3
|
-
spec.version = '8.
|
|
3
|
+
spec.version = '8.3.0'
|
|
4
4
|
spec.authors = ['Worldline Direct support team']
|
|
5
5
|
spec.email = ['82139942+worldline-direct-support-team@users.noreply.github.com']
|
|
6
6
|
spec.summary = %q{SDK to communicate with the Online Payments platform using the Online Payments Server API}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: onlinepayments-sdk-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.
|
|
4
|
+
version: 8.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Worldline Direct support team
|
|
@@ -451,6 +451,7 @@ files:
|
|
|
451
451
|
- lib/onlinepayments/sdk/domain/redirect_payment_product5601_specific_input.rb
|
|
452
452
|
- lib/onlinepayments/sdk/domain/redirect_payment_product809_specific_input.rb
|
|
453
453
|
- lib/onlinepayments/sdk/domain/redirect_payment_product840_specific_input.rb
|
|
454
|
+
- lib/onlinepayments/sdk/domain/redirect_payment_product900_specific_input.rb
|
|
454
455
|
- lib/onlinepayments/sdk/domain/redirection_data.rb
|
|
455
456
|
- lib/onlinepayments/sdk/domain/refund_card_method_specific_output.rb
|
|
456
457
|
- lib/onlinepayments/sdk/domain/refund_e_wallet_method_specific_output.rb
|
|
@@ -488,6 +489,7 @@ files:
|
|
|
488
489
|
- lib/onlinepayments/sdk/domain/show_instructions_data.rb
|
|
489
490
|
- lib/onlinepayments/sdk/domain/split_payment_product_filter.rb
|
|
490
491
|
- lib/onlinepayments/sdk/domain/split_payment_product_filters_hosted_checkout.rb
|
|
492
|
+
- lib/onlinepayments/sdk/domain/sub_merchant.rb
|
|
491
493
|
- lib/onlinepayments/sdk/domain/submit_batch_request_body.rb
|
|
492
494
|
- lib/onlinepayments/sdk/domain/submit_batch_response.rb
|
|
493
495
|
- lib/onlinepayments/sdk/domain/subsequent_card_payment_method_specific_input.rb
|