Class: GoCardless::Services::HelperService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/gocardless-pro/services/helper_service.rb

Overview

Service for making requests to the Helper endpoints

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #make_request

Constructor Details

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

Instance Method Details

#mandate(options = {}, custom_headers = {}) ⇒ Object

Returns a PDF mandate form with a signature field, ready to be signed by your customer. May be fully or partially pre-filled.

You must specify ‘Accept: application/pdf` on requests to this endpoint.

Bank account details may either be supplied using the IBAN (international bank account number), or [local details](developer.gocardless.com/pro/#ui-compliance-local-bank-details). For more information on the different fields required in each country, please see the [local bank details](developer.gocardless.com/pro/#ui-compliance-local-bank-details) section.

To generate a mandate in a foreign language, set your Accept-Language header to the relevant [ISO 639-1](en.wikipedia.org/wiki/List_of_ISO_639-1_codes#Partial_ISO_639_table) language code. Currently Dutch, English, French, German, Italian, Portuguese and Spanish are supported.

Note: If you want to render a PDF of an existing mandate you can also do so using the [mandate show endpoint](developer.gocardless.com/pro/#mandates-get-a-single-mandate). Example URL: /helpers/mandate Else, they will be the body of the request.

Parameters:

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

    parameters as a hash. If the request is a GET, these will be converted to query parameters.



40
41
42
43
44
45
46
47
48
# File 'lib/gocardless-pro/services/helper_service.rb', line 40

def mandate(options = {}, custom_headers = {})
  path = '/helpers/mandate'
  new_options = {}
  new_options['data'] = options
  options = new_options
  response = make_request(:post, path, options, custom_headers)

  Resources::Helper.new(unenvelope_body(response.body))
end

#modulus_check(options = {}, custom_headers = {}) ⇒ Object

Check whether an account number and bank / branch code combination are compatible.

Bank account details may either be supplied using the IBAN (international bank account number), or [local details](developer.gocardless.com/pro/#ui-compliance-local-bank-details). For more information on the different fields required in each country, please see the [local bank details](developer.gocardless.com/pro/#ui-compliance-local-bank-details) section. Example URL: /helpers/modulus_check Else, they will be the body of the request.

Parameters:

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

    parameters as a hash. If the request is a GET, these will be converted to query parameters.



63
64
65
66
67
68
69
70
71
# File 'lib/gocardless-pro/services/helper_service.rb', line 63

def modulus_check(options = {}, custom_headers = {})
  path = '/helpers/modulus_check'
  new_options = {}
  new_options['data'] = options
  options = new_options
  response = make_request(:post, path, options, custom_headers)

  Resources::Helper.new(unenvelope_body(response.body))
end

#unenvelope_body(body) ⇒ Object

Unenvelope the response of the body using the service’s envelope_key

Parameters:

  • body (Hash)


76
77
78
# File 'lib/gocardless-pro/services/helper_service.rb', line 76

def unenvelope_body(body)
  body[envelope_key] || body['data']
end