adyen-ruby-api-library 7.0.2 → 7.0.3

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: dfc331f9e3975a74232200c6167ae29c56be90875e00de8ab2b369c32b8e52a2
4
- data.tar.gz: f21165fdab9fd26003fa1a9ebd540d4c18985160c14b0603a7e0c48e0b8ff048
3
+ metadata.gz: c3424394aa97925505130c2e86a526725f575d94bb5276bc2212377433430943
4
+ data.tar.gz: de79dd2ca8be5d5c239e9b3883b9972712cd03227133ab6b66cf8aa88add1f9c
5
5
  SHA512:
6
- metadata.gz: 30ca572d49863116b7b0054cee61e7c41aa73455232abedd23c2d83b6d14376d5b80b7f71978d06b6364e20f053d84131ad327e15d4b56e6bbd5a71dbec4a02c
7
- data.tar.gz: 8f57fe334a6f4b24894c88504d75ffeacc6f3f3df28b00c0ed511a80ce6c70002d469d1327ef6db297a519b72f94d6ce3cd32716a253cf37c18e09e9b129ad45
6
+ metadata.gz: 81fb04e71363771981693afda6387d2e00cd22207444282be51de1f4913d0a7477429acd8b2502bb2f5e440fdc4ece3fa40b95134e358e66eab319336f85489c
7
+ data.tar.gz: 8c76a644b6ccd599b892cb7df34b80c0d978ae91ff8f0a0b417ea496d775d69b9e07901edb7a7cb5f066c700ebf42f35161ed686e2128219a29a5e949e15c87c
data/Makefile CHANGED
@@ -5,8 +5,8 @@ openapi-generator-jar:=build/openapi-generator-cli.jar
5
5
  openapi-generator-cli:=java -jar build/openapi-generator-cli.jar
6
6
  output:=build/out
7
7
 
8
- services:=balancePlatform checkout legalEntityManagement management payment payout transfers
9
- singleFileServices:=balanceControlService binLookup dataProtection recurring storedValue posTerminalManagement
8
+ services:=balancePlatform checkout legalEntityManagement management payout transfers
9
+ singleFileServices:=balanceControlService binLookup dataProtection recurring storedValue payment posTerminalManagement
10
10
 
11
11
  binLookup: spec=BinLookupService-v54
12
12
  checkout: spec=CheckoutService-v70
@@ -43,6 +43,8 @@ $(services): build/spec $(openapi-generator-jar)
43
43
 
44
44
  $(singleFileServices): build/spec
45
45
  wget $(openapi-generator-url) -O build/openapi-generator-cli.jar
46
+ jq -e 'del(.paths[][].tags)' build/spec/json/$(spec).json > build/spec/json/$(spec).tmp
47
+ mv build/spec/json/$(spec).tmp build/spec/json/$(spec).json
46
48
  rm -rf $(output)
47
49
  $(openapi-generator-cli) generate \
48
50
  -i build/spec/json/$(spec).json \
@@ -1,23 +1,128 @@
1
- require_relative 'payment/general_api'
2
- require_relative 'payment/modifications_api'
3
-
1
+ require_relative './service'
4
2
  module Adyen
5
- class Payment
3
+ class Payment < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  DEFAULT_VERSION = 68
9
7
  def initialize(client, version = DEFAULT_VERSION)
