Skip to content

Instantly share code, notes, and snippets.

@RichardOrnelas
Created February 22, 2023 20:47
Show Gist options
  • Save RichardOrnelas/85a151dc99ef8368cdec933abaf8497b to your computer and use it in GitHub Desktop.
Save RichardOrnelas/85a151dc99ef8368cdec933abaf8497b to your computer and use it in GitHub Desktop.
Fees v0 Tech Spec

Fees v0 Tech Spec

References

https://developer.authorize.net/api/reference/index.html

Summary

Track and charge fees to borrowers via the Borrower Portal. We will leverage Authorize.net as a partner for the charging of the credit and settlement of the money into our merchant account.

Technical Questions

  1. Integration in with Auth.net should live in the Backend, Fronted, or Both ? Lean toward FE for keeping credit info out of backend.
  2. Do we store individual charge attempts?
  3. How do we handle refunds?
  4. How do we reconcile transactions?
  5. How do we want to interact with Authorize.net? (simple, pre-auth, customer profile)

Stories

  • An Invoice should house N number of Fees
  • Fees hold all of the information specific to the fee itself, while Invoice stores all of the borrower interaction data.
  • Invoice has a state machine from initiated to Charged or Paid
  • DO NOT STORE CREDIT CARDS
  • As a borrower, I should pay invoices through the FE
  • As a loan officer, I should be able to create invoices made of N fees.
  • As an admin, I should be able to create new Fee types
  • In backend, I should see a list of Fees and invoices per loan
  • An Invoice could have many “Charge Attempts”
  • As a borrower, I should see a list of past paid invoices in my completed tasks
  • As a borrower, I should be able to mark the invoice “disputed”
  • As a borrower I should be able to download the invoices

Data Models

Invoice

  • Has Many Fees.
  • Has a state machine that watches the lifecycle of an invoice
  • Has a due date/late date
  • Can be cancelled
  • Has a payee

Fee

  • Single-Table Inheritance model where each fee is a submodel
  • Fees get instantiated and stored relationally to the invoice.
  • Uniqueness Constraints to prevent over charging or forgetting complimentary fees/processing.
  • has_many line items, or times this fee was invoiced

Line Item

  • Line Item represents an instance of a fee on an invoice.
  • Line Item can exist multiple times on the same invoice.
  • Line Item is editable, getting it's default values from the corresponding Fee
  • belongs to a fee
  • belongs to invoice

Views

New Views

  • Create an invoice form
  • Loan Show list of invoices
  • Single invoice (pdf?)
  • Add fee to invoice
  • Delete fee from invoice (guarded)
  • Send invoice

Update Views

  • Invoices added to Task list
  • View Invoice
  • charge credit card screen
  • view past invoices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment