adyen-ruby-api-library 4.0.1 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/CODEOWNERS +1 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +7 -0
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +20 -0
- data/.gitignore +4 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/Gemfile +2 -2
- data/README.md +72 -109
- data/docs/checkout.html +17 -0
- data/docs/marketpay.html +2 -0
- data/lib/adyen/client.rb +57 -24
- data/lib/adyen/errors.rb +44 -2
- data/lib/adyen/services/bin_lookup.rb +18 -0
- data/lib/adyen/services/checkout.rb +90 -8
- data/lib/adyen/services/{checkout_utility.rb → data_protection.rb} +4 -3
- data/lib/adyen/services/dispute.rb +20 -0
- data/lib/adyen/services/marketpay.rb +27 -6
- data/lib/adyen/services/payments.rb +15 -5
- data/lib/adyen/services/payouts.rb +3 -2
- data/lib/adyen/services/postfmapi.rb +19 -0
- data/lib/adyen/services/recurring.rb +3 -2
- data/lib/adyen/services/service.rb +2 -2
- data/lib/adyen/version.rb +1 -1
- data/lib/adyen-ruby-api-library.rb +4 -12
- data/renovate.json +5 -0
- data/spec/account_spec.rb +4 -1
- data/spec/bin_lookup_spec.rb +15 -0
- data/spec/checkout_spec.rb +275 -4
- data/spec/data_protection_spec.rb +14 -0
- data/spec/dispute_spec.rb +17 -0
- data/spec/errors_spec.rb +33 -3
- data/spec/fund_spec.rb +2 -1
- data/spec/hop_spec.rb +14 -0
- data/spec/mocks/requests/Account/check_account_holder.json +5 -0
- data/spec/mocks/requests/Account/delete_payout_methods.json +6 -0
- data/spec/mocks/requests/Account/delete_signatories.json +6 -0
- data/spec/mocks/requests/BinLookup/get_3ds_availability.json +4 -0
- data/spec/mocks/requests/BinLookup/get_cost_estimate.json +8 -0
- data/spec/mocks/requests/Checkout/orders.json +6 -0
- data/spec/mocks/requests/Checkout/orders_cancel.json +7 -0
- data/spec/mocks/requests/Checkout/origin_keys.json +3 -0
- data/spec/mocks/requests/Checkout/payment_links.json +9 -0
- data/spec/mocks/requests/Checkout/payment_methods_balance.json +9 -0
- data/spec/mocks/requests/Checkout/sessions.json +10 -0
- data/spec/mocks/requests/DataProtectionService/request_subject_erasure.json +5 -0
- data/spec/mocks/requests/DisputeService/defend_dispute.json +5 -0
- data/spec/mocks/requests/DisputeService/delete_dispute_defense_document.json +5 -0
- data/spec/mocks/requests/DisputeService/retrieve_applicable_defense_reasons.json +4 -0
- data/spec/mocks/requests/DisputeService/supply_defense_document.json +11 -0
- data/spec/mocks/requests/Fund/refund_funds_transfer.json +7 -0
- data/spec/mocks/requests/Hop/get_onboarding_url.json +4 -0
- data/spec/mocks/requests/Payment/donate.json +10 -0
- data/spec/mocks/requests/Payment/get_authentication_result.json +4 -0
- data/spec/mocks/requests/Payment/retrieve_3ds2_result.json +4 -0
- data/spec/mocks/requests/Payment/technical_cancel.json +4 -0
- data/spec/mocks/requests/Payment/void_pending_refund.json +4 -0
- data/spec/mocks/requests/Payout/payout.json +8 -0
- data/spec/mocks/requests/Recurring/schedule_account_updater.json +12 -0
- data/spec/mocks/requests/Terminal/assign_terminals.json +6 -0
- data/spec/mocks/requests/Terminal/find_terminal.json +3 -0
- data/spec/mocks/requests/Terminal/get_terminals_under_account.json +4 -0
- data/spec/mocks/responses/Account/check_account_holder.json +3 -0
- data/spec/mocks/responses/Account/delete_payout_methods.json +3 -0
- data/spec/mocks/responses/Account/delete_signatories.json +3 -0
- data/spec/mocks/responses/BinLookup/get_3ds_availability.json +8 -0
- data/spec/mocks/responses/BinLookup/get_cost_estimate.json +8 -0
- data/spec/mocks/responses/Checkout/get-payment-link.json +11 -0
- data/spec/mocks/responses/Checkout/orders.json +8 -0
- data/spec/mocks/responses/Checkout/orders_cancel.json +4 -0
- data/spec/mocks/responses/Checkout/origin_keys.json +5 -0
- data/spec/mocks/responses/Checkout/payment_links.json +9 -0
- data/spec/mocks/responses/Checkout/payment_methods_balance.json +3 -0
- data/spec/mocks/responses/Checkout/sessions-success.json +11 -0
- data/spec/mocks/responses/Checkout/update-payment-link.json +11 -0
- data/spec/mocks/responses/DataProtectionService/request_subject_erasure.json +3 -0
- data/spec/mocks/responses/DisputeService/defend_dispute.json +5 -0
- data/spec/mocks/responses/DisputeService/delete_dispute_defense_document.json +5 -0
- data/spec/mocks/responses/DisputeService/retrieve_applicable_defense_reasons.json +28 -0
- data/spec/mocks/responses/DisputeService/supply_defense_document.json +5 -0
- data/spec/mocks/responses/Fund/refund_funds_transfer.json +5 -0
- data/spec/mocks/responses/Hop/get_onboarding_url.json +7 -0
- data/spec/mocks/responses/Payment/donate.json +4 -0
- data/spec/mocks/responses/Payment/get_authentication_result.json +5 -0
- data/spec/mocks/responses/Payment/retrieve_3ds2_result.json +5 -0
- data/spec/mocks/responses/Payment/technical_cancel.json +3 -0
- data/spec/mocks/responses/Payment/void_pending_refund.json +3 -0
- data/spec/mocks/responses/Payout/payout.json +3 -0
- data/spec/mocks/responses/Recurring/schedule_account_updater.json +4 -0
- data/spec/mocks/responses/Terminal/assign_terminals.json +5 -0
- data/spec/mocks/responses/Terminal/find_terminal.json +6 -0
- data/spec/mocks/responses/Terminal/get_terminals_under_account.json +11 -0
- data/spec/payments_spec.rb +6 -1
- data/spec/payouts_spec.rb +2 -1
- data/spec/postfmapi_spec.rb +16 -0
- data/spec/recurring_spec.rb +2 -1
- data/spec/service_spec.rb +4 -0
- data/spec/spec_helper.rb +18 -12
- metadata +78 -9
- data/.travis.yml +0 -14
- data/spec/checkout_utility_spec.rb +0 -29
- data/spec/mocks/requests/CheckoutUtility/origin_keys.json +0 -7
- data/spec/mocks/responses/CheckoutUtility/origin_keys.json +0 -7
data/lib/adyen/errors.rb
CHANGED
@@ -3,19 +3,61 @@ module Adyen
|
|
3
3
|
attr_reader :code, :response, :request, :msg
|
4
4
|
|
5
5
|
def initialize(request = nil, response = nil, msg = nil, code = nil)
|
6
|
+
mask_fields(request)
|
7
|
+
|
8
|
+
# components of formatted error message
|
6
9
|
attributes = {
|
7
10
|
code: code,
|
11
|
+
msg: msg,
|
8
12
|
request: request,
|
9
|
-
response: response
|
10
|
-
msg: msg
|
13
|
+
response: response
|
11
14
|
}.select { |_k, v| v }.map { |k, v| "#{k}:#{v}" }.join(', ')
|
12
15
|
message = "#{self.class.name} #{attributes}"
|
13
16
|
super(message)
|
17
|
+
|
18
|
+
# internal variables
|
14
19
|
@code = code
|
15
20
|
@response = response
|
16
21
|
@request = request
|
17
22
|
@msg = msg
|
18
23
|
end
|
24
|
+
|
25
|
+
# mask PCI data in request
|
26
|
+
def mask_fields(request)
|
27
|
+
return if request.nil?
|
28
|
+
|
29
|
+
# sensitive fields
|
30
|
+
fields_to_mask = [
|
31
|
+
:expiryMonth,
|
32
|
+
:expiryYear,
|
33
|
+
:encryptedCardNumber,
|
34
|
+
:encryptedExpiryMonth,
|
35
|
+
:encryptedExpiryYear,
|
36
|
+
:encryptedSecurityCode
|
37
|
+
]
|
38
|
+
|
39
|
+
# convert to hash if necessary
|
40
|
+
request = request.is_a?(Hash) ? request : JSON.parse(request)
|
41
|
+
|
42
|
+
# iterate through request to find fields to mask
|
43
|
+
request.each do |k, v|
|
44
|
+
if request[k].is_a?(Hash)
|
45
|
+
# recursively traverse multi-level hashes
|
46
|
+
mask_fields(request[k])
|
47
|
+
else
|
48
|
+
if k == :number
|
49
|
+
# show first 6 and last 4 for cards
|
50
|
+
request[k] = "#{v[0,6]}******#{v[12,16]}"
|
51
|
+
elsif k == :cvc
|
52
|
+
# show length of cvc for debugging
|
53
|
+
request[k] = "*" * v.length
|
54
|
+
elsif fields_to_mask.include? k
|
55
|
+
# generic mask for other fields
|
56
|
+
request[k] = "***"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
19
61
|
end
|
20
62
|
|
21
63
|
class AuthenticationError < AdyenError
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'service'
|
2
|
+
|
3
|
+
module Adyen
|
4
|
+
class BinLookup < Service
|
5
|
+
attr_accessor :version
|
6
|
+
DEFAULT_VERSION = 50
|
7
|
+
|
8
|
+
def initialize(client, version = DEFAULT_VERSION)
|
9
|
+
service = 'BinLookup'
|
10
|
+
method_names = [
|
11
|
+
:get_3ds_availability,
|
12
|
+
:get_cost_estimate
|
13
|
+
]
|
14
|
+
|
15
|
+
super(client, version, service, method_names)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,17 +1,22 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "service"
|
2
2
|
|
3
3
|
module Adyen
|
4
4
|
class Checkout < Service
|
5
|
-
DEFAULT_VERSION =
|
5
|
+
DEFAULT_VERSION = 68
|
6
6
|
|
7
7
|
def initialize(client, version = DEFAULT_VERSION)
|
8
|
-
service =
|
8
|
+
service = "Checkout"
|
9
9
|
method_names = [
|
10
|
-
:
|
11
|
-
:
|
10
|
+
:payment_session,
|
11
|
+
:origin_keys,
|
12
|
+
:sessions
|
12
13
|
]
|
13
14
|
|
14
|
-
|
15
|
+
with_application_info = [
|
16
|
+
:payment_session,
|
17
|
+
]
|
18
|
+
|
19
|
+
super(client, version, service, method_names, with_application_info)
|
15
20
|
end
|
16
21
|
|
17
22
|
# This method can't be dynamically defined because
|
@@ -24,7 +29,40 @@ module Adyen
|
|
24
29
|
when 0
|
25
30
|
Adyen::CheckoutDetail.new(@client, @version)
|
26
31
|
else
|
27
|
-
action =
|
32
|
+
action = "payments"
|
33
|
+
args[1] ||= {} # optional headers arg
|
34
|
+
@client.call_adyen_api(@service, action, args[0], args[1], @version, true)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def payment_links(*args)
|
39
|
+
case args.size
|
40
|
+
when 0
|
41
|
+
Adyen::CheckoutLink.new(@client, @version)
|
42
|
+
else
|
43
|
+
action = "paymentLinks"
|
44
|
+
args[1] ||= {} # optional headers arg
|
45
|
+
@client.call_adyen_api(@service, action, args[0], args[1], @version, true)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def payment_methods(*args)
|
50
|
+
case args.size
|
51
|
+
when 0
|
52
|
+
Adyen::CheckoutMethod.new(@client, @version)
|
53
|
+
else
|
54
|
+
action = "paymentMethods"
|
55
|
+
args[1] ||= {} # optional headers arg
|
56
|
+
@client.call_adyen_api(@service, action, args[0], args[1], @version)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def orders(*args)
|
61
|
+
case args.size
|
62
|
+
when 0
|
63
|
+
Adyen::CheckoutOrder.new(@client, @version)
|
64
|
+
else
|
65
|
+
action = "orders"
|
28
66
|
args[1] ||= {} # optional headers arg
|
29
67
|
@client.call_adyen_api(@service, action, args[0], args[1], @version)
|
30
68
|
end
|
@@ -33,7 +71,7 @@ module Adyen
|
|
33
71
|
|
34
72
|
class CheckoutDetail < Service
|
35
73
|
def initialize(client, version = DEFAULT_VERSION)
|
36
|
-
@service =
|
74
|
+
@service = "Checkout"
|
37
75
|
@client = client
|
38
76
|
@version = version
|
39
77
|
end
|
@@ -48,4 +86,48 @@ module Adyen
|
|
48
86
|
@client.call_adyen_api(@service, action, request, headers, @version)
|
49
87
|
end
|
50
88
|
end
|
89
|
+
|
90
|
+
class CheckoutLink < Service
|
91
|
+
def initialize(client, version = DEFAULT_VERSION)
|
92
|
+
@service = "Checkout"
|
93
|
+
@client = client
|
94
|
+
@version = version
|
95
|
+
end
|
96
|
+
|
97
|
+
def get(linkId, headers = {})
|
98
|
+
action = { method: 'get', url: "paymentLinks/" + linkId }
|
99
|
+
@client.call_adyen_api(@service, action, {}, headers, @version, true)
|
100
|
+
end
|
101
|
+
|
102
|
+
def update(linkId, request, headers = {})
|
103
|
+
action = { method: 'patch', url: "paymentLinks/" + linkId }
|
104
|
+
@client.call_adyen_api(@service, action, request, headers, @version, false)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class CheckoutMethod < Service
|
109
|
+
def initialize(client, version = DEFAULT_VERSION)
|
110
|
+
@service = "Checkout"
|
111
|
+
@client = client
|
112
|
+
@version = version
|
113
|
+
end
|
114
|
+
|
115
|
+
def balance(request, headers = {})
|
116
|
+
action = "paymentMethods/balance"
|
117
|
+
@client.call_adyen_api(@service, action, request, headers, @version, true)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
class CheckoutOrder < Service
|
122
|
+
def initialize(client, version = DEFAULT_VERSION)
|
123
|
+
@service = "Checkout"
|
124
|
+
@client = client
|
125
|
+
@version = version
|
126
|
+
end
|
127
|
+
|
128
|
+
def cancel(request, headers = {})
|
129
|
+
action = "orders/cancel"
|
130
|
+
@client.call_adyen_api(@service, action, request, headers, @version)
|
131
|
+
end
|
132
|
+
end
|
51
133
|
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
require_relative 'service'
|
2
2
|
|
3
3
|
module Adyen
|
4
|
-
class
|
4
|
+
class DataProtection < Service
|
5
|
+
attr_accessor :version
|
5
6
|
DEFAULT_VERSION = 1
|
6
7
|
|
7
8
|
def initialize(client, version = DEFAULT_VERSION)
|
8
|
-
service = '
|
9
|
+
service = 'DataProtectionService'
|
9
10
|
method_names = [
|
10
|
-
:
|
11
|
+
:request_subject_erasure
|
11
12
|
]
|
12
13
|
|
13
14
|
super(client, version, service, method_names)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'service'
|
2
|
+
|
3
|
+
module Adyen
|
4
|
+
class Dispute < Service
|
5
|
+
attr_accessor :version
|
6
|
+
DEFAULT_VERSION = 30
|
7
|
+
|
8
|
+
def initialize(client, version = DEFAULT_VERSION)
|
9
|
+
service = 'DisputeService'
|
10
|
+
method_names = [
|
11
|
+
:retrieve_applicable_defense_reasons,
|
12
|
+
:supply_defense_document,
|
13
|
+
:delete_dispute_defense_document,
|
14
|
+
:defend_dispute,
|
15
|
+
]
|
16
|
+
|
17
|
+
super(client, version, service, method_names)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -21,11 +21,15 @@ module Adyen
|
|
21
21
|
def notification
|
22
22
|
@notification ||= Adyen::Marketpay::Notification.new(@client)
|
23
23
|
end
|
24
|
+
|
25
|
+
def hop
|
26
|
+
@hop ||= Adyen::Marketpay::Hop.new(@client)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
|
26
30
|
class Account < Service
|
27
31
|
attr_accessor :version
|
28
|
-
DEFAULT_VERSION =
|
32
|
+
DEFAULT_VERSION = 6
|
29
33
|
|
30
34
|
def initialize(client, version = DEFAULT_VERSION)
|
31
35
|
service = 'Account'
|
@@ -40,11 +44,13 @@ module Adyen
|
|
40
44
|
:update_account_holder_state,
|
41
45
|
:delete_bank_accounts,
|
42
46
|
:delete_shareholders,
|
47
|
+
:delete_signatories,
|
43
48
|
:close_account,
|
44
49
|
:close_account_holder,
|
45
|
-
:get_tier_configuration,
|
46
50
|
:suspend_account_holder,
|
47
|
-
:un_suspend_account_holder
|
51
|
+
:un_suspend_account_holder,
|
52
|
+
:delete_payout_methods,
|
53
|
+
:check_account_holder
|
48
54
|
]
|
49
55
|
|
50
56
|
super(client, version, service, method_names)
|
@@ -53,7 +59,7 @@ module Adyen
|
|
53
59
|
|
54
60
|
class Fund < Service
|
55
61
|
attr_accessor :version
|
56
|
-
DEFAULT_VERSION =
|
62
|
+
DEFAULT_VERSION = 6
|
57
63
|
|
58
64
|
def initialize(client, version = DEFAULT_VERSION)
|
59
65
|
service = 'Fund'
|
@@ -63,7 +69,8 @@ module Adyen
|
|
63
69
|
:account_holder_transaction_list,
|
64
70
|
:refund_not_paid_out_transfers,
|
65
71
|
:setup_beneficiary,
|
66
|
-
:transfer_funds
|
72
|
+
:transfer_funds,
|
73
|
+
:refund_funds_transfer
|
67
74
|
]
|
68
75
|
|
69
76
|
super(client, version, service, method_names)
|
@@ -72,7 +79,7 @@ module Adyen
|
|
72
79
|
|
73
80
|
class Notification < Service
|
74
81
|
attr_accessor :version
|
75
|
-
DEFAULT_VERSION =
|
82
|
+
DEFAULT_VERSION = 6
|
76
83
|
|
77
84
|
def initialize(client, version = DEFAULT_VERSION)
|
78
85
|
service = 'Notification'
|
@@ -88,5 +95,19 @@ module Adyen
|
|
88
95
|
super(client, version, service, method_names)
|
89
96
|
end
|
90
97
|
end
|
98
|
+
|
99
|
+
class Hop < Service
|
100
|
+
attr_accessor :version
|
101
|
+
DEFAULT_VERSION = 6
|
102
|
+
|
103
|
+
def initialize(client, version = DEFAULT_VERSION)
|
104
|
+
service = 'Hop'
|
105
|
+
method_names = [
|
106
|
+
:get_onboarding_url
|
107
|
+
]
|
108
|
+
|
109
|
+
super(client, version, service, method_names)
|
110
|
+
end
|
111
|
+
end
|
91
112
|
end
|
92
113
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "service"
|
2
2
|
|
3
3
|
module Adyen
|
4
4
|
class Payments < Service
|
5
5
|
attr_accessor :version
|
6
|
-
DEFAULT_VERSION =
|
6
|
+
DEFAULT_VERSION = 64
|
7
7
|
|
8
8
|
def initialize(client, version = DEFAULT_VERSION)
|
9
|
-
service =
|
9
|
+
service = "Payment"
|
10
10
|
method_names = [
|
11
11
|
:authorise,
|
12
12
|
:authorise3d,
|
@@ -15,10 +15,20 @@ module Adyen
|
|
15
15
|
:cancel,
|
16
16
|
:refund,
|
17
17
|
:cancel_or_refund,
|
18
|
-
:adjust_authorisation
|
18
|
+
:adjust_authorisation,
|
19
|
+
:donate,
|
20
|
+
:get_authentication_result,
|
21
|
+
:technical_cancel,
|
22
|
+
:void_pending_refund,
|
23
|
+
:retrieve_3ds2_result
|
24
|
+
]
|
25
|
+
with_application_info = [
|
26
|
+
:authorise,
|
27
|
+
:authorise3d,
|
28
|
+
:authorise3ds2
|
19
29
|
]
|
20
30
|
|
21
|
-
super(client, version, service, method_names)
|
31
|
+
super(client, version, service, method_names, with_application_info)
|
22
32
|
end
|
23
33
|
end
|
24
34
|
end
|
@@ -3,7 +3,7 @@ require_relative 'service'
|
|
3
3
|
module Adyen
|
4
4
|
class Payouts < Service
|
5
5
|
attr_accessor :version
|
6
|
-
DEFAULT_VERSION =
|
6
|
+
DEFAULT_VERSION = 64
|
7
7
|
|
8
8
|
def initialize(client, version = DEFAULT_VERSION)
|
9
9
|
service = 'Payout'
|
@@ -12,7 +12,8 @@ module Adyen
|
|
12
12
|
:store_detail_and_submit_third_party,
|
13
13
|
:submit_third_party,
|
14
14
|
:confirm_third_party,
|
15
|
-
:decline_third_party
|
15
|
+
:decline_third_party,
|
16
|
+
:payout
|
16
17
|
]
|
17
18
|
|
18
19
|
super(client, version, service, method_names)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative 'service'
|
2
|
+
|
3
|
+
module Adyen
|
4
|
+
class PosTerminalManagement < Service
|
5
|
+
attr_accessor :version
|
6
|
+
DEFAULT_VERSION = 1
|
7
|
+
|
8
|
+
def initialize(client, version = DEFAULT_VERSION)
|
9
|
+
service = 'Terminal'
|
10
|
+
method_names = [
|
11
|
+
:assign_terminals,
|
12
|
+
:find_terminal,
|
13
|
+
:get_terminals_under_account
|
14
|
+
]
|
15
|
+
|
16
|
+
super(client, version, service, method_names)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -3,14 +3,15 @@ require_relative 'service'
|
|
3
3
|
module Adyen
|
4
4
|
class Recurring < Service
|
5
5
|
attr_accessor :version
|
6
|
-
DEFAULT_VERSION =
|
6
|
+
DEFAULT_VERSION = 49
|
7
7
|
|
8
8
|
def initialize(client, version = DEFAULT_VERSION)
|
9
9
|
service = 'Recurring'
|
10
10
|
method_names = [
|
11
11
|
:list_recurring_details,
|
12
12
|
:disable,
|
13
|
-
:store_token
|
13
|
+
:store_token,
|
14
|
+
:schedule_account_updater
|
14
15
|
]
|
15
16
|
|
16
17
|
super(client, version, service, method_names)
|
@@ -11,7 +11,7 @@ module Adyen
|
|
11
11
|
method_name.to_s.gsub(/_./) { |x| x[1].upcase }
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize(client, version, service, method_names)
|
14
|
+
def initialize(client, version, service, method_names, with_application_info = [])
|
15
15
|
@client = client
|
16
16
|
@version = version
|
17
17
|
@service = service
|
@@ -20,7 +20,7 @@ module Adyen
|
|
20
20
|
method_names.each do |method_name|
|
21
21
|
define_singleton_method method_name do |request, headers = {}|
|
22
22
|
action = self.class.action_for_method_name(method_name)
|
23
|
-
@client.call_adyen_api(@service, action, request, headers, @version)
|
23
|
+
@client.call_adyen_api(@service, action, request, headers, @version, with_application_info.include?(method_name))
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/adyen/version.rb
CHANGED
@@ -2,22 +2,14 @@ require_relative "adyen/version"
|
|
2
2
|
require_relative "adyen/client"
|
3
3
|
require_relative "adyen/errors"
|
4
4
|
require_relative "adyen/services/checkout"
|
5
|
-
require_relative "adyen/services/checkout_utility"
|
6
5
|
require_relative "adyen/services/payments"
|
7
6
|
require_relative "adyen/services/payouts"
|
8
7
|
require_relative "adyen/services/recurring"
|
9
8
|
require_relative "adyen/services/marketpay"
|
9
|
+
require_relative "adyen/services/postfmapi"
|
10
10
|
require_relative "adyen/services/service"
|
11
|
+
require_relative "adyen/services/data_protection"
|
12
|
+
require_relative "adyen/services/dispute"
|
13
|
+
require_relative "adyen/services/bin_lookup"
|
11
14
|
require_relative "adyen/hash_with_accessors"
|
12
15
|
require_relative "adyen/utils/hmac_validator"
|
13
|
-
|
14
|
-
# add snake case to camel case converter to String
|
15
|
-
# to convert rubinic method names to Adyen API methods
|
16
|
-
#
|
17
|
-
# i.e. snake_case -> snakeCase
|
18
|
-
# note that the first letter is not capitalized as normal
|
19
|
-
class String
|
20
|
-
def to_camel_case
|
21
|
-
split("_").collect.with_index{ |x, i| i > 0 ? x.capitalize : x }.join
|
22
|
-
end
|
23
|
-
end
|
data/spec/account_spec.rb
CHANGED
@@ -20,7 +20,10 @@ RSpec.describe Adyen::Payments, service: "marketpay account service" do
|
|
20
20
|
["upload_document", "pspReference", "9914762681460244"],
|
21
21
|
["get_uploaded_documents", "pspReference", "9914694369860322"],
|
22
22
|
["delete_bank_accounts", "pspReference", "9914694372670551"],
|
23
|
-
["delete_shareholders", "pspReference", "9914694372990637"]
|
23
|
+
["delete_shareholders", "pspReference", "9914694372990637"],
|
24
|
+
["delete_signatories", "pspReference", "9914694372990637"],
|
25
|
+
["delete_payout_methods", "pspReference", "9914694372990637"],
|
26
|
+
["check_account_holder", "pspReference", "9914694372990637"],
|
24
27
|
]
|
25
28
|
|
26
29
|
generate_tests(client, "Account", test_sets, client.marketpay.account)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Adyen::BinLookup, service: "BIN lookup service" do
|
4
|
+
# client instance to be used in dynamically generated tests
|
5
|
+
client = create_client(:basic)
|
6
|
+
|
7
|
+
# methods / values to test for
|
8
|
+
# format is defined in spec_helper
|
9
|
+
test_sets = [
|
10
|
+
["get_3ds_availability", "threeDS2supported", false],
|
11
|
+
["get_cost_estimate", "resultCode", "Success"]
|
12
|
+
]
|
13
|
+
|
14
|
+
generate_tests(client, "BinLookup", test_sets, client.bin_lookup)
|
15
|
+
end
|