Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f1df4a4
Changes generated by 45e9dd05fecf12cb2551adb7ea722363c77333d4
gocardless-ci-robot[bot] Sep 3, 2025
3f9b903
Changes generated by 8daaee3cf362eb95793b624663e070346f88da36
gocardless-ci-robot[bot] Sep 5, 2025
f6920d1
Changes generated by a7e2a9392a0526fb2afe63905b8bb280fadfcb45
gocardless-ci-robot[bot] Sep 10, 2025
ef1408a
Changes generated by 39b7ab5adff090d403f3739578614ac01871ab38
gocardless-ci-robot[bot] Sep 12, 2025
f499796
Changes generated by 8687df04d38915918d40915e2f864f689e366cc2
gocardless-ci-robot[bot] Sep 19, 2025
3315f7b
Changes generated by 84ea52be6ede9040bdcdabbc5d07ea107f464e51
gocardless-ci-robot[bot] Oct 7, 2025
94c62e7
Changes generated by 2c4ddcfddd93d20a3bc45f069005eab5671cfc0b
gocardless-ci-robot[bot] Oct 10, 2025
dae413b
Changes generated by 7134f77bedbd68b6cd12ce0d72e7fee52d8ae01b
gocardless-ci-robot[bot] Oct 10, 2025
76956ed
Changes generated by 334d391ef44eb74cdb67ad0ad26189ad016bfc66
gocardless-ci-robot[bot] Oct 16, 2025
e9897a7
Changes generated by 64443289f7160ba24d5f82a2b0dbfea356c6d632
gocardless-ci-robot[bot] Oct 23, 2025
8786bd4
Changes generated by 339a5c5f4e167de77232862c9f1291a252048970
gocardless-ci-robot[bot] Dec 3, 2025
947dae1
Changes generated by 1560b1120a02b39746da793fc226c3e1a3f84a1f
gocardless-ci-robot[bot] Dec 12, 2025
607bffa
Changes generated by 66291d1b54f1ab49758943986274f696be6d5d76
gocardless-ci-robot[bot] Dec 12, 2025
0b4c523
Changes generated by 67dd3bbd646ad34e2a6f0f07ea206c0ee0a08699
gocardless-ci-robot[bot] Dec 12, 2025
c61467e
Changes generated by b0aa6f7cdc8a445ae988d764696bb5809d363a79
gocardless-ci-robot[bot] Dec 12, 2025
4c5b81f
Changes generated by e73ab60a6fcee9426568bee24344ba0b9da1adb9
gocardless-ci-robot[bot] Dec 18, 2025
ebe54e4
Changes generated by cb7854a7c813404c7f8ef88a71de9dafd8f862a0
gocardless-ci-robot[bot] Dec 31, 2025
5e29d00
Changes generated by 8f25127f8e34d5f66c0ed88260939c8a67a90a73
gocardless-ci-robot[bot] Dec 31, 2025
4910cd4
Changes generated by b9772b070039846a4bf837d8ad72675a62f64574
gocardless-ci-robot[bot] Jan 12, 2026
e240585
Changes generated by a3bb22b0d776f8d24f4937b977fb4808aa3d3929
gocardless-ci-robot[bot] Jan 21, 2026
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
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

8 changes: 0 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
source 'https://rubygems.org'
gemspec

# We support both pre-1.x and post-1.x Faraday versions, but to ensure compatibility we
# pin this gem against each in separate runs of CI, using the FARADAY_VERSION env var. For
# more details on the values, see .github/workflows/tests.yml in the gocardless-pro-ruby
# repository.
if ENV.key?("FARADAY_VERSION")
gem 'faraday', "~> #{ENV["FARADAY_VERSION"]}"
end
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,6 @@ OAuth simply provides a means by which you obtain an access token - once you hav

