Class: ThePlaidApi::TransferRefundFailure

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/transfer_refund_failure.rb

Overview

The failure reason if the event type for a refund is ‘“failed”` or `“returned”`. Null value otherwise.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(failure_code: SKIP, ach_return_code: SKIP, description: SKIP, additional_properties: nil) ⇒ TransferRefundFailure

Returns a new instance of TransferRefundFailure.



61
62
63
64
65
66
67
68
69
70
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 61

def initialize(failure_code: SKIP, ach_return_code: SKIP, description: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @failure_code = failure_code unless failure_code == SKIP
  @ach_return_code = ach_return_code unless ach_return_code == SKIP
  @description = description unless description == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#ach_return_codeString

The ACH return code, e.g. ‘R01`. A return code will be provided if and only if the refund status is `returned`. For a full listing of ACH return codes, see [Transfer errors](plaid.com/docs/errors/transfer/#ach-return-codes). This field is deprecated in favor of the more versatile `failure_code`, which encompasses non-ACH failure codes as well.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 29

def ach_return_code
  @ach_return_code
end

#descriptionString

A human-readable description of the reason for the failure or reversal.

Returns:

  • (String)


33
34
35
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 33

def description
  @description
end

#failure_codeString

The failure code, e.g. ‘R01`. A failure code will be provided if and only if the refund status is `returned`. See [ACH return codes](plaid.com/docs/errors/transfer/#ach-return-codes) for a full listing of ACH return codes and [RTP/RfP error codes](plaid.com/docs/errors/transfer/#rtprfp-error-codes) for RTP error codes.

Returns:

  • (String)


20
21
22
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 20

def failure_code
  @failure_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  failure_code = hash.key?('failure_code') ? hash['failure_code'] : SKIP
  ach_return_code =
    hash.key?('ach_return_code') ? hash['ach_return_code'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  TransferRefundFailure.new(failure_code: failure_code,
                            ach_return_code: ach_return_code,
                            description: description,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['failure_code'] = 'failure_code'
  @_hash['ach_return_code'] = 'ach_return_code'
  @_hash['description'] = 'description'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
57
58
59
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 54

def self.nullables
  %w[
    failure_code
    ach_return_code
  ]
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 45

def self.optionals
  %w[
    failure_code
    ach_return_code
    description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
109
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} failure_code: #{@failure_code.inspect}, ach_return_code:"\
  " #{@ach_return_code.inspect}, description: #{@description.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



97
98
99
100
101
# File 'lib/the_plaid_api/models/transfer_refund_failure.rb', line 97

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} failure_code: #{@failure_code}, ach_return_code: #{@ach_return_code},"\
  " description: #{@description}, additional_properties: #{@additional_properties}>"
end