Class: Plaid::StudentLoan

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

Overview

Contains details about a student loan account

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(account_id:, account_number:, disbursement_dates:, expected_payoff_date:, guarantor:, interest_rate_percentage:, is_overdue:, last_payment_amount:, last_payment_date:, last_statement_issue_date:, loan_name:, loan_status:, minimum_payment_amount:, next_payment_due_date:, origination_date:, origination_principal_amount:, outstanding_interest_amount:, payment_reference_number:, pslf_status:, repayment_plan:, sequence_number:, servicer_address:, ytd_interest_paid:, ytd_principal_paid:, additional_properties: nil) ⇒ StudentLoan

Returns a new instance of StudentLoan.



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/plaid/models/student_loan.rb', line 203

def initialize(account_id:, account_number:, disbursement_dates:,
               expected_payoff_date:, guarantor:, interest_rate_percentage:,
               is_overdue:, last_payment_amount:, last_payment_date:,
               last_statement_issue_date:, loan_name:, loan_status:,
               minimum_payment_amount:, next_payment_due_date:,
               origination_date:, origination_principal_amount:,
               outstanding_interest_amount:, payment_reference_number:,
               pslf_status:, repayment_plan:, sequence_number:,
               servicer_address:, ytd_interest_paid:, ytd_principal_paid:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id = 
  @account_number = 
  @disbursement_dates = disbursement_dates
  @expected_payoff_date = expected_payoff_date
  @guarantor = guarantor
  @interest_rate_percentage = interest_rate_percentage
  @is_overdue = is_overdue
  @last_payment_amount = last_payment_amount
  @last_payment_date = last_payment_date
  @last_statement_issue_date = last_statement_issue_date
  @loan_name = loan_name
  @loan_status = loan_status
  @minimum_payment_amount = minimum_payment_amount
  @next_payment_due_date = next_payment_due_date
  @origination_date = origination_date
  @origination_principal_amount = origination_principal_amount
  @outstanding_interest_amount = outstanding_interest_amount
  @payment_reference_number = payment_reference_number
  @pslf_status = pslf_status
  @repayment_plan = repayment_plan
  @sequence_number = sequence_number
  @servicer_address = servicer_address
  @ytd_interest_paid = ytd_interest_paid
  @ytd_principal_paid = ytd_principal_paid
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The ID of the account that this liability belongs to.

Returns:

  • (String)


14
15
16
# File 'lib/plaid/models/student_loan.rb', line 14

def 
  @account_id
end

#account_numberString

The account number of the loan. For some institutions, this may be a masked version of the number (e.g., the last 4 digits instead of the entire number).

Returns:

  • (String)


20
21
22
# File 'lib/plaid/models/student_loan.rb', line 20

def 
  @account_number
end

#disbursement_datesArray[Date]

The dates on which loaned funds were disbursed or will be disbursed. These are often in the past. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Array[Date])


26
27
28
# File 'lib/plaid/models/student_loan.rb', line 26

def disbursement_dates
  @disbursement_dates
end

#expected_payoff_dateDate

The date when the student loan is expected to be paid off. Availability for this field is limited. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


32
33
34
# File 'lib/plaid/models/student_loan.rb', line 32

def expected_payoff_date
  @expected_payoff_date
end

#guarantorString

The guarantor of the student loan.

Returns:

  • (String)


36
37
38
# File 'lib/plaid/models/student_loan.rb', line 36

def guarantor
  @guarantor
end

#interest_rate_percentageFloat

The interest rate on the loan as a percentage.

Returns:

  • (Float)


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

def interest_rate_percentage
  @interest_rate_percentage
end

#is_overdueTrueClass | FalseClass

‘true` if a payment is currently overdue. Availability for this field is limited.

Returns:

  • (TrueClass | FalseClass)


45
46
47
# File 'lib/plaid/models/student_loan.rb', line 45

def is_overdue
  @is_overdue
end

#last_payment_amountFloat

The amount of the last payment.

Returns:

  • (Float)


49
50
51
# File 'lib/plaid/models/student_loan.rb', line 49

def last_payment_amount
  @last_payment_amount
end

#last_payment_dateDate

The date of the last payment. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


54
55
56
# File 'lib/plaid/models/student_loan.rb', line 54

def last_payment_date
  @last_payment_date
end

#last_statement_issue_dateDate

The date of the last statement. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


59
60
61
# File 'lib/plaid/models/student_loan.rb', line 59

def last_statement_issue_date
  @last_statement_issue_date
end

#loan_nameString

The type of loan, e.g., “Consolidation Loans”.

Returns:

  • (String)


63
64
65
# File 'lib/plaid/models/student_loan.rb', line 63

def loan_name
  @loan_name
end

#loan_statusStudentLoanStatus

An object representing the status of the student loan

Returns:



67
68
69
# File 'lib/plaid/models/student_loan.rb', line 67

def loan_status
  @loan_status
end

#minimum_payment_amountFloat

The minimum payment due for the next billing cycle. There are some exceptions: Some institutions require a minimum payment across all loans associated with an account number. Our API presents that same minimum payment amount on each loan. The institutions that do this are: Great Lakes ( ‘ins_116861`), Firstmark (`ins_116295`), Commonbond Firstmark Services (`ins_116950`), Nelnet (`ins_116528`), EdFinancial Services (`ins_116304`), Granite State (`ins_116308`), and Oklahoma Student Loan Authority (`ins_116945`). Firstmark (`ins_116295` ) will display as $0 if there is an autopay program in effect.

Returns:

  • (Float)


81
82
83
# File 'lib/plaid/models/student_loan.rb', line 81

def minimum_payment_amount
  @minimum_payment_amount
end

#next_payment_due_dateDate

The due date for the next payment. The due date is ‘null` if a payment is not expected. A payment is not expected if `loan_status.type` is `deferment`, `in_school`, `consolidated`, `paid in full`, or `transferred`. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


89
90
91
# File 'lib/plaid/models/student_loan.rb', line 89

def next_payment_due_date
  @next_payment_due_date
end

#origination_dateDate

The date on which the loan was initially lent. Dates are returned in an [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD).

Returns:

  • (Date)


94
95
96
# File 'lib/plaid/models/student_loan.rb', line 94

def origination_date
  @origination_date
end

#origination_principal_amountFloat

The original principal balance of the loan.

Returns:

  • (Float)


98
99
100
# File 'lib/plaid/models/student_loan.rb', line 98

def origination_principal_amount
  @origination_principal_amount
end

#outstanding_interest_amountFloat

The total dollar amount of the accrued interest balance. For Sallie Mae ( ‘ins_116944`), this amount is included in the current balance of the loan, so this field will return as `null`.

Returns:

  • (Float)


104
105
106
# File 'lib/plaid/models/student_loan.rb', line 104

def outstanding_interest_amount
  @outstanding_interest_amount
end

#payment_reference_numberString

The relevant account number that should be used to reference this loan for payments. In the majority of cases, ‘payment_reference_number` will match a`ccount_number,` but in some institutions, such as Great Lakes (`ins_116861`), it will be different.

Returns:

  • (String)


111
112
113
# File 'lib/plaid/models/student_loan.rb', line 111

def payment_reference_number
  @payment_reference_number
end

#pslf_statusPslfStatus

Information about the student’s eligibility in the Public Service Loan Forgiveness program. This is only returned if the institution is Fedloan (‘ins_116527`).

Returns:



117
118
119
# File 'lib/plaid/models/student_loan.rb', line 117

def pslf_status
  @pslf_status
end

#repayment_planStudentRepaymentPlan

An object representing the repayment plan for the student loan



121
122
123
# File 'lib/plaid/models/student_loan.rb', line 121

def repayment_plan
  @repayment_plan
end

#sequence_numberString

