Class: ThePlaidApi::TransferRefund
- Defined in:
- lib/the_plaid_api/models/transfer_refund.rb
Overview
Represents a refund within the Transfers API.
Instance Attribute Summary collapse
-
#amount ⇒ String
The amount of the refund (decimal string with two digits of precision e.g. “10.00”).
-
#created ⇒ DateTime
The datetime when this refund was created.
-
#failure_reason ⇒ TransferRefundFailure
The failure reason if the event type for a refund is ‘“failed”` or `“returned”`.
-
#id ⇒ String
Plaid’s unique identifier for a refund.
-
#ledger_id ⇒ String
Plaid’s unique identifier for a Plaid Ledger Balance.
-
#network_trace_id ⇒ String
The trace identifier for the transfer based on its network.
-
#status ⇒ TransferRefundStatus
The status of the refund.
-
#transfer_id ⇒ String
The ID of the transfer to refund.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(id:, transfer_id:, amount:, status:, failure_reason:, created:, ledger_id: SKIP, network_trace_id: SKIP, additional_properties: nil) ⇒ TransferRefund
constructor
A new instance of TransferRefund.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id:, transfer_id:, amount:, status:, failure_reason:, created:, ledger_id: SKIP, network_trace_id: SKIP, additional_properties: nil) ⇒ TransferRefund
Returns a new instance of TransferRefund.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 91 def initialize(id:, transfer_id:, amount:, status:, failure_reason:, created:, ledger_id: SKIP, network_trace_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id @transfer_id = transfer_id @amount = amount @status = status @failure_reason = failure_reason @ledger_id = ledger_id unless ledger_id == SKIP @created = created @network_trace_id = network_trace_id unless network_trace_id == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ String
The amount of the refund (decimal string with two digits of precision e.g. “10.00”).
24 25 26 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 24 def amount @amount end |
#created ⇒ DateTime
The datetime when this refund was created. This will be of the form ‘2006-01-02T15:04:05Z`
49 50 51 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 49 def created @created end |
#failure_reason ⇒ TransferRefundFailure
The failure reason if the event type for a refund is ‘“failed”` or `“returned”`. Null value otherwise.
40 41 42 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 40 def failure_reason @failure_reason end |
#id ⇒ String
Plaid’s unique identifier for a refund.
15 16 17 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 15 def id @id end |
#ledger_id ⇒ String
Plaid’s unique identifier for a Plaid Ledger Balance.
44 45 46 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 44 def ledger_id @ledger_id end |
#network_trace_id ⇒ String
The trace identifier for the transfer based on its network. This will only be set after the transfer has posted. For ‘ach` or `same-day-ach` transfers, this is the ACH trace number. For `rtp` transfers, this is the Transaction Identification number. For `wire` transfers, this is the IMAD (Input Message Accountability Data) number.
58 59 60 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 58 def network_trace_id @network_trace_id end |
#status ⇒ TransferRefundStatus
The status of the refund. ‘pending`: A new refund was created; it is in the pending state. `posted`: The refund has been successfully submitted to the payment network. `settled`: Credits have been refunded to the Plaid linked account. `cancelled`: The refund was cancelled by the client. `failed`: The refund has failed. `returned`: The refund was returned.
35 36 37 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 35 def status @status end |
#transfer_id ⇒ String
The ID of the transfer to refund.
19 20 21 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 19 def transfer_id @transfer_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 109 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil transfer_id = hash.key?('transfer_id') ? hash['transfer_id'] : nil amount = hash.key?('amount') ? hash['amount'] : nil status = hash.key?('status') ? hash['status'] : nil failure_reason = TransferRefundFailure.from_hash(hash['failure_reason']) if hash['failure_reason'] created = if hash.key?('created') (DateTimeHelper.from_rfc3339(hash['created']) if hash['created']) end ledger_id = hash.key?('ledger_id') ? hash['ledger_id'] : SKIP network_trace_id = hash.key?('network_trace_id') ? hash['network_trace_id'] : 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. TransferRefund.new(id: id, transfer_id: transfer_id, amount: amount, status: status, failure_reason: failure_reason, created: created, ledger_id: ledger_id, network_trace_id: network_trace_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 61 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['transfer_id'] = 'transfer_id' @_hash['amount'] = 'amount' @_hash['status'] = 'status' @_hash['failure_reason'] = 'failure_reason' @_hash['ledger_id'] = 'ledger_id' @_hash['created'] = 'created' @_hash['network_trace_id'] = 'network_trace_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
83 84 85 86 87 88 89 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 83 def self.nullables %w[ failure_reason ledger_id network_trace_id ] end |
.optionals ⇒ Object
An array for optional fields
75 76 77 78 79 80 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 75 def self.optionals %w[ ledger_id network_trace_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
159 160 161 162 163 164 165 166 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 159 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, transfer_id: #{@transfer_id.inspect}, amount:"\ " #{@amount.inspect}, status: #{@status.inspect}, failure_reason:"\ " #{@failure_reason.inspect}, ledger_id: #{@ledger_id.inspect}, created:"\ " #{@created.inspect}, network_trace_id: #{@network_trace_id.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_created ⇒ Object
145 146 147 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 145 def to_custom_created DateTimeHelper.to_rfc3339(created) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
150 151 152 153 154 155 156 |
# File 'lib/the_plaid_api/models/transfer_refund.rb', line 150 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, transfer_id: #{@transfer_id}, amount: #{@amount}, status:"\ " #{@status}, failure_reason: #{@failure_reason}, ledger_id: #{@ledger_id}, created:"\ " #{@created}, network_trace_id: #{@network_trace_id}, additional_properties:"\ " #{@additional_properties}>" end |