Skip to content

Commit 22b68b9

Browse files
Merge pull request #165 from Adyen/automation/release
Release v7.0.3
2 parents bbe5be6 + 55e2bc3 commit 22b68b9

File tree

8 files changed

+135
-156
lines changed

8 files changed

+135
-156
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ openapi-generator-jar:=build/openapi-generator-cli.jar
55
openapi-generator-cli:=java -jar build/openapi-generator-cli.jar
66
output:=build/out
77

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
1010

1111
binLookup: spec=BinLookupService-v54
1212
checkout: spec=CheckoutService-v70
@@ -43,6 +43,8 @@ $(services): build/spec $(openapi-generator-jar)
4343

4444
$(singleFileServices): build/spec
4545
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
4648
rm -rf $(output)
4749
$(openapi-generator-cli) generate \
4850
-i build/spec/json/$(spec).json \

lib/adyen/services/payment.rb

Lines changed: 116 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,128 @@
1-
require_relative 'payment/general_api'
2-
require_relative 'payment/modifications_api'
3-
1+
require_relative './service'
42
module Adyen
5-
class Payment
3+
class Payment < Service
64
attr_accessor :service, :version
75

86
DEFAULT_VERSION = 68
97
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)
13108
end
14109

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)
17117
end
18118

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)
21126
end
22127

23128
end

lib/adyen/services/payment/general_api.rb

Lines changed: 0 additions & 56 deletions
This file was deleted.

lib/adyen/services/payment/modifications_api.rb

Lines changed: 0 additions & 83 deletions
This file was deleted.

lib/adyen/utils/hmac_validator.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,24 @@ class HmacValidator
88
amount.value amount.currency eventCode success
99
].freeze
1010

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+
1116
def valid_webhook_hmac?(webhook_request_item, hmac_key)
1217
expected_sign = calculate_webhook_hmac(webhook_request_item, hmac_key)
1318
merchant_sign = fetch(webhook_request_item, 'additionalData.hmacSignature')
1419

1520
expected_sign == merchant_sign
1621
end
1722

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+
1829
def calculate_webhook_hmac(webhook_request_item, hmac_key)
1930
data = data_to_sign(webhook_request_item)
2031

lib/adyen/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module Adyen
22
NAME = 'adyen-ruby-api-library'.freeze
3-
VERSION = '7.0.2'.freeze
3+
VERSION = '7.0.3'.freeze
44
end

spec/client_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
end
2626

2727
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('{}') }
2929
.to raise_error(Adyen::AuthenticationError)
3030
@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('{}') }
3232
.to raise_error(Adyen::AuthenticationError)
3333
end
3434

spec/payments_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
body: response_body
2929
)
3030

31-
result = @shared_values[:client].payment.modifications_api.adjust_authorisation(request_body)
31+
result = @shared_values[:client].payment.adjust_authorisation(request_body)
3232
response_hash = result.response
3333

3434
expect(result.status)

0 commit comments

Comments
 (0)