10
- @service = 'Payment'
11
- @client = client
12
- @version = version
8
+ super(client, version, 'Payment')
9
+ end
10
+
11
+ def adjust_authorisation(request, headers: {})
12
+ endpoint = '/adjustAuthorisation'.gsub(/{.+?}/, '%s')
13
+ endpoint = endpoint.gsub(%r{^/}, '')
14
+ endpoint = format(endpoint)
15
+
16
+ action = { method: 'post', url: endpoint }
17
+ @client.call_adyen_api(@service, action, request, headers, @version)
18
+ end
19
+
20
+ def authorise(request, headers: {})
21
+ endpoint = '/authorise'.gsub(/{.+?}/, '%s')
22
+ endpoint = endpoint.gsub(%r{^/}, '')
23
+ endpoint = format(endpoint)
24
+
25
+ action = { method: 'post', url: endpoint }
26
+ @client.call_adyen_api(@service, action, request, headers, @version)
27
+ end
28
+
29
+ def authorise3d(request, headers: {})
30
+ endpoint = '/authorise3d'.gsub(/{.+?}/, '%s')
31
+ endpoint = endpoint.gsub(%r{^/}, '')
32
+ endpoint = format(endpoint)
33
+
34
+ action = { method: 'post', url: endpoint }
35
+ @client.call_adyen_api(@service, action, request, headers, @version)
36
+ end
37
+
38
+ def authorise3ds2(request, headers: {})
39
+ endpoint = '/authorise3ds2'.gsub(/{.+?}/, '%s')
40
+ endpoint = endpoint.gsub(%r{^/}, '')
41
+ endpoint = format(endpoint)
42
+
43
+ action = { method: 'post', url: endpoint }
44
+ @client.call_adyen_api(@service, action, request, headers, @version)
45
+ end
46
+
47
+ def cancel(request, headers: {})
48
+ endpoint = '/cancel'.gsub(/{.+?}/, '%s')
49
+ endpoint = endpoint.gsub(%r{^/}, '')
50
+ endpoint = format(endpoint)
51
+
52
+ action = { method: 'post', url: endpoint }
53
+ @client.call_adyen_api(@service, action, request, headers, @version)
54
+ end
55
+
56
+ def cancel_or_refund(request, headers: {})
57
+ endpoint = '/cancelOrRefund'.gsub(/{.+?}/, '%s')
58
+ endpoint = endpoint.gsub(%r{^/}, '')
59
+ endpoint = format(endpoint)
60
+
61
+ action = { method: 'post', url: endpoint }
62
+ @client.call_adyen_api(@service, action, request, headers, @version)
63
+ end
64
+
65
+ def capture(request, headers: {})
66
+ endpoint = '/capture'.gsub(/{.+?}/, '%s')
67
+ endpoint = endpoint.gsub(%r{^/}, '')
68
+ endpoint = format(endpoint)
69
+
70
+ action = { method: 'post', url: endpoint }
71
+ @client.call_adyen_api(@service, action, request, headers, @version)
72
+ end
73
+
74
+ def donate(request, headers: {})
75
+ endpoint = '/donate'.gsub(/{.+?}/, '%s')
76
+ endpoint = endpoint.gsub(%r{^/}, '')
77
+ endpoint = format(endpoint)
78
+
79
+ action = { method: 'post', url: endpoint }
80
+ @client.call_adyen_api(@service, action, request, headers, @version)
81
+ end
82
+
83
+ def get_authentication_result(request, headers: {})
84
+ endpoint = '/getAuthenticationResult'.gsub(/{.+?}/, '%s')
85
+ endpoint = endpoint.gsub(%r{^/}, '')
86
+ endpoint = format(endpoint)
87
+
88
+ action = { method: 'post', url: endpoint }
89
+ @client.call_adyen_api(@service, action, request, headers, @version)
90
+ end
91
+
92
+ def refund(request, headers: {})
93
+ endpoint = '/refund'.gsub(/{.+?}/, '%s')
94
+ endpoint = endpoint.gsub(%r{^/}, '')
95
+ endpoint = format(endpoint)
96
+
97
+ action = { method: 'post', url: endpoint }
98
+ @client.call_adyen_api(@service, action, request, headers, @version)
99
+ end
100
+
101
+ def retrieve3ds2_result(request, headers: {})
102
+ endpoint = '/retrieve3ds2Result'.gsub(/{.+?}/, '%s')
103
+ endpoint = endpoint.gsub(%r{^/}, '')
104
+ endpoint = format(endpoint)
105
+
106
+ action = { method: 'post', url: endpoint }
107
+ @client.call_adyen_api(@service, action, request, headers, @version)
13
108
  end
14
109
 
15
- def general_api
16
- @general_api ||= Adyen::GeneralApi.new(@client, @version)
110
+ def technical_cancel(request, headers: {})
111
+ endpoint = '/technicalCancel'.gsub(/{.+?}/, '%s')
112
+ endpoint = endpoint.gsub(%r{^/}, '')
113
+ endpoint = format(endpoint)
114
+
115
+ action = { method: 'post', url: endpoint }
116
+ @client.call_adyen_api(@service, action, request, headers, @version)
17
117
  end
18
118
 
19
- def modifications_api
20
- @modifications_api ||= Adyen::ModificationsApi.new(@client, @version)
119
+ def void_pending_refund(request, headers: {})
120
+ endpoint = '/voidPendingRefund'.gsub(/{.+?}/, '%s')
121
+ endpoint = endpoint.gsub(%r{^/}, '')
122
+ endpoint = format(endpoint)
123
+
124
+ action = { method: 'post', url: endpoint }
125
+ @client.call_adyen_api(@service, action, request, headers, @version)
21
126
  end
22
127
 
23
128
  end