We recommend using the [oauth2](https://github.com/intridea/oauth2) gem to handle the authorisation process and gain a token. For an example of this in action, see our [open-source OAuth demo app](https://github.com/gocardless/oauth-demo/blob/master/app.rb#L46).

## Supporting Ruby < 2.0.0
The client only supports Ruby >= 2.0.0 out of the box due to our use of
Enumerable::Lazy for lazy loading of paginated API resources.

If you wish to use this gem with a previous ruby version, you should be able to
do so with the [backports](https://github.com/marcandre/backports) gem:

1. Add backports to your Gemfile
```gem 'backports'```
2. Require lazy enumerables
```require 'backports/2.0.0/enumerable/lazy.rb'```

## Contributing

This client is auto-generated from Crank, a toolchain that we hope to open source soon. For now, issues should be reported on this repository. __Please do not modify the source code yourself, your changes will be overriden!__
12 changes: 12 additions & 0 deletions lib/gocardless_pro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ module GoCardlessPro
require_relative 'gocardless_pro/resources/bank_account_detail'
require_relative 'gocardless_pro/services/bank_account_details_service'

require_relative 'gocardless_pro/resources/bank_account_holder_verification'
require_relative 'gocardless_pro/services/bank_account_holder_verifications_service'

require_relative 'gocardless_pro/resources/bank_authorisation'
require_relative 'gocardless_pro/services/bank_authorisations_service'

Expand Down Expand Up @@ -90,6 +93,9 @@ module GoCardlessPro
require_relative 'gocardless_pro/resources/export'
require_relative 'gocardless_pro/services/exports_service'

require_relative 'gocardless_pro/resources/funds_availability'
require_relative 'gocardless_pro/services/funds_availabilities_service'

require_relative 'gocardless_pro/resources/instalment_schedule'
require_relative 'gocardless_pro/services/instalment_schedules_service'

Expand Down Expand Up @@ -126,6 +132,12 @@ module GoCardlessPro
require_relative 'gocardless_pro/resources/payment'
require_relative 'gocardless_pro/services/payments_service'

require_relative 'gocardless_pro/resources/payment_account'
require_relative 'gocardless_pro/services/payment_accounts_service'

require_relative 'gocardless_pro/resources/payment_account_transaction'
require_relative 'gocardless_pro/services/payment_account_transactions_service'

require_relative 'gocardless_pro/resources/payout'
require_relative 'gocardless_pro/services/payouts_service'

Expand Down
26 changes: 23 additions & 3 deletions lib/gocardless_pro/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def bank_account_details
@bank_account_details ||= Services::BankAccountDetailsService.new(@api_service)
end

# Access to the service for bank_account_holder_verification to make API calls
def bank_account_holder_verifications
@bank_account_holder_verifications ||= Services::BankAccountHolderVerificationsService.new(@api_service)
end

# Access to the service for bank_authorisation to make API calls
def bank_authorisations
@bank_authorisations ||= Services::BankAuthorisationsService.new(@api_service)
Expand Down Expand Up @@ -88,6 +93,11 @@ def exports
@exports ||= Services::ExportsService.new(@api_service)
end

# Access to the service for funds_availability to make API calls
def funds_availabilities
@funds_availabilities ||= Services::FundsAvailabilitiesService.new(@api_service)
end

# Access to the service for instalment_schedule to make API calls
def instalment_schedules
@instalment_schedules ||= Services::InstalmentSchedulesService.new(@api_service)
Expand Down Expand Up @@ -148,6 +158,16 @@ def payments
@payments ||= Services::PaymentsService.new(@api_service)
end

# Access to the service for payment_account to make API calls
def payment_accounts
@payment_accounts ||= Services::PaymentAccountsService.new(@api_service)
end

# Access to the service for payment_account_transaction to make API calls
def payment_account_transactions
@payment_account_transactions ||= Services::PaymentAccountTransactionsService.new(@api_service)
end

# Access to the service for payout to make API calls
def payouts
@payouts ||= Services::PayoutsService.new(@api_service)
Expand Down Expand Up @@ -253,8 +273,8 @@ def default_options
'User-Agent' => "#{user_agent}",
'Content-Type' => 'application/json',
'GoCardless-Client-Library' => 'gocardless-pro-ruby',
'GoCardless-Client-Version' => '4.2.0'
}
'GoCardless-Client-Version' => '4.2.1',
},
}
end

Expand All @@ -274,7 +294,7 @@ def user_agent
comment = [
"#{ruby_engine}/#{ruby_version}",
"#{RUBY_ENGINE}/#{interpreter_version}",
"#{RUBY_PLATFORM}"
"#{RUBY_PLATFORM}",
]
comment << "faraday/#{Faraday::VERSION}"
"#{gem_info} #{comment.join(' ')}"
Expand Down
6 changes: 3 additions & 3 deletions lib/gocardless_pro/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def message

def to_s
if errors.any?
errors
.map { |err| "#{err['field']} #{err['message']}" }
.join(', ')
errors.
map { |err| "#{err['field']} #{err['message']}" }.
join(', ')
else
@error['message']
end
Expand Down
14 changes: 11 additions & 3 deletions lib/gocardless_pro/middlewares/raise_gocardless_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ def on_complete(env)
return unless CLIENT_ERROR_STATUSES.include?(env.status)

