adyen-ruby-api-library 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.travis.yml +14 -0
  4. data/Gemfile +12 -0
  5. data/LICENSE +21 -0
  6. data/README.md +140 -0
  7. data/Rakefile +6 -0
  8. data/adyen-ruby-api-library.gemspec +28 -0
  9. data/bin/console +13 -0
  10. data/bin/setup +8 -0
  11. data/docs/checkout.html +111 -0
  12. data/docs/index.html +50 -0
  13. data/docs/install-library.html +61 -0
  14. data/docs/javascripts/prism.js +5 -0
  15. data/docs/javascripts/scale.fix.js +17 -0
  16. data/docs/marketpay.html +169 -0
  17. data/docs/params.json +1 -0
  18. data/docs/payment.html +106 -0
  19. data/docs/payout.html +135 -0
  20. data/docs/recurring.html +113 -0
  21. data/docs/stylesheets/github-light.css +115 -0
  22. data/docs/stylesheets/prism.css +140 -0
  23. data/docs/stylesheets/styles.css +324 -0
  24. data/docs/using-library.html +67 -0
  25. data/lib/adyen-ruby-api-library.rb +21 -0
  26. data/lib/adyen/client.rb +174 -0
  27. data/lib/adyen/errors.rb +76 -0
  28. data/lib/adyen/services/checkout.rb +50 -0
  29. data/lib/adyen/services/checkout_utility.rb +16 -0
  30. data/lib/adyen/services/marketpay.rb +92 -0
  31. data/lib/adyen/services/payments.rb +23 -0
  32. data/lib/adyen/services/payouts.rb +21 -0
  33. data/lib/adyen/services/recurring.rb +19 -0
  34. data/lib/adyen/services/service.rb +19 -0
  35. data/lib/adyen/version.rb +4 -0
  36. data/spec/account_spec.rb +27 -0
  37. data/spec/checkout_spec.rb +94 -0
  38. data/spec/checkout_utility_spec.rb +27 -0
  39. data/spec/client_spec.rb +40 -0
  40. data/spec/fund_spec.rb +19 -0
  41. data/spec/mocks/requests/Account/close_account.json +3 -0
  42. data/spec/mocks/requests/Account/close_account_holder.json +3 -0
  43. data/spec/mocks/requests/Account/create_account.json +3 -0
  44. data/spec/mocks/requests/Account/create_account_holder.json +15 -0
  45. data/spec/mocks/requests/Account/delete_bank_accounts.json +6 -0
  46. data/spec/mocks/requests/Account/delete_shareholders.json +6 -0
  47. data/spec/mocks/requests/Account/get_account_holder.json +3 -0
  48. data/spec/mocks/requests/Account/get_uploaded_documents.json +4 -0
  49. data/spec/mocks/requests/Account/suspend_account_holder.json +3 -0
  50. data/spec/mocks/requests/Account/un_suspend_account_holder.json +3 -0
  51. data/spec/mocks/requests/Account/update_account.json +7 -0
  52. data/spec/mocks/requests/Account/update_account_holder.json +33 -0
  53. data/spec/mocks/requests/Account/update_account_holder_state.json +6 -0
  54. data/spec/mocks/requests/Account/upload_document.json +9 -0
  55. data/spec/mocks/requests/Checkout/payment-details.json +18 -0
  56. data/spec/mocks/requests/Checkout/payment-result.json +3 -0
  57. data/spec/mocks/requests/Checkout/payment_methods.json +3 -0
  58. data/spec/mocks/requests/Checkout/payment_session.json +15 -0
  59. data/spec/mocks/requests/Checkout/payments.json +17 -0
  60. data/spec/mocks/requests/Checkout/verify.json +3 -0
  61. data/spec/mocks/requests/CheckoutUtility/origin_keys.json +7 -0
  62. data/spec/mocks/requests/Fund/account_holder_balance.json +3 -0
  63. data/spec/mocks/requests/Fund/account_holder_transaction_list.json +16 -0
  64. data/spec/mocks/requests/Fund/payout_account_holder.json +10 -0
  65. data/spec/mocks/requests/Fund/refund_not_paid_out_transfers.json +4 -0
  66. data/spec/mocks/requests/Fund/setup_beneficiary.json +5 -0
  67. data/spec/mocks/requests/Fund/transfer_funds.json +9 -0
  68. data/spec/mocks/requests/Notification/create_notification_configuration.json +20 -0
  69. data/spec/mocks/requests/Notification/delete_notification_configurations.json +6 -0
  70. data/spec/mocks/requests/Notification/get_notification_configuration.json +3 -0
  71. data/spec/mocks/requests/Notification/get_notification_configuration_list.json +1 -0
  72. data/spec/mocks/requests/Notification/test_notification_configuration.json +4 -0
  73. data/spec/mocks/requests/Notification/update_notification_configuration.json +26 -0
  74. data/spec/mocks/requests/Payment/adjust_authorisation.json +12 -0
  75. data/spec/mocks/requests/Payment/authorise.json +28 -0
  76. data/spec/mocks/requests/Payment/authorise3d.json +6 -0
  77. data/spec/mocks/requests/Payment/cancel.json +4 -0
  78. data/spec/mocks/requests/Payment/cancel_or_refund.json +4 -0
  79. data/spec/mocks/requests/Payment/capture.json +8 -0
  80. data/spec/mocks/requests/Payment/refund.json +8 -0
  81. data/spec/mocks/requests/Payout/confirm_third_party.json +4 -0
  82. data/spec/mocks/requests/Payout/decline_third_party.json +4 -0
  83. data/spec/mocks/requests/Payout/store_detail.json +33 -0
  84. data/spec/mocks/requests/Payout/store_detail_and_submit_third_party.json +33 -0
  85. data/spec/mocks/requests/Payout/submit_third_party.json +22 -0
  86. data/spec/mocks/requests/Recurring/disable.json +5 -0
  87. data/spec/mocks/requests/Recurring/list_recurring_details.json +4 -0
  88. data/spec/mocks/requests/Recurring/store_token.json +15 -0
  89. data/spec/mocks/responses/Account/close_account.json +5 -0
  90. data/spec/mocks/responses/Account/close_account_holder.json +7 -0
  91. data/spec/mocks/responses/Account/create_account.json +7 -0
  92. data/spec/mocks/responses/Account/create_account_holder.json +116 -0
  93. data/spec/mocks/responses/Account/delete_bank_accounts.json +4 -0
  94. data/spec/mocks/responses/Account/delete_shareholders.json +4 -0
  95. data/spec/mocks/responses/Account/get_account_holder.json +71 -0
  96. data/spec/mocks/responses/Account/get_uploaded_documents.json +16 -0
  97. data/spec/mocks/responses/Account/suspend_account_holder.json +24 -0
  98. data/spec/mocks/responses/Account/un_suspend_account_holder.json +24 -0
  99. data/spec/mocks/responses/Account/update_account.json +9 -0
  100. data/spec/mocks/responses/Account/update_account_holder.json +95 -0
  101. data/spec/mocks/responses/Account/update_account_holder_state.json +27 -0
  102. data/spec/mocks/responses/Account/upload_document.json +77 -0
  103. data/spec/mocks/responses/Checkout/payment-details.json +14 -0
  104. data/spec/mocks/responses/Checkout/payment-result.json +4 -0
  105. data/spec/mocks/responses/Checkout/payment_methods.json +66 -0
  106. data/spec/mocks/responses/Checkout/payment_session.json +572 -0
  107. data/spec/mocks/responses/Checkout/payments.json +95 -0
  108. data/spec/mocks/responses/Checkout/verify.json +121 -0
  109. data/spec/mocks/responses/CheckoutUtility/origin_keys.json +7 -0
  110. data/spec/mocks/responses/Fund/account_holder_balance.json +47 -0
  111. data/spec/mocks/responses/Fund/account_holder_transaction_list.json +73 -0
  112. data/spec/mocks/responses/Fund/payout_account_holder.json +6 -0
  113. data/spec/mocks/responses/Fund/refund_not_paid_out_transfers.json +5 -0
  114. data/spec/mocks/responses/Fund/setup_beneficiary.json +5 -0
  115. data/spec/mocks/responses/Fund/transfer_funds.json +6 -0
  116. data/spec/mocks/responses/Notification/create_notification_configuration.json +41 -0
  117. data/spec/mocks/responses/Notification/delete_notification_configurations.json +23 -0
  118. data/spec/mocks/responses/Notification/get_notification_configuration.json +41 -0
  119. data/spec/mocks/responses/Notification/get_notification_configuration_list.json +65 -0
  120. data/spec/mocks/responses/Notification/test_notification_configuration.json +49 -0
  121. data/spec/mocks/responses/Notification/update_notification_configuration.json +47 -0
  122. data/spec/mocks/responses/Payment/adjust_authorisation.json +4 -0
  123. data/spec/mocks/responses/Payment/authorise.json +95 -0
  124. data/spec/mocks/responses/Payment/authorise3d.json +30 -0
  125. data/spec/mocks/responses/Payment/cancel.json +4 -0
  126. data/spec/mocks/responses/Payment/cancel_or_refund.json +4 -0
  127. data/spec/mocks/responses/Payment/capture.json +4 -0
  128. data/spec/mocks/responses/Payment/refund.json +4 -0
  129. data/spec/mocks/responses/Payout/confirm_third_party.json +4 -0
  130. data/spec/mocks/responses/Payout/decline_third_party.json +4 -0
  131. data/spec/mocks/responses/Payout/store_detail.json +5 -0
  132. data/spec/mocks/responses/Payout/store_detail_and_submit_third_party.json +8 -0
  133. data/spec/mocks/responses/Payout/submit_third_party.json +8 -0
  134. data/spec/mocks/responses/Recurring/disable.json +30 -0
  135. data/spec/mocks/responses/Recurring/list_recurring_details.json +62 -0
  136. data/spec/mocks/responses/Recurring/store_token.json +7 -0
  137. data/spec/notification_spec.rb +19 -0
  138. data/spec/payments_spec.rb +20 -0
  139. data/spec/payouts_spec.rb +18 -0
  140. data/spec/recurring_spec.rb +17 -0
  141. data/spec/spec_helper.rb +94 -0
  142. metadata +246 -0
