onlinepayments-sdk-ruby 8.3.0 → 8.4.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/exception_factory.rb +25 -25
- data/lib/onlinepayments/sdk/json/default_marshaller.rb +2 -0
- data/lib/onlinepayments/sdk/logging/request_log_message_builder.rb +5 -5
- data/onlinepayments-sdk-ruby.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 214a7d33b7e66eba1729b2f5c9d783aa651d58b9433b70b73e7ee12be787171f
|
|
4
|
+
data.tar.gz: 3443cef8b63ba39f4ef8045867284e1daef75895cf216da7966ebcadebbf0ab9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5808702960a9914a8b5a259676eb6fd583958b451ca46ecb6365e7c4f071740b569854d7a4e879cf08139b19cd2a4817606313952dbe8579902c1c7a86e89db
|
|
7
|
+
data.tar.gz: 3f322458e2988857ea119038535ed63cee028a32d815c4ce2917d0cfb5766f06bd2ecd2e43f2f75a181f4aa74739cb6a43aff78fa1f1d6c64f2b9832df314a07
|
|
@@ -13,7 +13,7 @@ module OnlinePayments
|
|
|
13
13
|
class MetadataProvider
|
|
14
14
|
private
|
|
15
15
|
|
|
16
|
-
SDK_VERSION = '8.
|
|
16
|
+
SDK_VERSION = '8.4.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
|
|
@@ -45,38 +45,38 @@ module OnlinePayments
|
|
|
45
45
|
|
|
46
46
|
def self.create_exception_from_response_fields(status_code, response_body, error_id, errors, context)
|
|
47
47
|
case status_code
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
else
|
|
61
|
-
return ReferenceException.new(status_code, response_body, error_id, errors)
|
|
62
|
-
end
|
|
63
|
-
when 410
|
|
64
|
-
return ReferenceException.new(status_code, response_body, error_id, errors)
|
|
65
|
-
when 500
|
|
66
|
-
return PlatformException.new(status_code, response_body, error_id, errors)
|
|
67
|
-
when 502
|
|
68
|
-
return PlatformException.new(status_code, response_body, error_id, errors)
|
|
69
|
-
when 503
|
|
70
|
-
return PlatformException.new(status_code, response_body, error_id, errors)
|
|
48
|
+
when 400
|
|
49
|
+
return ValidationException.new(status_code, response_body, error_id, errors)
|
|
50
|
+
when 403
|
|
51
|
+
return AuthorizationException.new(status_code, response_body, error_id, errors)
|
|
52
|
+
when 404
|
|
53
|
+
return ReferenceException.new(status_code, response_body, error_id, errors)
|
|
54
|
+
when 409
|
|
55
|
+
if is_idempotence_error(errors, context)
|
|
56
|
+
idempotence_key = context.idempotence_key
|
|
57
|
+
idempotence_request_timestamp = context.idempotence_request_timestamp
|
|
58
|
+
return IdempotenceException.new(status_code, response_body, error_id, errors,
|
|
59
|
+
idempotence_key, idempotence_request_timestamp)
|
|
71
60
|
else
|
|
72
|
-
return
|
|
61
|
+
return ReferenceException.new(status_code, response_body, error_id, errors)
|
|
62
|
+
end
|
|
63
|
+
when 410
|
|
64
|
+
return ReferenceException.new(status_code, response_body, error_id, errors)
|
|
65
|
+
when 500
|
|
66
|
+
return PlatformException.new(status_code, response_body, error_id, errors)
|
|
67
|
+
when 502
|
|
68
|
+
return PlatformException.new(status_code, response_body, error_id, errors)
|
|
69
|
+
when 503
|
|
70
|
+
return PlatformException.new(status_code, response_body, error_id, errors)
|
|
71
|
+
else
|
|
72
|
+
return ApiException.new(status_code, response_body, error_id, errors)
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
def self.is_idempotence_error(errors, context)
|
|
77
77
|
!context&.idempotence_key.nil? &&
|
|
78
78
|
errors&.length == 1 &&
|
|
79
|
-
|
|
79
|
+
errors[0]&.error_code == '1409'
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
end
|
|
@@ -20,12 +20,12 @@ module OnlinePayments
|
|
|
20
20
|
# Constructs and returns a log message based on the request data. The log message is a string.
|
|
21
21
|
def get_message
|
|
22
22
|
msg_template_without_body = "Outgoing request (requestId='%s'):\n" +
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
" method: '%s'\n" +
|
|
24
|
+
" uri: '%s'\n" +
|
|
25
|
+
" headers: '%s'"
|
|
26
26
|
msg_template_with_body = msg_template_without_body + "\n" +
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
" content-type: '%s'\n" +
|
|
28
|
+
" body: '%s'"
|
|
29
29
|
|
|
30
30
|
return sprintf(msg_template_without_body, @request_id, empty_if_null(@method),
|
|
31
31
|
format_uri, @headers) if @body.nil?
|
|
@@ -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.4.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}
|