json_body ||= JSON.parse(env.body) unless env.body.empty?
if json_body['error'].is_a?(String)
# Some errors are returned as string rather than objects, wrap in standard format
json_body['error'] = {
'message' => json_body['error'],
'status' => env.status,
}
end
error_type = json_body['error']['type']

error_class = error_class_for_status(env.status) || error_class_for_type(error_type)
Expand All @@ -24,9 +31,10 @@ def on_complete(env)

def error_class_for_status(code)
{
400 => GoCardlessPro::InvalidApiUsageError,
401 => GoCardlessPro::AuthenticationError,
403 => GoCardlessPro::PermissionError,
429 => GoCardlessPro::RateLimitError
429 => GoCardlessPro::RateLimitError,
}.fetch(code, nil)
end

Expand All @@ -35,7 +43,7 @@ def error_class_for_type(type)
validation_failed: GoCardlessPro::ValidationError,
gocardless: GoCardlessPro::GoCardlessError,
invalid_api_usage: GoCardlessPro::InvalidApiUsageError,
invalid_state: GoCardlessPro::InvalidStateError
invalid_state: GoCardlessPro::InvalidStateError,
}.fetch(type.to_sym)
end

Expand All @@ -45,7 +53,7 @@ def generate_error_data(env)
"code: #{env.status}\n" \
"headers: #{env.response_headers}\n" \
"body: #{env.body}",
'code' => env.status
'code' => env.status,
}
end

Expand Down
5 changes: 3 additions & 2 deletions lib/gocardless_pro/paginator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Paginator
def initialize(options = {})
@service = options.fetch(:service)
@options = options.fetch(:options)
@uri_params = options.reject { |k, _| %i[service options].include?(k) }
end

# Get a lazy enumerable for listing data from the API
Expand All @@ -22,15 +23,15 @@ def enumerator

@options[:params] ||= {}
@options[:params] = @options[:params].merge(after: after_cursor)
response = @service.list(@options.merge(after: after_cursor))
response = @service.list(*@uri_params.values, @options.merge(after: after_cursor))
end
end.lazy
end

private

def get_initial_response
@initial_response ||= @service.list(@options)
@initial_response ||= @service.list(*@uri_params.values, @options)
end
end
end
5 changes: 4 additions & 1 deletion lib/gocardless_pro/resources/balance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ module Resources
# likely won’t match what’s shown in the dashboard as the dashboard balances
# are updated much less frequently (once per day).
class Balance
attr_reader :amount, :balance_type, :currency, :last_updated_at
attr_reader :amount
attr_reader :balance_type
attr_reader :currency
attr_reader :last_updated_at

# Initialize a balance resource instance
# @param object [Hash] an object returned from the API
Expand Down
6 changes: 5 additions & 1 deletion lib/gocardless_pro/resources/bank_account_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ module Resources

# Retrieve bank account details in JWE encrypted format
class BankAccountDetail
attr_reader :ciphertext, :encrypted_key, :iv, :protected, :tag
attr_reader :ciphertext
attr_reader :encrypted_key
attr_reader :iv
attr_reader :protected
attr_reader :tag

# Initialize a bank_account_detail resource instance
# @param object [Hash] an object returned from the API
Expand Down
44 changes: 44 additions & 0 deletions lib/gocardless_pro/resources/bank_account_holder_verification.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# This client is automatically generated from a template and JSON schema definition.
# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
#

require 'uri'

module GoCardlessPro
# A module containing classes for each of the resources in the GC Api
module Resources
# Represents an instance of a bank_account_holder_verification resource returned from the API

# Create a bank account holder verification for a bank account.
class BankAccountHolderVerification
attr_reader :actual_account_name
attr_reader :id
attr_reader :result
attr_reader :status
attr_reader :type

# Initialize a bank_account_holder_verification resource instance
# @param object [Hash] an object returned from the API
def initialize(object, response = nil)
@object = object

@actual_account_name = object['actual_account_name']
@id = object['id']
@result = object['result']
@status = object['status']
@type = object['type']
@response = response
end

def api_response
ApiResponse.new(@response)
end

