UNPKG

omnipay-savings-sdk

Version:

Omnipay Savings SDK

44 lines (43 loc) 1.56 kB
import { FrequencyType } from './types'; /** * Interface for savings calculation parameters */ export interface SavingsCalculationParams { savingsTarget: number; selectedFrequency: FrequencyType; startDate: Date; endDate: Date; annualInterestRate: number; isInterestDisabled?: boolean; currentBalance?: number; } /** * Interface for periodic amount calculation parameters */ export interface PeriodicAmountParams { periodicAmount: number; selectedFrequency: FrequencyType; startDate: Date; endDate: Date; annualInterestRate: number; isInterestDisabled?: boolean; currentBalance?: number; } /** * Calculate final balance with compound interest * Interest accrues daily but compounds monthly (on the 1st of each month) */ export declare const calculateFinalBalanceWithCompoundInterest: (params: PeriodicAmountParams) => number; /** * Calculate total interest earned over the savings period */ export declare const calculateProjectedInterestEarnings: (params: PeriodicAmountParams) => number; /** * Calculate the required periodic amount to reach a savings target, considering compound interest * Uses binary search to find the optimal periodic amount */ export declare const calculateRequiredPeriodicAmountWithInterest: (params: SavingsCalculationParams) => number; /** * Simple calculation without interest (for backward compatibility) */ export declare const calculateRequiredPeriodicAmountSimple: (params: Omit<SavingsCalculationParams, 'annualInterestRate' | 'isInterestDisabled'>) => number;