Class: ThePlaidApi::PaymentInitiationConsentPayerDetails

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

Overview

An object representing the payment consent payer details. Payer ‘name` and account `numbers` are required to lock the account to which the consent can be created.

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(name:, numbers:, address: SKIP, date_of_birth: SKIP, phone_numbers: SKIP, emails: SKIP, additional_properties: nil) ⇒ PaymentInitiationConsentPayerDetails

Returns a new instance of PaymentInitiationConsentPayerDetails.



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

def initialize(name:, numbers:, address: SKIP, date_of_birth: SKIP,
               phone_numbers: SKIP, emails: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name
  @numbers = numbers
  @address = address unless address == SKIP
  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @phone_numbers = phone_numbers unless phone_numbers == SKIP
  @emails = emails unless emails == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressPaymentInitiationAddress

The optional address of the payment recipient’s bank account. Required by most institutions outside of the UK.



26
27
28
# File 'lib/the_plaid_api/models/payment_initiation_consent_payer_details.rb', line 26

def address
  @address
end

#date_of_birthDate

The payer’s birthdate, in [ISO 8601](wikipedia.org/wiki/ISO_8601) (YYYY-MM-DD) format.

Returns:

  • (Date)


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

def date_of_birth
  @date_of_birth
end

#emailsArray[String]

The payer’s emails

Returns:

  • (Array[String])


39
40
41
# File 'lib/the_plaid_api/models/payment_initiation_consent_payer_details.rb', line 39

def emails
  @emails
end

#nameString

The name of the payer as it appears in their bank account

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/payment_initiation_consent_payer_details.rb', line 16

def name
  @name
end

#numbersPaymentInitiationConsentPayerNumbers

The counterparty’s bank account numbers. Exactly one of IBAN or BACS data is required.



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

def numbers
  @numbers
end

#phone_numbersArray[String]

The payer’s phone numbers in E.164 format: +countrycodenumber

Returns:

  • (Array[String])


35
36
37
# File 'lib/the_plaid_api/models/payment_initiation_consent_payer_details.rb', line 35

def phone_numbers
  @phone_numbers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/the_plaid_api/models/payment_initiation_consent_payer_details.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  numbers = PaymentInitiationConsentPayerNumbers.from_hash(hash['numbers']) if hash['numbers']
  address = PaymentInitiationAddress.from_hash(hash['address']) if hash['address']
  date_of_birth = hash.key?('date_of_birth') ? hash['date_of_birth'] : SKIP
  phone_numbers = hash.key?('phone_numbers') ? hash['phone_numbers'] : SKIP
  emails = hash.key?('emails') ? hash['emails'] : 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.
  PaymentInitiationConsentPayerDetails.new(name: name,
                                           numbers: numbers,
                                           address: address,
                                           date_of_birth: date_of_birth,
                                           phone_numbers: phone_numbers,
                                           emails: emails,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/payment_initiation_consent_payer_details.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['numbers'] = 'numbers'
  @_hash['address'] = 'address'
  @_hash['date_of_birth'] = 'date_of_birth'
  @_hash['phone_numbers'] = 'phone_numbers'
  @_hash['emails'] = 'emails'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
67
68
69
# File 'lib/the_plaid_api/models/payment_initiation_consent_payer_details.rb', line 64

def self.nullables
  %w[
    address
    date_of_birth
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    address
    date_of_birth
    phone_numbers
    emails
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



124
125
126
127
128
129
130
# File 'lib/the_plaid_api/models/payment_initiation_consent_payer_details.rb', line 124

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, numbers: #{@numbers.inspect}, address:"\
  " #{@address.inspect}, date_of_birth: #{@date_of_birth.inspect}, phone_numbers:"\
  " #{@phone_numbers.inspect}, emails: #{@emails.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
121
# File 'lib/the_plaid_api/models/payment_initiation_consent_payer_details.rb', line 116

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, numbers: #{@numbers}, address: #{@address}, date_of_birth:"\
  " #{@date_of_birth}, phone_numbers: #{@phone_numbers}, emails: #{@emails},"\
  " additional_properties: #{@additional_properties}>"
end