@@ -8,6 +8,11 @@ module Adyen
8
8
  amount.value amount.currency eventCode success
9
9
  ].freeze
10
10
 
11
+ # <b>DEPRECATED:</b> Please use valid_webhook_hmac?() instead.
12
+ def valid_notification_hmac?(notification_request_item, hmac_key)
13
+ valid_webhook_hmac?(notification_request_item, hmac_key)
14
+ end
15
+
11
16
  def valid_webhook_hmac?(webhook_request_item, hmac_key)
12
17
  expected_sign = calculate_webhook_hmac(webhook_request_item, hmac_key)
13
18
  merchant_sign = fetch(webhook_request_item, 'additionalData.hmacSignature')
@@ -15,6 +20,12 @@ module Adyen
15
20
  expected_sign == merchant_sign
16
21
  end
17
22
 
23
+ # <b>DEPRECATED:</b> Please use calculate_webhook_hmac() instead.
24
+ def calculate_notification_hmac(notification_request_item, hmac_key)
25
+ calculate_webhook_hmac(notification_request_item, hmac_key)
26
+ end
27
+
28
+
18
29
  def calculate_webhook_hmac(webhook_request_item, hmac_key)
19
30
  data = data_to_sign(webhook_request_item)
20
31
 
data/lib/adyen/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Adyen
2
2
  NAME = 'adyen-ruby-api-library'.freeze
3
- VERSION = '7.0.2'.freeze
3
+ VERSION = '7.0.3'.freeze
4
4
  end
data/spec/client_spec.rb CHANGED
@@ -25,10 +25,10 @@ RSpec.describe Adyen do
25
25
  end
26
26
 
27
27
  it 'fails payments call without WS user and password' do
28
- expect { @shared_values[:client].payment.general_api.authorise('{}') }
28
+ expect { @shared_values[:client].payment.authorise('{}') }
29
29
  .to raise_error(Adyen::AuthenticationError)
30
30
  @shared_values[:client].ws_user = @shared_values[:ws_user]
31
- expect { @shared_values[:client].payment.general_api.authorise('{}') }
31
+ expect { @shared_values[:client].payment.authorise('{}') }
32
32
  .to raise_error(Adyen::AuthenticationError)
33
33
  end
34
34
 
@@ -28,7 +28,7 @@ RSpec.describe Adyen::Payment, service: 'Payment' do
28
28
  body: response_body
29
29
  )
30
30
 
31
- result = @shared_values[:client].payment.modifications_api.adjust_authorisation(request_body)
31
+ result = @shared_values[:client].payment.adjust_authorisation(request_body)
32
32
  response_hash = result.response
33
33
 
34
34
  expect(result.status)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adyen-ruby-api-library
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.2
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-15 00:00:00.000000000 Z
11
+ date: 2023-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -180,8 +180,6 @@ files:
180
180
  - lib/adyen/services/management/webhooks_merchant_level_api.rb
181
181
  - lib/adyen/services/marketpay.rb
182
182
  - lib/adyen/services/payment.rb
183
- - lib/adyen/services/payment/general_api.rb
184
- - lib/adyen/services/payment/modifications_api.rb
185
183
  - lib/adyen/services/payout.rb
186
184
  - lib/adyen/services/payout/initialization_api.rb
187
185
  - lib/adyen/services/payout/instant_payouts_api.rb
