Architecture
System Context
Payment and collections
4 cloudwatch jobs are responsible for handling collections in the loc service: 1. upcoming - handles payments that are due in x days, notifies the user 2. overdue - handles payments that are due before the day of the job, notifies the user 3. retry - handles payments marked as retried, initiates a collection event 4. due - handles payments that are due today, notifies the user — if the user has auto pay enabled, it will initiate a collection event — sends the user a notification of pre payment initiation
a collection can also be initiated by the user by making a payment through the app - if the user has auto-pay disabled this is the only way a user will be repaying their loan - a collection event will be initiated and the user will be sent a payment initiated notification
each collection event is handled collections-worker lambda which submits a payment to the payments service - if the payment is successful, it will update the payment status in the database - if the payment fails, and it was an autopayment it will update the payment status to retry - sends an email/receipt to the user
Diagram below contains the architecture of the loc service payment handling


