Class: Plaid::PaymentInitiationRecipientGetResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/payment_initiation_recipient_get_response.rb

Overview

PaymentInitiationRecipientGetResponse defines the response schema for ‘/payment_initiation/recipient/get`

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(recipient_id:, name:, request_id:, address: SKIP, iban: SKIP, bacs: SKIP, emi_recipient_id: SKIP, additional_properties: nil) ⇒ PaymentInitiationRecipientGetResponse

Returns a new instance of PaymentInitiationRecipientGetResponse.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 79

def initialize(recipient_id:, name:, request_id:, address: SKIP, iban: SKIP,
               bacs: SKIP, emi_recipient_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @recipient_id = recipient_id
  @name = name
  @address = address unless address == SKIP
  @iban = iban unless iban == SKIP
  @bacs = bacs unless bacs == SKIP
  @emi_recipient_id = emi_recipient_id unless emi_recipient_id == SKIP
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressPaymentInitiationAddress

The optional address of the payment recipient. This object is not currently required to make payments from UK institutions and should not be populated, though may be necessary for future European expansion.



25
26
27
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 25

def address
  @address
end

#bacsRecipientBacsNullable

The International Bank Account Number (IBAN) for the recipient.



33
34
35
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 33

def bacs
  @bacs
end

#emi_recipient_idString

The EMI (E-Money Institution) recipient that this recipient is associated with, if any. This EMI recipient is used as an intermediary account to enable Plaid to reconcile the settlement of funds for Payment Initiation requests.

Returns:

  • (String)


40
41
42
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 40

def emi_recipient_id
  @emi_recipient_id
end

#ibanString

The International Bank Account Number (IBAN) for the recipient.

Returns:

  • (String)


29
30
31
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 29

def iban
  @iban
end

#nameString

The name of the recipient.

Returns:

  • (String)


19
20
21
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 19

def name
  @name
end

#recipient_idString

The ID of the recipient.

Returns:

  • (String)


15
16
17
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 15

def recipient_id
  @recipient_id
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


46
47
48
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 46

def request_id
  @request_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  recipient_id = hash.key?('recipient_id') ? hash['recipient_id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  address = PaymentInitiationAddress.from_hash(hash['address']) if hash['address']
  iban = hash.key?('iban') ? hash['iban'] : SKIP
  bacs = RecipientBacsNullable.from_hash(hash['bacs']) if hash['bacs']
  emi_recipient_id =
    hash.key?('emi_recipient_id') ? hash['emi_recipient_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.
  PaymentInitiationRecipientGetResponse.new(recipient_id: recipient_id,
                                            name: name,
                                            request_id: request_id,
                                            address: address,
                                            iban: iban,
                                            bacs: bacs,
                                            emi_recipient_id: emi_recipient_id,
                                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['recipient_id'] = 'recipient_id'
  @_hash['name'] = 'name'
  @_hash['address'] = 'address'
  @_hash['iban'] = 'iban'
  @_hash['bacs'] = 'bacs'
  @_hash['emi_recipient_id'] = 'emi_recipient_id'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
75
76
77
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 72

def self.nullables
  %w[
    iban
    emi_recipient_id
  ]
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 62

def self.optionals
  %w[
    address
    iban
    bacs
    emi_recipient_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



136
137
138
139
140
141
142
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 136

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} recipient_id: #{@recipient_id.inspect}, name: #{@name.inspect}, address:"\
  " #{@address.inspect}, iban: #{@iban.inspect}, bacs: #{@bacs.inspect}, emi_recipient_id:"\
  " #{@emi_recipient_id.inspect}, request_id: #{@request_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



128
129
130
131
132
133
# File 'lib/plaid/models/payment_initiation_recipient_get_response.rb', line 128

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} recipient_id: #{@recipient_id}, name: #{@name}, address: #{@address}, iban:"\
  " #{@iban}, bacs: #{@bacs}, emi_recipient_id: #{@emi_recipient_id}, request_id:"\
  " #{@request_id}, additional_properties: #{@additional_properties}>"
end