Class: ThePlaidApi::PaymentMeta

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

Overview

Transaction information specific to inter-bank transfers. If the transaction was not an inter-bank transfer, all fields will be ‘null`. If the `transactions` object was returned by a Transactions endpoint such as `/transactions/sync` or `/transactions/get`, the `payment_meta` key will always appear, but no data elements are guaranteed. If the `transactions` object was returned by an Assets endpoint such as `/asset_report/get/` or `/asset_report/pdf/get`, this field will only appear in an Asset Report with Insights.

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(reference_number:, ppd_id:, payee:, by_order_of:, payer:, payment_method:, payment_processor:, reason:, additional_properties: nil) ⇒ PaymentMeta

Returns a new instance of PaymentMeta.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/the_plaid_api/models/payment_meta.rb', line 85

def initialize(reference_number:, ppd_id:, payee:, by_order_of:, payer:,
               payment_method:, payment_processor:, reason:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @reference_number = reference_number
  @ppd_id = ppd_id
  @payee = payee
  @by_order_of = by_order_of
  @payer = payer
  @payment_method = payment_method
  @payment_processor = payment_processor
  @reason = reason
  @additional_properties = additional_properties
end

Instance Attribute Details

#by_order_ofString

The party initiating a wire transfer. Will be ‘null` if the transaction is not a wire transfer.

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/payment_meta.rb', line 34

def by_order_of
  @by_order_of
end

#payeeString

For transfers, the party that is receiving the transaction.

Returns:

  • (String)


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

def payee
  @payee
end

#payerString

For transfers, the party that is paying the transaction.

Returns:

  • (String)


38
39
40
# File 'lib/the_plaid_api/models/payment_meta.rb', line 38

def payer
  @payer
end

#payment_methodString

The type of transfer, e.g. ‘ACH’

Returns:

  • (String)


42
43
44
# File 'lib/the_plaid_api/models/payment_meta.rb', line 42

def payment_method
  @payment_method
end

#payment_processorString

The name of the payment processor

Returns:

  • (String)


46
47
48
# File 'lib/the_plaid_api/models/payment_meta.rb', line 46

def payment_processor
  @payment_processor
end

#ppd_idString

The ACH PPD ID for the payer.

Returns:

  • (String)


25
26
27
# File 'lib/the_plaid_api/models/payment_meta.rb', line 25

def ppd_id
  @ppd_id
end

#reasonString

The payer-supplied description of the transfer.

Returns:

  • (String)


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

def reason
  @reason
end

#reference_numberString

The transaction reference number supplied by the financial institution.

Returns:

  • (String)


21
22
23
# File 'lib/the_plaid_api/models/payment_meta.rb', line 21

def reference_number
  @reference_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



103
104
105
106
107
108
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
# File 'lib/the_plaid_api/models/payment_meta.rb', line 103

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  reference_number =
    hash.key?('reference_number') ? hash['reference_number'] : nil
  ppd_id = hash.key?('ppd_id') ? hash['ppd_id'] : nil
  payee = hash.key?('payee') ? hash['payee'] : nil
  by_order_of = hash.key?('by_order_of') ? hash['by_order_of'] : nil
  payer = hash.key?('payer') ? hash['payer'] : nil
  payment_method =
    hash.key?('payment_method') ? hash['payment_method'] : nil
  payment_processor =
    hash.key?('payment_processor') ? hash['payment_processor'] : nil
  reason = hash.key?('reason') ? hash['reason'] : nil

  # 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.
  PaymentMeta.new(reference_number: reference_number,
                  ppd_id: ppd_id,
                  payee: payee,
                  by_order_of: by_order_of,
                  payer: payer,
                  payment_method: payment_method,
                  payment_processor: payment_processor,
                  reason: reason,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/the_plaid_api/models/payment_meta.rb', line 53

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reference_number'] = 'reference_number'
  @_hash['ppd_id'] = 'ppd_id'
  @_hash['payee'] = 'payee'
  @_hash['by_order_of'] = 'by_order_of'
  @_hash['payer'] = 'payer'
  @_hash['payment_method'] = 'payment_method'
  @_hash['payment_processor'] = 'payment_processor'
  @_hash['reason'] = 'reason'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/the_plaid_api/models/payment_meta.rb', line 72

def self.nullables
  %w[
    reference_number
    ppd_id
    payee
    by_order_of
    payer
    payment_method
    payment_processor
    reason
  ]
end

.optionalsObject

An array for optional fields



67
68
69
# File 'lib/the_plaid_api/models/payment_meta.rb', line 67

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
155
# File 'lib/the_plaid_api/models/payment_meta.rb', line 148

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} reference_number: #{@reference_number.inspect}, ppd_id: #{@ppd_id.inspect},"\
  " payee: #{@payee.inspect}, by_order_of: #{@by_order_of.inspect}, payer: #{@payer.inspect},"\
  " payment_method: #{@payment_method.inspect}, payment_processor:"\
  " #{@payment_processor.inspect}, reason: #{@reason.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



139
140
141
142
143
144
145
# File 'lib/the_plaid_api/models/payment_meta.rb', line 139

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} reference_number: #{@reference_number}, ppd_id: #{@ppd_id}, payee:"\
  " #{@payee}, by_order_of: #{@by_order_of}, payer: #{@payer}, payment_method:"\
  " #{@payment_method}, payment_processor: #{@payment_processor}, reason: #{@reason},"\
  " additional_properties: #{@additional_properties}>"
end