@@ -1,56 +0,0 @@
1
- require_relative '../service'
2
- module Adyen
3
- class GeneralApi < Service
4
- attr_accessor :service, :version
5
-
6
- def initialize(client, version = DEFAULT_VERSION)
7
- super(client, version, 'Payment')
8
- end
9
-
10
- def authorise(request, headers: {})
11
- endpoint = '/authorise'.gsub(/{.+?}/, '%s')
12
- endpoint = endpoint.gsub(%r{^/}, '')
13
- endpoint = format(endpoint)
14
-
15
- action = { method: 'post', url: endpoint }
16
- @client.call_adyen_api(@service, action, request, headers, @version)
17
- end
18
-
19
- def authorise3d(request, headers: {})
20
- endpoint = '/authorise3d'.gsub(/{.+?}/, '%s')
21
- endpoint = endpoint.gsub(%r{^/}, '')
22
- endpoint = format(endpoint)
23
-
24
- action = { method: 'post', url: endpoint }
25
- @client.call_adyen_api(@service, action, request, headers, @version)
26
- end
27
-
28
- def authorise3ds2(request, headers: {})
29
- endpoint = '/authorise3ds2'.gsub(/{.+?}/, '%s')
30
- endpoint = endpoint.gsub(%r{^/}, '')
31
- endpoint = format(endpoint)
32
-
33
- action = { method: 'post', url: endpoint }
34
- @client.call_adyen_api(@service, action, request, headers, @version)
35
- end
36
-
37
- def get_authentication_result(request, headers: {})
38
- endpoint = '/getAuthenticationResult'.gsub(/{.+?}/, '%s')
39
- endpoint = endpoint.gsub(%r{^/}, '')
40
- endpoint = format(endpoint)
41
-
42
- action = { method: 'post', url: endpoint }
43
- @client.call_adyen_api(@service, action, request, headers, @version)
44
- end
45
-
46
- def retrieve3ds2_result(request, headers: {})
47
- endpoint = '/retrieve3ds2Result'.gsub(/{.+?}/, '%s')
48
- endpoint = endpoint.gsub(%r{^/}, '')
49
- endpoint = format(endpoint)
50
-
51
- action = { method: 'post', url: endpoint }
52
- @client.call_adyen_api(@service, action, request, headers, @version)
53
- end
54
-
55
- end
56
- end
@@ -1,83 +0,0 @@
1
- require_relative '../service'
2
- module Adyen
3
- class ModificationsApi < Service
4
- attr_accessor :service, :version
5
-
6
- def initialize(client, version = DEFAULT_VERSION)
7
- super(client, version, 'Payment')
8
- end
9
-
10
- def adjust_authorisation(request, headers: {})
11
- endpoint = '/adjustAuthorisation'.gsub(/{.+?}/, '%s')
12
- endpoint = endpoint.gsub(%r{^/}, '')
13
- endpoint = format(endpoint)
14
-
15
- action = { method: 'post', url: endpoint }
16
- @client.call_adyen_api(@service, action, request, headers, @version)
17
- end
18
-
19
- def cancel(request, headers: {})
20
- endpoint = '/cancel'.gsub(/{.+?}/, '%s')
21
- endpoint = endpoint.gsub(%r{^/}, '')
22
- endpoint = format(endpoint)
23
-
24
- action = { method: 'post', url: endpoint }
25
- @client.call_adyen_api(@service, action, request, headers, @version)
26
- end
27
-
28
- def cancel_or_refund(request, headers: {})
29
- endpoint = '/cancelOrRefund'.gsub(/{.+?}/, '%s')
30
- endpoint = endpoint.gsub(%r{^/}, '')
31
- endpoint = format(endpoint)
32
-
33
- action = { method: 'post', url: endpoint }
34
- @client.call_adyen_api(@service, action, request, headers, @version)
35
- end
36
-
37
- def capture(request, headers: {})
38
- endpoint = '/capture'.gsub(/{.+?}/, '%s')
39
- endpoint = endpoint.gsub(%r{^/}, '')
40
- endpoint = format(endpoint)
41
-
42
- action = { method: 'post', url: endpoint }
43
- @client.call_adyen_api(@service, action, request, headers, @version)
44
- end
45
-
46
- def donate(request, headers: {})
47
- endpoint = '/donate'.gsub(/{.+?}/, '%s')
48
- endpoint = endpoint.gsub(%r{^/}, '')
49
- endpoint = format(endpoint)
50
-
51
- action = { method: 'post', url: endpoint }
52
- @client.call_adyen_api(@service, action, request, headers, @version)
53
- end
54
-
55
- def refund(request, headers: {})
56
- endpoint = '/refund'.gsub(/{.+?}/, '%s')
57
- endpoint = endpoint.gsub(%r{^/}, '')
58
- endpoint = format(endpoint)
59
-
60
- action = { method: 'post', url: endpoint }
61
- @client.call_adyen_api(@service, action, request, headers, @version)
62
- end
63
-
64
- def technical_cancel(request, headers: {})
65
- endpoint = '/technicalCancel'.gsub(/{.+?}/, '%s')
66
- endpoint = endpoint.gsub(%r{^/}, '')
67
- endpoint = format(endpoint)
68
-
69
- action = { method: 'post', url: endpoint }
70
- @client.call_adyen_api(@service, action, request, headers, @version)
71
- end
72
-
73
- def void_pending_refund(request, headers: {})
74
- endpoint = '/voidPendingRefund'.gsub(/{.+?}/, '%s')
75
- endpoint = endpoint.gsub(%r{^/}, '')
76
- endpoint = format(endpoint)
77
-
78
- action = { method: 'post', url: endpoint }
79
- @client.call_adyen_api(@service, action, request, headers, @version)
80
- end
81
-
82
- end
83
- end