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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ccabc322a19d78c7084553911d1c6df7c554f16316856ab61f2549fe96b5cff
4
- data.tar.gz: c3b3990140d012901bed22f25b06713fc251d99e165314122978cd766eae369b
3
+ metadata.gz: 214a7d33b7e66eba1729b2f5c9d783aa651d58b9433b70b73e7ee12be787171f
4
+ data.tar.gz: 3443cef8b63ba39f4ef8045867284e1daef75895cf216da7966ebcadebbf0ab9
5
5
  SHA512:
6
- metadata.gz: ca82d1a77fe0dd53f69fb72a2d542a73fbd8711a065ba5a053f6c4642a80c4dbdfb7def3fbb693a4f412052c60eeda2fe5ae2e3974f49b6e300a2e66d4f36522
7
- data.tar.gz: 32c2486c2a684adecd63b0d8c60188dc1107ac3c4ead2bf29ee2b9480f028ce1c10cc31dc4dff82058cb4ad8a780c665ee698d442d18d7e299638f49215d632a
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.3.0'.freeze
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
- 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)
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 ApiException.new(status_code, response_body, error_id, errors)
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
- errors[0]&.error_code == '1409'
79
+ errors[0]&.error_code == '1409'
80
80
  end
81
81
  end
82
82
  end
@@ -24,6 +24,8 @@ module OnlinePayments
24
24
  else
25
25
  raise NotImplementedError
26
26
  end
27
+ rescue ::JSON::ParserError => e
28
+ raise MarshallerSyntaxException, e.message
27
29
  end
28
30
  end
29
31
  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
- " method: '%s'\n" +
24
- " uri: '%s'\n" +
25
- " headers: '%s'"
23
+ " method: '%s'\n" +
24
+ " uri: '%s'\n" +
25
+ " headers: '%s'"
26
26
  msg_template_with_body = msg_template_without_body + "\n" +
27
- " content-type: '%s'\n" +
28
- " body: '%s'"
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.0'
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}
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.3.0
4
+ version: 8.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Worldline Direct support team