Class: GoCardlessPro::Resources::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/gocardless_pro/resources/block.rb

Overview

Blocks are created to prevent certain customer details from being used when creating mandates.

The details used to create blocks can be exact matches, like a bank account or an email, or a more generic match such as an email domain or bank name. Please be careful when creating blocks for more generic matches as this may block legitimate payers from using your service.

New block types may be added over time.

A block is in essence a simple rule that is used to match against details in a newly created mandate. If there is a successful match then the mandate is transitioned to a “blocked” state.

Please note:

- Payments and subscriptions cannot be created against a mandate in

blocked state.

- A mandate can never be transitioned out of the blocked state.

The one exception to this is when blocking a ‘bank_name’. This block will prevent bank accounts from being created for banks that match the given name. To ensure we match bank names correctly an existing bank account must be used when creating this block. Please be aware that we cannot always match a bank account to a given bank name.

<p class=“notice”>

This API is currently only available for GoCardless Protect+ integrators

would like to use this API. </p>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, response = nil) ⇒ Block

Initialize a block resource instance

Parameters:

  • object (Hash)

    an object returned from the API



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/gocardless_pro/resources/block.rb', line 63

def initialize(object, response = nil)
  @object = object

  @active = object['active']
  @block_type = object['block_type']
  @created_at = object['created_at']
  @id = object['id']
  @reason_description = object['reason_description']
  @reason_type = object['reason_type']
  @resource_reference = object['resource_reference']
  @updated_at = object['updated_at']
  @response = response
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



52
53
54
# File 'lib/gocardless_pro/resources/block.rb', line 52

def active
  @active
end

#block_typeObject (readonly)

Returns the value of attribute block_type.



53
54
55
# File 'lib/gocardless_pro/resources/block.rb', line 53

def block_type
  @block_type
end

#created_atObject (readonly)

Returns the value of attribute created_at.



54
55
56
# File 'lib/gocardless_pro/resources/block.rb', line 54

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



55
56
57
# File 'lib/gocardless_pro/resources/block.rb', line 55

def id
  @id
end

#reason_descriptionObject (readonly)

Returns the value of attribute reason_description.



56
57
58
# File 'lib/gocardless_pro/resources/block.rb', line 56

def reason_description
  @reason_description
end

#reason_typeObject (readonly)

Returns the value of attribute reason_type.



57
58
59
# File 'lib/gocardless_pro/resources/block.rb', line 57

def reason_type
  @reason_type
end

#resource_referenceObject (readonly)

Returns the value of attribute resource_reference.



58
59
60
# File 'lib/gocardless_pro/resources/block.rb', line 58

def resource_reference
  @resource_reference
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



59
60
61
# File 'lib/gocardless_pro/resources/block.rb', line 59

def updated_at
  @updated_at
end

Instance Method Details

#api_responseObject



77
78
79
# File 'lib/gocardless_pro/resources/block.rb', line 77

def api_response
  ApiResponse.new(@response)
end

#to_hObject

Provides the block resource as a hash of all its readable attributes



82
83
84
# File 'lib/gocardless_pro/resources/block.rb', line 82

def to_h
  @object
end