Class: GoCardlessPro::Services::MandatePdfsService

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

Overview

Service for making requests to the MandatePdf 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

#create(options = {}) ⇒ Object

Generates a PDF mandate and returns its temporary URL.

Customer and bank account details can be left blank (for a blank mandate), provided manually, or inferred from the ID of an existing [mandate](#core-endpoints-mandates).

By default, we’ll generate PDF mandates in English.

To generate a PDF mandate in another language, set the ‘Accept-Language` header when creating the PDF mandate to the relevant [ISO 639-1](en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code supported for the scheme.

| Scheme | Supported languages

|

| :————— | :——————————————————————————————————————————————- | | ACH | English (‘en`)

|

| Autogiro | English (‘en`), Swedish (`sv`)

|

| Bacs | English (‘en`)

|

| BECS | English (‘en`)

|

| BECS NZ | English (‘en`)

|

| Betalingsservice | Danish (‘da`), English (`en`)

|

| PAD | English (‘en`)

|

| SEPA Core | Danish (‘da`), Dutch (`nl`), English (`en`), French (`fr`), German (`de`), Italian (`it`), Portuguese (`pt`), Spanish (`es`), Swedish (`sv`) | Example URL: /mandate_pdfs

Parameters:

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

    parameters as a hash, under a params key.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/gocardless_pro/services/mandate_pdfs_service.rb', line 58

def create(options = {})
  path = '/mandate_pdfs'

  params = options.delete(:params) || {}
  options[:params] = {}
  options[:params][envelope_key] = params

  options[:retry_failures] = true

  response = make_request(:post, path, options)

  return if response.body.nil?

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