Solaris.Lending.ConsumerLoans (Solaris v1.0.0)

Copy Markdown View Source

Consumer loan application and origination flow.

Application Flow

1. (Optional) Get anonymous offer to show preliminary rate
2. Create application  triggers credit scoring
3. (Optional) Link account snapshot for final credit check
4. (Optional) Upload purchase contract for financed goods
5. Review offers  download SECCI pre-contract PDF (required by law)
6. (Optional) Subsidize an offer to reduce interest rate
7. Retrieve final contract PDF  present to customer for e-signing
8. PUT consumer_loan  creates loan and initiates payout

Per EU Consumer Credit Directive, the SECCI pre-contract document must be shown to the customer before they sign. Always call get_secci/3 and present it before proceeding to contract signing.

Webhook

Monitor CONSUMER_LOAN_APPLICATION for status transitions:

  • OFFERED — offers available for review
  • ACCOUNT_SNAPSHOT_REQUIRED — snapshot needed for final scoring
  • REJECTED — application declined
  • LOAN_CREATED — loan issued, payout initiated

Summary

Functions

Creates a consumer loan application for a person.

Creates the loan and initiates payout.

Returns a non-binding loan offer based on self-declared financial info.

Retrieves a consumer loan application.

Downloads the final loan contract PDF for e-signing.

Downloads the SECCI pre-contract PDF for a loan offer.

Returns representative 2/3 interest rates per loan term (regulatory disclosure).

Links an account snapshot to the application for final credit scoring.

Skips the account snapshot step in the application.

Subsidizes a loan offer to reduce the interest rate.

Uploads a purchase contract for a financed good (e.g. hire-purchase).

Functions

create_application(person_id, attrs, opts \\ [])

@spec create_application(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Solaris.Error.t()}

Creates a consumer loan application for a person.

Triggers credit scoring. Monitor CONSUMER_LOAN_APPLICATION webhook for status transitions.

Required fields

  • :amount — loan amount in cents
  • :currency — e.g. "EUR"
  • :term_months — loan term in months
  • :purpose — loan purpose code

Examples

{:ok, application} = Solaris.Lending.ConsumerLoans.create_application("cper_123", %{
  amount: 10_000_00,
  currency: "EUR",
  term_months: 36,
  purpose: "CONSUMER_GOODS"
})

create_loan(person_id, application_id, attrs, opts \\ [])

@spec create_loan(String.t(), String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Solaris.Error.t()}

Creates the loan and initiates payout.

This is the final step — after the customer has reviewed the SECCI and signed the contract. Sets application status to loan_created.

Examples

{:ok, loan} = Solaris.Lending.ConsumerLoans.create_loan(
  "cper_123",
  "capp_456",
  %{offer_id: "coffer_789", signing_id: "csign_012"}
)

get_anonymous_offer(attrs, opts \\ [])

@spec get_anonymous_offer(
  map(),
  keyword()
) :: {:ok, map()} | {:error, Solaris.Error.t()}

Returns a non-binding loan offer based on self-declared financial info.

No person record required — useful for pre-qualification UX.

Examples

{:ok, offer} = Solaris.Lending.ConsumerLoans.get_anonymous_offer(%{
  amount: 5_000_00,
  currency: "EUR",
  term_months: 24,
  monthly_income_cents: 300_000,
  employment_status: "EMPLOYEE"
})

get_application(person_id, application_id, opts \\ [])

@spec get_application(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Solaris.Error.t()}

Retrieves a consumer loan application.

get_contract(person_id, application_id, offer_id, opts \\ [])

@spec get_contract(String.t(), String.t(), String.t(), keyword()) ::
  {:ok, binary()} | {:error, Solaris.Error.t()}

Downloads the final loan contract PDF for e-signing.

Only available after SECCI has been presented.

get_secci(person_id, application_id, offer_id, opts \\ [])

@spec get_secci(String.t(), String.t(), String.t(), keyword()) ::
  {:ok, binary()} | {:error, Solaris.Error.t()}

Downloads the SECCI pre-contract PDF for a loan offer.

Required by EU Consumer Credit Directive — must be shown to the customer before they sign the loan contract.

Examples

{:ok, pdf_binary} = Solaris.Lending.ConsumerLoans.get_secci(
  "cper_123",
  "capp_456",
  "coffer_789"
)

File.write!("secci.pdf", pdf_binary)

get_two_thirds_rates(opts \\ [])

@spec get_two_thirds_rates(keyword()) :: {:ok, map()} | {:error, Solaris.Error.t()}

Returns representative 2/3 interest rates per loan term (regulatory disclosure).

Examples

{:ok, rates} = Solaris.Lending.ConsumerLoans.get_two_thirds_rates()

skip_account_snapshot(person_id, application_id, opts \\ [])

@spec skip_account_snapshot(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Solaris.Error.t()}

Skips the account snapshot step in the application.

Use when the customer declines to share account data.

subsidize_offer(person_id, application_id, offer_id, attrs, opts \\ [])

@spec subsidize_offer(String.t(), String.t(), String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Solaris.Error.t()}

Subsidizes a loan offer to reduce the interest rate.

Partners can subsidize offers to make them more attractive, taking on part of the interest cost.

upload_purchase_contract(person_id, application_id, file_data, opts \\ [])

@spec upload_purchase_contract(String.t(), String.t(), binary(), keyword()) ::
  {:ok, map()} | {:error, Solaris.Error.t()}

Uploads a purchase contract for a financed good (e.g. hire-purchase).