Class: GoCardlessPro::Services::FundsAvailabilitiesService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/gocardless_pro/services/funds_availabilities_service.rb

Overview

Service for making requests to the FundsAvailability endpoints

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #make_request, #sub_url

Constructor Details

This class inherits a constructor from GoCardlessPro::Services::BaseService

Instance Method Details

#check(identity, options = {}) ⇒ Object

Checks if the payer's current balance is sufficient to cover the amount the merchant wants to charge within the consent parameters defined on the mandate. Example URL: /funds_availability/:identity

apply to mandates created before 2016.

Parameters:

  • identity

    Unique identifier, beginning with "MD". Note that this prefix may not

  • options (Hash) (defaults to: {})

    parameters as a hash, under a params key.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/gocardless_pro/services/funds_availabilities_service.rb', line 21

def check(identity, options = {})
  path = sub_url('/funds_availability/:identity', {
                   'identity' => identity,
                 })

  options[:retry_failures] = false

  response = make_request(:get, path, options)

  return if response.body.nil?

  Resources::FundsAvailability.new(unenvelope_body(response.body), response)
end