Class: ThePlaidApi::WalletTransactionRelation

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

Overview

Transactions are related when they have a logical connection. For example, a ‘PAYOUT` transaction can be returned by the sender, creating a `RETURN` transaction. Each `PAYOUT` transaction can have at most one corresponding `RETURN` transaction in case of reversal. These relationships are bi-directional, meaning that both entities have references to each other. For instance, when a transaction of type RETURN occurs, it is linked to the original transaction being returned. Likewise, the original transaction has a reference back to the RETURN transaction that represents the return. This field is only populated for transactions of type `RETURN`, `FUNDS_SWEEP`, `REFUND` and `PAYOUT`. The relationship between a `PIS_PAY_IN` payment and its corresponding `REFUND` transactions is only available through `refund_ids` property in the payment object. See(plaid.com/docs/api/products/p ayment-initiation/#payment_initiation-payment-get-response-refund-ids).

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(id: SKIP, type: SKIP, additional_properties: nil) ⇒ WalletTransactionRelation

Returns a new instance of WalletTransactionRelation.



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

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

  @id = id unless id == SKIP
  @type = type unless type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#idString

The ID of the related transaction.

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/wallet_transaction_relation.rb', line 27

def id
  @id
end

#typeType4

The type of the transaction.

Returns:



31
32
33
# File 'lib/the_plaid_api/models/wallet_transaction_relation.rb', line 31

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/the_plaid_api/models/wallet_transaction_relation.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  type = hash.key?('type') ? hash['type'] : 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.
  WalletTransactionRelation.new(id: id,
                                type: type,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
# File 'lib/the_plaid_api/models/wallet_transaction_relation.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/the_plaid_api/models/wallet_transaction_relation.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
# File 'lib/the_plaid_api/models/wallet_transaction_relation.rb', line 42

def self.optionals
  %w[
    id
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



92
93
94
95
96
# File 'lib/the_plaid_api/models/wallet_transaction_relation.rb', line 92

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

#to_sObject

Provides a human-readable string representation of the object.



85
86
87
88
89
# File 'lib/the_plaid_api/models/wallet_transaction_relation.rb', line 85

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