The sequence number of the student loan. Heartland ECSI (‘ins_116948`) does not make this field available.

Returns:

  • (String)


126
127
128
# File 'lib/plaid/models/student_loan.rb', line 126

def sequence_number
  @sequence_number
end

#servicer_addressServicerAddressData

The address of the student loan servicer. This is generally the remittance address to which payments should be sent.

Returns:



131
132
133
# File 'lib/plaid/models/student_loan.rb', line 131

def servicer_address
  @servicer_address
end

#ytd_interest_paidFloat

The year to date (YTD) interest paid. Availability for this field is limited.

Returns:

  • (Float)


136
137
138
# File 'lib/plaid/models/student_loan.rb', line 136

def ytd_interest_paid
  @ytd_interest_paid
end

#ytd_principal_paidFloat

The year to date (YTD) principal paid. Availability for this field is limited.

Returns:

  • (Float)


141
142
143
# File 'lib/plaid/models/student_loan.rb', line 141

def ytd_principal_paid
  @ytd_principal_paid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/plaid/models/student_loan.rb', line 244

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_id') ? hash['account_id'] : nil
   =
    hash.key?('account_number') ? hash['account_number'] : nil
  disbursement_dates =
    hash.key?('disbursement_dates') ? hash['disbursement_dates'] : nil
  expected_payoff_date =
    hash.key?('expected_payoff_date') ? hash['expected_payoff_date'] : nil
  guarantor = hash.key?('guarantor') ? hash['guarantor'] : nil
  interest_rate_percentage =
    hash.key?('interest_rate_percentage') ? hash['interest_rate_percentage'] : nil
  is_overdue = hash.key?('is_overdue') ? hash['is_overdue'] : nil
  last_payment_amount =
    hash.key?('last_payment_amount') ? hash['last_payment_amount'] : nil
  last_payment_date =
    hash.key?('last_payment_date') ? hash['last_payment_date'] : nil
  last_statement_issue_date =
    hash.key?('last_statement_issue_date') ? hash['last_statement_issue_date'] : nil
  loan_name = hash.key?('loan_name') ? hash['loan_name'] : nil
  loan_status = StudentLoanStatus.from_hash(hash['loan_status']) if hash['loan_status']
  minimum_payment_amount =
    hash.key?('minimum_payment_amount') ? hash['minimum_payment_amount'] : nil
  next_payment_due_date =
    hash.key?('next_payment_due_date') ? hash['next_payment_due_date'] : nil
  origination_date =
    hash.key?('origination_date') ? hash['origination_date'] : nil
  origination_principal_amount =
    hash.key?('origination_principal_amount') ? hash['origination_principal_amount'] : nil
  outstanding_interest_amount =
    hash.key?('outstanding_interest_amount') ? hash['outstanding_interest_amount'] : nil
  payment_reference_number =
    hash.key?('payment_reference_number') ? hash['payment_reference_number'] : nil
  pslf_status = PslfStatus.from_hash(hash['pslf_status']) if hash['pslf_status']
  repayment_plan = StudentRepaymentPlan.from_hash(hash['repayment_plan']) if
    hash['repayment_plan']
  sequence_number =
    hash.key?('sequence_number') ? hash['sequence_number'] : nil
  servicer_address = ServicerAddressData.from_hash(hash['servicer_address']) if
    hash['servicer_address']
  ytd_interest_paid =
    hash.key?('ytd_interest_paid') ? hash['ytd_interest_paid'] : nil
  ytd_principal_paid =
    hash.key?('ytd_principal_paid') ? hash['ytd_principal_paid'] : 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.
  StudentLoan.new(account_id: ,
                  account_number: ,
                  disbursement_dates: disbursement_dates,
                  expected_payoff_date: expected_payoff_date,
                  guarantor: guarantor,
                  interest_rate_percentage: interest_rate_percentage,
                  is_overdue: is_overdue,
                  last_payment_amount: last_payment_amount,
                  last_payment_date: last_payment_date,
                  last_statement_issue_date: last_statement_issue_date,
                  loan_name: loan_name,
                  loan_status: loan_status,
                  minimum_payment_amount: minimum_payment_amount,
                  next_payment_due_date: next_payment_due_date,
                  origination_date: origination_date,
                  origination_principal_amount: origination_principal_amount,
                  outstanding_interest_amount: outstanding_interest_amount,
                  payment_reference_number: payment_reference_number,
                  pslf_status: pslf_status,
                  repayment_plan: repayment_plan,
                  sequence_number: sequence_number,
                  servicer_address: servicer_address,
                  ytd_interest_paid: ytd_interest_paid,
                  ytd_principal_paid: ytd_principal_paid,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/plaid/models/student_loan.rb', line 144

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['account_number'] = 'account_number'
  @_hash['disbursement_dates'] = 'disbursement_dates'
  @_hash['expected_payoff_date'] = 'expected_payoff_date'
  @_hash['guarantor'] = 'guarantor'
  @_hash['interest_rate_percentage'] = 'interest_rate_percentage'
  @_hash['is_overdue'] = 'is_overdue'
  @_hash['last_payment_amount'] = 'last_payment_amount'
  @_hash['last_payment_date'] = 'last_payment_date'
  @_hash['last_statement_issue_date'] = 'last_statement_issue_date'
  @_hash['loan_name'] = 'loan_name'
  @_hash['loan_status'] = 'loan_status'
  @_hash['minimum_payment_amount'] = 'minimum_payment_amount'
  @_hash['next_payment_due_date'] = 'next_payment_due_date'
  @_hash['origination_date'] = 'origination_date'
  @_hash['origination_principal_amount'] = 'origination_principal_amount'
  @_hash['outstanding_interest_amount'] = 'outstanding_interest_amount'
  @_hash['payment_reference_number'] = 'payment_reference_number'
  @_hash['pslf_status'] = 'pslf_status'
  @_hash['repayment_plan'] = 'repayment_plan'
  @_hash['sequence_number'] = 'sequence_number'
  @_hash['servicer_address'] = 'servicer_address'
  @_hash['ytd_interest_paid'] = 'ytd_interest_paid'
  @_hash['ytd_principal_paid'] = 'ytd_principal_paid'
  @_hash
end

.nullablesObject

An array for nullable fields



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/plaid/models/student_loan.rb', line 179

def self.nullables
  %w[
    account_id
    account_number
    disbursement_dates
    expected_payoff_date
    guarantor
    is_overdue
    last_payment_amount
    last_payment_date
    last_statement_issue_date
    loan_name
    minimum_payment_amount
    next_payment_due_date
    origination_date
    origination_principal_amount
    outstanding_interest_amount
    payment_reference_number
    sequence_number
    ytd_interest_paid
    ytd_principal_paid
  ]
end

.optionalsObject

An array for optional fields



174
175
176
# File 'lib/plaid/models/student_loan.rb', line 174

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/plaid/models/student_loan.rb', line 346

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, account_number:"\
  " #{@account_number.inspect}, disbursement_dates: #{@disbursement_dates.inspect},"\
  " expected_payoff_date: #{@expected_payoff_date.inspect}, guarantor: #{@guarantor.inspect},"\
  " interest_rate_percentage: #{@interest_rate_percentage.inspect}, is_overdue:"\
  " #{@is_overdue.inspect}, last_payment_amount: #{@last_payment_amount.inspect},"\
  " last_payment_date: #{@last_payment_date.inspect}, last_statement_issue_date:"\
  " #{@last_statement_issue_date.inspect}, loan_name: #{@loan_name.inspect}, loan_status:"\
  " #{@loan_status.inspect}, minimum_payment_amount: #{@minimum_payment_amount.inspect},"\
  " next_payment_due_date: #{@next_payment_due_date.inspect}, origination_date:"\
  " #{@origination_date.inspect}, origination_principal_amount:"\
  " #{@origination_principal_amount.inspect}, outstanding_interest_amount:"\
  " #{@outstanding_interest_amount.inspect}, payment_reference_number:"\
  " #{@payment_reference_number.inspect}, pslf_status: #{@pslf_status.inspect},"\
  " repayment_plan: #{@repayment_plan.inspect}, sequence_number: #{@sequence_number.inspect},"\
  " servicer_address: #{@servicer_address.inspect}, ytd_interest_paid:"\
  " #{@ytd_interest_paid.inspect}, ytd_principal_paid: #{@ytd_principal_paid.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/plaid/models/student_loan.rb', line 327

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, account_number: #{@account_number},"\
  " disbursement_dates: #{@disbursement_dates}, expected_payoff_date:"\
  " #{@expected_payoff_date}, guarantor: #{@guarantor}, interest_rate_percentage:"\
  " #{@interest_rate_percentage}, is_overdue: #{@is_overdue}, last_payment_amount:"\
  " #{@last_payment_amount}, last_payment_date: #{@last_payment_date},"\
  " last_statement_issue_date: #{@last_statement_issue_date}, loan_name: #{@loan_name},"\
  " loan_status: #{@loan_status}, minimum_payment_amount: #{@minimum_payment_amount},"\
  " next_payment_due_date: #{@next_payment_due_date}, origination_date: #{@origination_date},"\
  " origination_principal_amount: #{@origination_principal_amount},"\
  " outstanding_interest_amount: #{@outstanding_interest_amount}, payment_reference_number:"\
  " #{@payment_reference_number}, pslf_status: #{@pslf_status}, repayment_plan:"\
  " #{@repayment_plan}, sequence_number: #{@sequence_number}, servicer_address:"\
  " #{@servicer_address}, ytd_interest_paid: #{@ytd_interest_paid}, ytd_principal_paid:"\
  " #{@ytd_principal_paid}, additional_properties: #{@additional_properties}>"
end