Class: InstantQuote::Adapters::CapitalOnTap

Inherits:
InstantQuote::Adapter show all
Defined in:
lib/instant_quote/adapters/capital_on_tap.rb

Constant Summary

Constants inherited from InstantQuote::Adapter

InstantQuote::Adapter::DEFAULT_ADDITIONAL_FIELDS

Instance Method Summary collapse

Methods inherited from InstantQuote::Adapter

#accept_offer, accept_offer, additional_fields, #get_approval, get_approval, get_link, get_preapproval, #get_preapproval, get_quote, get_status

Instance Method Details

The link is always the same for Capital On Tap



92
93
94
# File 'lib/instant_quote/adapters/capital_on_tap.rb', line 92

def get_link(_connection)
  'https://account.capitalontap.com/apps/portal/login/'
end

#get_quote(params, _connection) ⇒ Object

Creates the quote with the information from instant connection



59
60
61
62
63
64
65
66
# File 'lib/instant_quote/adapters/capital_on_tap.rb', line 59

def get_quote(params, _connection)
  response = ::CapitalOnTap::Application.create(params)

  # CoT responses can be 200 OK but still have an error!
  raise_error(response) unless response.success? && !response.error

  response.body[:result]
end

#get_status(application_id, _connection) ⇒ Object

Get the status for a given application ID

 {:locatorId=>'B247T62',
  :applicationStage=>'AppSubmitted',
  :creditDecision=>
   {:status=>'Pending',
    :starRating=>0.0,
    :approvalAmount=>0.0,
    :monthlyInterestRate=>0.0,
    :monthlyCardInterestRate=>0.0,
    :decisionDate=>'2020-01-28T01:44:29.241',
    :creditDecisionReason=>'None'},
:links=>:parent=>nil,
:metaData=>{}

}



83
84
85
86
87
88
89
# File 'lib/instant_quote/adapters/capital_on_tap.rb', line 83

def get_status(application_id, _connection)
  response = ::CapitalOnTap::Application.status(application_id)

  raise_error(response) unless response.success?

  DecisionParsers::CapitalOnTap.new(response.body[:applicationStatus])
end