Class: InstantQuote::DecisionParsers::Youlend
- Inherits:
-
InstantQuote::DecisionParser
- Object
- InstantQuote::DecisionParser
- InstantQuote::DecisionParsers::Youlend
- Defined in:
- lib/instant_quote/decision_parsers/youlend.rb
Overview
Example response:
Details response merged with optional offers { "details": { "leadSourceLendingPartnerId": "2487faad-24c3-40ed-8e63-f4551555116a", "onboardingState": "offersProvided", "onboardingStateReason": "", "organisationDetailsStepComplete": true, "paymentDataStepComplete": true, "offerStepComplete": false, "kycDocumentsStepComplete": true, "companyName": "SATURDAY LTD", "leadType": "Api", "signingDetails": { "eligibleForInstantSigning": false, "instantSigningDetails": null } }, "offers": { "leadId": "5c35a9f4-436e-47b9-a31c-b55f5881f8be", "previousAcceptedOffer": null, "providedOffers": [ { "offerId": "12cfda2b-cfb6-4d79-bd16-2979ed6a069a", "youWillGet": 6000, "youWillRepay": 7020, "currencyISOCode": "GBP", "sweep": 20, "minimumWeeklyRepayment": 150.28, "daysUntilRepayment": 218, "maturityDate": "2024-06-26T16:42:15.038Z" }, { "offerId": "2d93cb8b-7e3b-4c87-87cf-40e2f7e226e3", "youWillGet": 6500, "youWillRepay": 7735, "currencyISOCode": "GBP", "sweep": 20, "minimumWeeklyRepayment": 150.4, "daysUntilRepayment": 240, "maturityDate": "2024-07-29T16:42:15.038Z" }, { "offerId": "f2ef06ef-0c29-418c-ad93-d7abdee5994e", "youWillGet": 7000, "youWillRepay": 8470, "currencyISOCode": "GBP", "sweep": 20, "minimumWeeklyRepayment": 150.1, "daysUntilRepayment": 263, "maturityDate": "2024-09-02T16:42:15.038Z" } ], "acceptedOffer": null, "unsignedLoanDocument": null, "unsignedLoanDocumentDownloaded": false, "documentSigningId": "00000000-0000-0000-0000-000000000000", "sortCode": null, "accountNumber": null, "swift": null, "iban": null, "bankName": null, "confirmedCompanyAccount": false, "minFundingAmount": 0, "maxFundingAmount": 0 } }
Constant Summary collapse
- APPROVED_STATES =
%w[offersProvided offerAccepted contractgenerated contractsigned]
Instance Attribute Summary
Attributes inherited from InstantQuote::DecisionParser
Instance Method Summary collapse
- #approved? ⇒ Boolean
- #declined? ⇒ Boolean
- #fee ⇒ Object
- #funded_amount ⇒ Object (also: #amount)
- #incomplete? ⇒ Boolean
- #loan_amount ⇒ Object
- #offer_id ⇒ Object
- #pending? ⇒ Boolean
- #submitted? ⇒ Boolean
- #sweep ⇒ Object
Methods inherited from InstantQuote::DecisionParser
#initialize, #loan_started?, #manual_review?, #no_decision_possible?
Constructor Details
This class inherits a constructor from InstantQuote::DecisionParser
Instance Method Details
#approved? ⇒ Boolean
79 80 81 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 79 def approved? APPROVED_STATES.include?(status) && loan_offer.present? end |
#declined? ⇒ Boolean
83 84 85 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 83 def declined? !(approved? || incomplete? || submitted? || pending?) end |
#fee ⇒ Object
117 118 119 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 117 def fee Money.new(raw_fee_amount * 100).format end |
#funded_amount ⇒ Object Also known as: amount
113 114 115 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 113 def funded_amount Money.new(raw_funded_amount * 100).format end |
#incomplete? ⇒ Boolean
95 96 97 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 95 def incomplete? status == 'stage1incomplete' end |
#loan_amount ⇒ Object
109 110 111 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 109 def loan_amount Money.new(raw_loan_amount * 100).format end |
#offer_id ⇒ Object
121 122 123 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 121 def offer_id loan_offer[:offerId] end |
#pending? ⇒ Boolean
87 88 89 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 87 def pending? data.nil? || data.empty? end |
#submitted? ⇒ Boolean
91 92 93 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 91 def submitted? status == 'stage1submitted' end |
#sweep ⇒ Object
99 100 101 102 103 |
# File 'lib/instant_quote/decision_parsers/youlend.rb', line 99 def sweep return '-' unless approved? loan_offer[:sweep] end |