Class: InstantQuote::DecisionParsers::CapitalOnTap

Inherits:
InstantQuote::DecisionParser show all
Defined in:
lib/instant_quote/decision_parsers/capital_on_tap.rb

Constant Summary collapse

STATUSES =
{
  pending: 'Pending',
  approved: 'Approved',
  declined: 'Declined',
  could_not_submit: 'CouldNotSubmit' # this is our own status
}.freeze

Instance Attribute Summary

Attributes inherited from InstantQuote::DecisionParser

#data

Instance Method Summary collapse

Methods inherited from InstantQuote::DecisionParser

#loan_started?, #manual_review?, #no_decision_possible?

Constructor Details

#initialize(data = {}) ⇒ CapitalOnTap

Returns a new instance of CapitalOnTap.



15
16
17
18
# File 'lib/instant_quote/decision_parsers/capital_on_tap.rb', line 15

def initialize(data = {})
  @data = super
  @data.delete(:metaData) # remove useless information
end

Instance Method Details

#amountObject



32
33
34
# File 'lib/instant_quote/decision_parsers/capital_on_tap.rb', line 32

def amount
  Money.new(credit_decision[:approvalAmount].to_f * 100).format
end

#approved?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/instant_quote/decision_parsers/capital_on_tap.rb', line 24

def approved?
  status == STATUSES[:approved]
end

#declined?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/instant_quote/decision_parsers/capital_on_tap.rb', line 28

def declined?
  status == STATUSES[:declined]
end

#monthly_card_interest_rateObject



40
41
42
# File 'lib/instant_quote/decision_parsers/capital_on_tap.rb', line 40

def monthly_card_interest_rate
  credit_decision[:monthlyCardInterestRate] || 0.0
end

#monthly_interest_rateObject



36
37
38
# File 'lib/instant_quote/decision_parsers/capital_on_tap.rb', line 36

def monthly_interest_rate
  credit_decision[:monthlyInterestRate] || 0.0
end

#pending?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/instant_quote/decision_parsers/capital_on_tap.rb', line 20

def pending?
  status == STATUSES[:pending]
end

#stageObject

The applicationStage can be one of the following:

Undetermined, AppSubmitted, Referred, KybSoleTrader, KybPartner, IncompleteInfo, FinancialsOverdue, Declined, Duplicate, IdVerificationRequired, ReferredAfterUpdate, ApprovedCredit, ApprovedPrepaid, DdSetup, AddOnSelection, DoneHavFailed, DoneIdVerificationRequired, Done, Portal



54
55
56
# File 'lib/instant_quote/decision_parsers/capital_on_tap.rb', line 54

def stage
  data[:applicationStage] || {}
end

#statusObject



44
45
46
# File 'lib/instant_quote/decision_parsers/capital_on_tap.rb', line 44

def status
  credit_decision[:status] || STATUSES[:could_not_submit]
end