The credit union maintains a default debit interest rate and a default credit interest rate. These rates are use to calculate interest paid and interest earned on member accounts. The interest module must maintain the rates, and keep historic data of all rate changes.
The interest module must automatically apply interest, DR & CR, on a monthly basis to each member account. The interest is calculated daily and accumulated for the period since the previous interest rate run or date of account opening, whichever is the most recent.
Calculation logic as follows:
for each member-account(i).interest-bearing
with member-account(i)
if .int-last-processed < .opened-on then .int-last-processed = .opened-on
for each day between .interest-last-processed and today()
interest += .balance * iff(balance>0, dr-int-rate, cr-int-rate)/365
member-account(i).post-dbl-entry() //see below
member-account(i).int-last-processed = today()
When ever the an interest rate change is applied, then interest must be atomically and automatically calculated and applied prior to prior to the rate change to all member accounts.
The posting of interest follows the following basic transaction posting format:
function post-dbl-entry( dr-account, dr-txn-code, cr-account, cr-txn-code, amount,
dr-reference, cr-reference, txn-sequence-number)
//self explanatory...
Lastly, the interest module must accommodate the generic principles of a loading/discount for both DR and Cr interest rates on an exceptional account by account basis. For example, it must be possible to apply a dr-int-rate +2% or a cr-int-rate-1.75% for any particular or group of accounts.