# Provides the bank_account_holder_verification resource as a hash of all its readable attributes
def to_h
@object
end
end
end
end
11 changes: 9 additions & 2 deletions lib/gocardless_pro/resources/bank_authorisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ module Resources
# (see Billing Request Flows) to ensure we meet regulatory requirements for
# checkout flows.
class BankAuthorisation
attr_reader :authorisation_type, :authorised_at, :created_at, :expires_at, :id, :last_visited_at, :qr_code_url,
:redirect_uri, :url
attr_reader :authorisation_type
attr_reader :authorised_at
attr_reader :created_at
attr_reader :expires_at
attr_reader :id
attr_reader :last_visited_at
attr_reader :qr_code_url
attr_reader :redirect_uri
attr_reader :url

# Initialize a bank_authorisation resource instance
# @param object [Hash] an object returned from the API
Expand Down
4 changes: 3 additions & 1 deletion lib/gocardless_pro/resources/bank_details_lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ module Resources

# Look up the name and reachability of a bank account.
class BankDetailsLookup
attr_reader :available_debit_schemes, :bank_name, :bic
attr_reader :available_debit_schemes
attr_reader :bank_name
attr_reader :bic

# Initialize a bank_details_lookup resource instance
# @param object [Hash] an object returned from the API
Expand Down
15 changes: 13 additions & 2 deletions lib/gocardless_pro/resources/billing_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,19 @@ module Resources
# `subscription_request` and `instalment_schedule_request` are only
# supported for ACH and PAD schemes.</p>
class BillingRequest
attr_reader :actions, :created_at, :fallback_enabled, :fallback_occurred, :id, :instalment_schedule_request,
:mandate_request, :metadata, :payment_request, :purpose_code, :resources, :status, :subscription_request
attr_reader :actions
attr_reader :created_at
attr_reader :fallback_enabled
attr_reader :fallback_occurred
attr_reader :id
attr_reader :instalment_schedule_request
attr_reader :mandate_request
attr_reader :metadata
attr_reader :payment_request
attr_reader :purpose_code
attr_reader :resources
attr_reader :status
attr_reader :subscription_request

# Initialize a billing_request resource instance
# @param object [Hash] an object returned from the API
Expand Down
20 changes: 18 additions & 2 deletions lib/gocardless_pro/resources/billing_request_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,24 @@ module Resources
# payment created for a scheme with strong payer
# authorisation (such as open banking single payments).
class BillingRequestFlow
attr_reader :authorisation_url, :auto_fulfil, :created_at, :customer_details_captured, :exit_uri, :expires_at,
:id, :language, :lock_bank_account, :lock_currency, :lock_customer_details, :prefilled_bank_account, :prefilled_customer, :redirect_uri, :session_token, :show_redirect_buttons, :show_success_redirect_button, :skip_success_screen
attr_reader :authorisation_url
attr_reader :auto_fulfil
attr_reader :created_at
attr_reader :customer_details_captured
attr_reader :exit_uri
attr_reader :expires_at
attr_reader :id
attr_reader :language
attr_reader :lock_bank_account
attr_reader :lock_currency
attr_reader :lock_customer_details
attr_reader :prefilled_bank_account
attr_reader :prefilled_customer
attr_reader :redirect_uri
attr_reader :session_token
attr_reader :show_redirect_buttons
attr_reader :show_success_redirect_button
attr_reader :skip_success_screen

# Initialize a billing_request_flow resource instance
# @param object [Hash] an object returned from the API
Expand Down
20 changes: 18 additions & 2 deletions lib/gocardless_pro/resources/billing_request_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,24 @@ module Resources
# for single-use and is designed to cater to the unique needs of individual
# customers.
class BillingRequestTemplate
attr_reader :authorisation_url, :created_at, :id, :mandate_request_constraints, :mandate_request_currency,
:mandate_request_description, :mandate_request_metadata, :mandate_request_scheme, :mandate_request_verify, :metadata, :name, :payment_request_amount, :payment_request_currency, :payment_request_description, :payment_request_metadata, :payment_request_scheme, :redirect_uri, :updated_at
attr_reader :authorisation_url
attr_reader :created_at
attr_reader :id
attr_reader :mandate_request_constraints
attr_reader :mandate_request_currency
attr_reader :mandate_request_description
attr_reader :mandate_request_metadata
attr_reader :mandate_request_scheme
attr_reader :mandate_request_verify
attr_reader :metadata
attr_reader :name
attr_reader :payment_request_amount
attr_reader :payment_request_currency
attr_reader :payment_request_description
attr_reader :payment_request_metadata
attr_reader :payment_request_scheme
attr_reader :redirect_uri
attr_reader :updated_at

# Initialize a billing_request_template resource instance
# @param object [Hash] an object returned from the API
Expand Down
Loading