Skip to content

New module: BuyNowPayLater.fs — zero-interest instalments and deferred payment#61

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/add-buynowpaylater-module
Draft

New module: BuyNowPayLater.fs — zero-interest instalments and deferred payment#61
Copilot wants to merge 4 commits into
mainfrom
copilot/add-buynowpaylater-module

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 28, 2026

Adds a BuyNowPayLater module to model 0%-interest instalment ("pay in 3 / pay in 12") and deferred payment ("pay later") products, along with the prerequisite Apr.CalculationMethod.Disabled case for products where a conventional APR is not applicable.

Apr.CalculationMethod.Disabled (Apr.fs)

  • New DU case; calculate returns Solution.Impossible, toPercent returns Percent 0m explicitly
  • HTML label: "disabled"

BuyNowPayLater module (src/BuyNowPayLater.fs)

Types

  • FundingModelRetailerFunded | LenderFunded (who absorbs the 0% cost)
  • InstalmentConfig — equal-payment instalment product; carries PenalInterestRate for use when a missed payment is detected
  • DeferredConfig — deferred payment product; AccrueInterestDuringDeferral flag distinguishes true 0%-deferred from deferred-interest variants

Factory functions — all set AprMethod = Disabled and StandardRate = Zero:

// "pay in 3" — equal monthly payments, no interest
let config: InstalmentConfig = {
    InstalmentCount = 3
    UnitPeriodConfig = Monthly(1, 2024, 4, 1)
    PenalInterestRate = Interest.Rate.Annual(Percent 39.99m)
    FundingModel = FundingModel.RetailerFunded
}
let p = instalmentParameters startDate principal config
let schedule = calculateBasicSchedule p.Basic  // zero interest, zero APR

// "pay later in 90 days" with deferred interest
let config: DeferredConfig = {
    DeferralPeriodDays = 90<DurationDay>
    AccrueInterestDuringDeferral = true   // interest waived via promotional zero-rate if paid on time
    DeferredRate = Interest.Rate.Annual(Percent 34.9m)
    PostDeferralRate = Interest.Rate.Annual(Percent 34.9m)
    FundingModel = FundingModel.LenderFunded
}
let p = deferredParameters startDate principal config
// advanced params include promotional Rate.Zero covering the full deferral period

For deferred-interest products, deferredAdvancedParameters injects a PromotionalRate of Zero spanning the entire deferral window (including the payment day), so on-time amortisation shows zero net interest. The PostDeferralRate / PenalInterestRate are stored in config for callers to apply via PromotionalRates after a missed payment is detected.

Copilot AI changed the title [WIP] Add new module for BuyNowPayLater with zero-interest instalments New module: BuyNowPayLater.fs — zero-interest instalments and deferred payment Apr 28, 2026
Copilot AI requested a review from simontreanor April 28, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New module: BuyNowPayLater.fs (zero-interest instalments and deferred payment)

2 participants