Add Salary Advance Zero-Interest Modeling Module #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Introduces zero-interest Salary Advance / Earned Wage Access modeling under:
FSharp.Finance.Personal.SalaryAdvanceFocus: construct repayment schedules, handle fee treatments, expose provider-perspective cashflows.
Module Overview
src/SalaryAdvance.fsTypes:
RepaymentMode = LumpOnFirstPayroll | EvenlyProrated | Custom of int64<Cent> listFee = NoFee | Flat of int64<Cent> | Percentage of decimal(0 < p < 1)FeeTreatment = NettedFromProceeds | AddedOnTopBuildConfigSalaryAdvanceResultPrimary function:
build : BuildConfig -> SalaryAdvanceResultHelper:
borrowerCashflows(sign inversion for borrower perspective analysis)Fee & Principal Logic
Principal equals the sum of scheduled repayments so amortisation alignment is preserved.
Fee rounding: percentage fee → multiply advance amount, round up fractional cent.
Validations
AdvanceDateRepayment Allocation
Cashflow Convention
Provider perspective:
(AdvanceDate, -netDisbursed)Borrower-facing analytics: use
borrowerCashflowsto invert signs.APR Handling
Reuses
Apr.CalculationMethod.UnitedKingdom 2placeholder (no interest).Potential future addition:
AprMethod.Disabledfor clarity on zero-interest products.Tests
Planned / to be ensured:
Test_Lump_Netted_NoFeeTest_Prorated_PercentageFee_AddedOnTopTest_CustomMismatch_ShouldFailAll validate principal, fee handling, sum consistency, and failure modes.
Documentation
docs/exampleSalaryAdvance.fsx:Checklist
Open Questions
Apr.CalculationMethod.Disabledlater?Non-Goals (This PR)
Disclaimer
Analytical only; validate independently for production, compliance, or disclosure usage.