Refunds in our system operate similarly to payments but in reverse, following a "refund pouring" algorithm that ensures proper allocation of funds back to the borrower.
While payments (depending on the line or loan's payment pouring policy) prioritize reducing fees, interest, and then principal, refunds pour in the opposite order: principal first, followed by interest, and finally fees. This approach maintains accurate accounting and prevents refunds from unintentionally covering outstanding fees or interest, which could distort financial records.
Therefore, the refund pouring logic is the inverse of the lender's payment pouring methodology, ensuring consistency and alignment with the lender's policies. This structured approach guarantees transparency, compliance, and fairness in handling refunds throughout the lifecycle of a line or loan.