Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/adyen/services/balancePlatform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require_relative 'balancePlatform/balances_api'
require_relative 'balancePlatform/bank_account_validation_api'
require_relative 'balancePlatform/card_orders_api'
require_relative 'balancePlatform/direct_debit_mandates_api'
require_relative 'balancePlatform/grant_accounts_api'
require_relative 'balancePlatform/grant_offers_api'
require_relative 'balancePlatform/manage_card_pin_api'
Expand Down Expand Up @@ -59,6 +60,10 @@ def card_orders_api
@card_orders_api ||= Adyen::CardOrdersApi.new(@client, @version)
end

def direct_debit_mandates_api
@direct_debit_mandates_api ||= Adyen::DirectDebitMandatesApi.new(@client, @version)
end

def grant_accounts_api
@grant_accounts_api ||= Adyen::GrantAccountsApi.new(@client, @version)
end
Expand Down
10 changes: 10 additions & 0 deletions lib/adyen/services/balancePlatform/account_holders_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ def get_tax_form(id, headers: {}, query_params: {})
@client.call_adyen_api(@service, action, {}, headers, @version)
end

# Get summary of tax forms for an account holder
def get_tax_form_summary(id, headers: {}, query_params: {})
endpoint = '/accountHolders/{id}/taxFormSummary'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, id)
Comment on lines +67 to +69
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This pattern for building the endpoint URL is duplicated across several methods in this class (e.g., get_account_holder, get_tax_form). To improve maintainability and reduce redundancy, consider extracting this logic into a private helper method.

For example:

private

def build_endpoint(path, *params)
  endpoint = path.gsub(/{.+?}/, '%s').delete_prefix('/')
  format(endpoint, *params)
end

This would allow you to simplify the implementation in this and other methods:

def get_tax_form_summary(id, headers: {}, query_params: {})
  endpoint = build_endpoint('/accountHolders/{id}/taxFormSummary', id)
  # ...
end

endpoint += create_query_string(query_params)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The create_query_string method appends a ? to the URL even when query_params is empty. While this is generally not a functional issue, it results in URLs with a trailing ? when no query parameters are provided. It would be cleaner to modify create_query_string to only append the query string when parameters are present.

Suggested change in lib/adyen/services/service.rb:

def create_query_string(params)
  return '' if params.empty?
  "?#{URI.encode_www_form(params)}"
end

action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end

# Update an account holder
def update_account_holder(request, id, headers: {})
endpoint = '/accountHolders/{id}'.gsub(/{.+?}/, '%s')
Expand Down
56 changes: 56 additions & 0 deletions lib/adyen/services/balancePlatform/direct_debit_mandates_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
require_relative '../service'
module Adyen

# NOTE: This class is auto generated by OpenAPI Generator
# Ref: https://openapi-generator.tech
#
# Do not edit the class manually.
class DirectDebitMandatesApi < Service
attr_accessor :service, :version

def initialize(client, version = DEFAULT_VERSION)
super(client, version, 'BalancePlatform')
end

# Cancel a mandate
def cancel_mandate(mandate_id, headers: {})
endpoint = '/mandates/{mandateId}/cancel'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, mandate_id)

action = { method: 'post', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end

# Get a list of mandates
def get_list_of_mandates(headers: {}, query_params: {})
endpoint = '/mandates'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint)
endpoint += create_query_string(query_params)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end

# Get a specific mandate
def get_mandate_by_id(mandate_id, headers: {})
endpoint = '/mandates/{mandateId}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, mandate_id)

action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end

# Amend a mandate
def update_mandate(request, mandate_id, headers: {})
endpoint = '/mandates/{mandateId}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, mandate_id)

action = { method: 'patch', url: endpoint }
@client.call_adyen_api(@service, action, request, headers, @version)
end

end
end
8 changes: 8 additions & 0 deletions sdk-generation-log/balanceplatform.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"service": "balanceplatform",
"project": "ruby",
"generatedAt": "2026-04-13T10:15:50Z",
"openapiCommitSha": "ab42e887fd36d43b82acbd9ff6ea3f5957c43a2e",
"automationCommitSha": "855b6c5526cb5fae757e921687c38df66d31dc4b",
"libraryCommitSha": "ec1c835aada9f1a2fd35cd40bd3ef58f72156799"
}
Loading