@@ -0,0 +1,67 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
6
+ <title>Adyen-ruby-api-library by Adyen</title>
7
+
8
+ <link rel="stylesheet" href="stylesheets/styles.css">
9
+ <link rel="stylesheet" href="stylesheets/github-light.css">
10
+ <meta name="viewport" content="width=device-width">
11
+
12
+ <link rel="stylesheet" href="stylesheets/prism.css">
13
+ <script src="javascripts/prism.js"></script>
14
+ <!--[if lt IE 9]>
15
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
16
+ <![endif]-->
17
+ </head>
18
+ <body>
19
+ <div class="wrapper">
20
+ <header>
21
+ <h1>Adyen-ruby-api-library</h1>
22
+ <p>Adyen API Library for Ruby</p>
23
+
24
+ <p class="view"><a href="https://github.com/Adyen/adyen-ruby-api-library">View the Project on GitHub <small>Adyen/adyen-ruby-api-library</small></a></p>
25
+
26
+
27
+ <ul>
28
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/master">Download <strong>ZIP File</strong></a></li>
29
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/master">Download <strong>TAR Ball</strong></a></li>
30
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library">View On <strong>GitHub</strong></a></li>
31
+ </ul>
32
+ </header>
33
+ <section>
34
+ <h2>Using the library</h2>
35
+ <p>
36
+ Set up a client and set the credentials to the Adyen platform.
37
+ </p>
38
+
39
+ <pre><code class="ruby language-ruby">require 'adyen'
40
+
41
+ adyen = Adyen::Client.new</code></pre>
42
+
43
+ <p>
44
+ The example connects you to the Adyen test platform. If you want to use our live platform use:
45
+ <pre><code class="ruby">adyen.env = :live</code></pre>
46
+ </p>
47
+
48
+ <p>You can now use the following services:
49
+ <ul>
50
+ <li><a title="Checkout" href="checkout.html">Checkout</a></li>
51
+ <li><a title="Payment" href="payment.html">Payments</a></li>
52
+ <li><a title="Recurring" href="recurring.html">Recurring</a></li>
53
+ <li><a title="Payout" href="payout.html">Payouts</a></li>
54
+ <li><a title="Marketpay" href="marketpay.html">Marketpay</a></li>
55
+ </ul>
56
+ </p>
57
+
58
+ </section>
59
+ <footer>
60
+ <p>This project is maintained by <a href="https://github.com/Adyen">Adyen</a></p>
61
+ <p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
62
+ </footer>
63
+ </div>
64
+ <script src="javascripts/scale.fix.js"></script>
65
+
66
+ </body>
67
+ </html>
@@ -0,0 +1,21 @@
1
+ require_relative "adyen/version"
2
+ require_relative "adyen/client"
3
+ require_relative "adyen/errors"
4
+ require_relative "adyen/services/checkout"
5
+ require_relative "adyen/services/checkout_utility"
6
+ require_relative "adyen/services/payments"
7
+ require_relative "adyen/services/payouts"
8
+ require_relative "adyen/services/recurring"
9
+ require_relative "adyen/services/marketpay"
10
+ require_relative "adyen/services/service"
11
+
12
+ # add snake case to camel case converter to String
13
+ # to convert rubinic method names to Adyen API methods
14
+ #
15
+ # i.e. snake_case -> snakeCase
16
+ # note that the first letter is not capitalized as normal
17
+ class String
18
+ def to_camel_case
19
+ split("_").collect.with_index{ |x, i| i > 0 ? x.capitalize : x }.join
20
+ end
21
+ end
@@ -0,0 +1,174 @@
1
+ require "faraday"
2
+ require "json"
3
+ require_relative "./errors"
4
+
5
+ module Adyen
6
+ class Client
7
+ attr_accessor :ws_user, :ws_password, :api_key, :client, :adapter, :live_url_prefix
8
+ attr_reader :env
9
+
10
+ def initialize(ws_user: nil, ws_password: nil, api_key: nil, env: :live, adapter: nil, mock_port: 3001, live_url_prefix: nil)
11
+ @ws_user = ws_user
12
+ @ws_password = ws_password
13
+ @api_key = api_key
14
+ @env = env
15
+ @adapter = adapter || Faraday.default_adapter
16
+ @mock_port = mock_port
17
+ @live_url_prefix = live_url_prefix
18
+ end
19
+
20
+ # make sure that env can only be :live, :test, or :mock
21
+ def env=(value)
22
+ raise ArgumentError, "Invalid value for Client.env: '#{value}'' - must be one of [:live, :test, :mock]" unless [:live, :test, :mock].include? value
23
+ @env = value
24
+ end
25
+
26
+ # remove 'https' from live_url_prefix if necessary
27
+ def live_url_prefix=(value)
28
+ if not value["https://"].nil?
29
+ value["https://"] = ""
30
+ end
31
+ @live_url_prefix = value
32
+ end
33
+
34
+ # base URL for API given service and @env
35
+ def service_url_base(service)
36
+ raise ArgumentError, "Please set Client.live_url_prefix to the portion of your merchant-specific URL prior to '-[service]-live.adyenpayments.com'" if @live_url_prefix.nil? and @env == :live
37
+ if @env == :mock
38
+ "http://localhost:#{@mock_port}"
39
+ else
40
+ case service
41
+ when "Checkout"
42
+ url = "https://checkout-#{@env}.adyen.com/checkout"
43
+ when "CheckoutUtility"
44
+ url = "https://checkout-#{@env}.adyen.com"
45
+ when "Account", "Fund", "Notification"
46
+ url = "https://cal-#{@env}.adyen.com/cal/services"
47
+ when "Recurring", "Payment", "Payout"
48
+ url = "https://pal-#{@env}.adyen.com/pal/servlet"
49
+ else
50
+ raise ArgumentError, "Invalid service specified"
51
+ end
52
+
53
+ if @env == :live
54
+ url.insert(8, "#{@live_url_prefix}-")
55
+ url["adyen.com"] = "adyenpayments.com"
56
+ end
57
+
58
+ return url
59
+ end
60
+ end
61
+
62
+ # construct full URL from service and endpoint
63
+ def service_url(service, action, version)
64
+ if service == "Checkout"
65
+ "#{service_url_base(service)}/v#{version}/#{action}"
66
+ else
67
+ "#{service_url_base(service)}/#{service}/v#{version}/#{action}"
68
+ end
69
+ end
70
+
71
+ # send request to adyen API
72
+ def call_adyen_api(service, action, request_data, version)
73
+ # get URL for requested endpoint
74
+ url = service_url(service, action, version)
75
+
76
+ # make sure right authentication has been provided
77
+ # will use api_key if present, otherwise ws_user and ws_password
78
+ if @api_key.nil?
79
+ if service == "PaymentSetupAndVerification"
80
+ raise Adyen::AuthenticationError.new("Checkout service requires API-key", request_data), "Checkout service requires API-key"
81
+ elsif @ws_password.nil? || @ws_user.nil?
82
+ raise Adyen::AuthenticationError.new("No authentication found - please set api_key or ws_user and ws_password", request_data), "No authentication found - please set api_key or ws_user and ws_password"
83
+ else
84
+ auth_type = "basic"
85
+ end
86
+ else
87
+ auth_type = "api-key"
88
+ end
89
+
90
+ # initialize Faraday connection object
91
+ conn = Faraday.new(url: url) do |faraday|
92
+ faraday.adapter @adapter
93
+ faraday.headers["Content-Type"] = "application/json"
94
+ faraday.headers["User-Agent"] = Adyen::NAME + "/" + Adyen::VERSION
95
+
96
+ # set auth type based on service
97
+ case auth_type
98
+ when "basic"
99
+ faraday.basic_auth(@ws_user, @ws_password)
100
+ when "api-key"
101
+ faraday.headers["x-api-key"] = @api_key
102
+ end
103
+ end
104
+
105
+ # if json string convert to hash needed to add applicationInfo
106
+ if request_data.is_a?(String)
107
+ request_data = JSON.parse(request_data)
108
+ end
109
+
110
+ # add apllication only on checkout service
111
+ if service == 'Checkout' || service == 'CheckoutUtility'
112
+ add_application_info(request_data)
113
+ end
114
+
115
+ # convert to json
116
+ request_data = request_data.to_json
117
+
118
+ # post request to Adyen
119
+ begin
120
+ response = conn.post do |req|
121
+ req.body = request_data
122
+ end # handle client errors
123
+ rescue Faraday::ConnectionFailed => connection_error
124
+ raise connection_error, "Connection to #{url} failed"
125
+ end
126
+
127
+ # check for API errors
128
+ case response.status
129
+ when 401
130
+ raise Adyen::AuthenticationError.new("Invalid webservice username / password", request_data)
131
+ when 403
132
+ raise Adyen::PermissionError.new("Invalid Checkout API key", request_data)
133
+ end
134
+
135
+ response
136
+ end
137
+
138
+ def add_application_info(request_data)
139
+ external_platform = {
140
+ :adyenLibrary => {
141
+ :name => Adyen::NAME,
142
+ :version => Adyen::VERSION.to_s
143
+ }
144
+ }
145
+
146
+ request_data[:applicationInfo] = external_platform
147
+ end
148
+
149
+ # services
150
+ def checkout
151
+ @checkout ||= Adyen::Checkout.new(self)
152
+ end
153
+
154
+ def checkout_utility
155
+ @checkout_utility ||= Adyen::CheckoutUtility.new(self)
156
+ end
157
+
158
+ def payments
159
+ @payments ||= Adyen::Payments.new(self)
160
+ end
161
+
162
+ def payouts
163
+ @payouts ||= Adyen::Payouts.new(self)
164
+ end
165
+
166
+ def recurring
167
+ @recurring ||= Adyen::Recurring.new(self)
168
+ end
169
+
170
+ def marketpay
171
+ @marketpay ||= Adyen::Marketpay::Marketpay.new(self)
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,76 @@
1
+ module Adyen
2
+ class AdyenError < StandardError
3
+ attr_reader :code, :response, :request
4
+
5
+ def initialize(request = nil, response = nil, msg = nil, code = nil)
6
+ @code = code
7
+ @response = response
8
+ @request = request
9
+ @msg = msg
10
+ end
11
+ end
12
+
13
+ class AuthenticationError < AdyenError
14
+ def initialize(msg, request)
15
+ @code = 401
16
+ @response = nil
17
+ @request = request
18
+ @msg = msg
19
+ end
20
+ end
21
+
22
+ class PermissionError < AdyenError
23
+ def initialize(msg, request)
24
+ @code = 403
25
+ @response = nil
26
+ @request = request
27
+ @msg = msg
28
+ end
29
+ end
30
+
31
+ class FormatError < AdyenError
32
+ def initialize(msg, request, response)
33
+ @code = 422
34
+ @response = response
35
+ @request = request
36
+ @msg = msg
37
+ end
38
+ end
39
+
40
+ class ServerError < AdyenError
41
+ def initialize(msg, request, response)
42
+ @code = 500
43
+ @response = response
44
+ @request = request
45
+ @msg = msg
46
+ end
47
+ end
48
+
49
+ class ConfigurationError < AdyenError
50
+ def initialize(msg, request)
51
+ @code = 905
52
+ @response = nil
53
+ @request = request
54
+ @msg = msg
55
+ end
56
+ end
57
+
58
+ class ValidationError < AdyenError
59
+ def initialize(msg, request)
60
+ @code = nil
61
+ @response = nil
62
+ @request = request
63
+ @msg = msg
64
+ end
65
+ end
66
+
67
+ # catchall for errors which don't have more specific classes
68
+ class APIError < AdyenError
69
+ def initialize(msg, request, response, code)
70
+ @code = code
71
+ @response = response
72
+ @request = request
73
+ @msg = msg
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,50 @@
1
+ require_relative 'service'
2
+
3
+ module Adyen
4
+ class Checkout < Service
5
+ DEFAULT_VERSION = 40
6
+
7
+ def initialize(client, version = DEFAULT_VERSION)
8
+ service = 'Checkout'
9
+ method_names = [
10
+ :payment_methods,
11
+ :payment_session
12
+ ]
13
+
14
+ super(client, version, service, method_names)
15
+ end
16
+
17
+ # This method can't be dynamically defined because
18
+ # it needs to be both a method and a class
19
+ # to enable payments() and payments.detail(),
20
+ # which is accomplished via an argument length checker
21
+ # and the CheckoutDetail class below
22
+ def payments(*args)
23
+ case args.size
24
+ when 0
25
+ Adyen::CheckoutDetail.new(@client, @version)
26
+ when 1
27
+ action = 'payments'
28
+ @client.call_adyen_api(@service, action, args[0], @version)
29
+ end
30
+ end
31
+ end
32
+
33
+ class CheckoutDetail < Service
34
+ def initialize(client, version = DEFAULT_VERSION)
35
+ @service = 'Checkout'
36
+ @client = client
37
+ @version = version
38
+ end
39
+
40
+ def details(request)
41
+ action = "payments/details"
42
+ @client.call_adyen_api(@service, action, request, @version)
43
+ end
44
+
45
+ def result(request)
46
+ action = "payments/result"
47
+ @client.call_adyen_api(@service, action, request, @version)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'service'
2
+
3
+ module Adyen
4
+ class CheckoutUtility < Service
5
+ DEFAULT_VERSION = 1
6
+
7
+ def initialize(client, version = DEFAULT_VERSION)
8
+ service = 'CheckoutUtility'
9
+ method_names = [
10
+ :origin_keys
11
+ ]
12
+
13
+ super(client, version, service, method_names)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,92 @@
1
+ require_relative 'service'
2
+
3
+ module Adyen
4
+ module Marketpay
5
+ class Marketpay
6
+ attr_accessor :service
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ @service = ""
11
+ end
12
+
13
+ def account
14
+ @account ||= Adyen::Marketpay::Account.new(@client)
15
+ end
16
+
17
+ def fund
18
+ @fund ||= Adyen::Marketpay::Fund.new(@client)
19
+ end
20
+
21
+ def notification
22
+ @notification ||= Adyen::Marketpay::Notification.new(@client)
23
+ end
24
+ end
25
+
26
+ class Account < Service
27
+ attr_accessor :version
28
+ DEFAULT_VERSION = 4
29
+
30
+ def initialize(client, version = DEFAULT_VERSION)
31
+ service = 'Account'
32
+ method_names = [
33
+ :create_account_holder,
34
+ :update_account_holder,
35
+ :create_account,
36
+ :update_account,
37
+ :upload_document,
38
+ :get_uploaded_documents,
39
+ :get_account_holder,
40
+ :update_account_holder_state,
41
+ :delete_bank_accounts,
42
+ :delete_shareholders,
43
+ :close_account,
44
+ :close_account_holder,
45
+ :get_tier_configuration,
46
+ :suspend_account_holder,
47
+ :un_suspend_account_holder
48
+ ]
49
+
50
+ super(client, version, service, method_names)
51
+ end
52
+ end
53
+
54
+ class Fund < Service
55
+ attr_accessor :version
56
+ DEFAULT_VERSION = 3
57
+
58
+ def initialize(client, version = DEFAULT_VERSION)
59
+ service = 'Fund'
60
+ method_names = [
61
+ :payout_account_holder,
62
+ :account_holder_balance,
63
+ :account_holder_transaction_list,
64
+ :refund_not_paid_out_transfers,
65
+ :setup_beneficiary,
66
+ :transfer_funds
67
+ ]
68
+
69
+ super(client, version, service, method_names)
70
+ end
71
+ end
72
+
73
+ class Notification < Service
74
+ attr_accessor :version
75
+ DEFAULT_VERSION = 1
76
+
77
+ def initialize(client, version = DEFAULT_VERSION)
78
+ service = 'Notification'
79
+ method_names = [
80
+ :create_notification_configuration,
81
+ :update_notification_configuration,
82
+ :get_notification_configuration,
83
+ :delete_notification_configurations,
84
+ :get_notification_configuration_list,
85
+ :test_notification_configuration
86
+ ]
87
+
88
+ super(client, version, service, method_names)
89
+ end
90
+ end
91
+ end
92
+ end