==================================================================================================== TEST CASE 1: URL00224 - 50% PAID OFF ==================================================================================================== ==================================================================================================== SIMULATING TOP_UP_PAY_OFF_BALANCE_REQUEST FOR LOAN URL00224 ==================================================================================================== 📋 LOAN INFORMATION: -------------------------------------------------- Loan Number: URL00224 Employee: John Test Doe Check Number: 12345678 Vote: 10 - Ministry of Finance Original Loan Amount: 5,000,000.00 Monthly Payment: 166,666.67 Tenure: 36 months Interest Rate: 12% 📨 ESS MESSAGE 11 DATA (TOP_UP_PAY_OFF_BALANCE_REQUEST): -------------------------------------------------- DeductionAmount (Initial Balance): 6,000,000.00 DeductionBalance (Current Balance): 3,000,000.00 DeductionCode: FL7456 DeductionName: URA SACCOS LTD LOAN 1 PaymentOption: Full Payment 🔧 APPLYING DYNAMIC PAYOFF FORMULA: ==================================================================================================== 📊 STEP 1: Calculate Original Loan Details -------------------------------------------------- ✓ Tenure: 36 months ✓ Original Principal (PV formula): 5,017,917.61 Formula: PV = PMT × [(1 - (1 + r)^-n) / r] Where: PMT = 166,666.67, r = 0.01, n = 36 📊 STEP 2: Calculate Current Outstanding Principal (P) -------------------------------------------------- ✓ Payments Made = (Initial - Remaining) / Monthly = (6,000,000.00 - 3,000,000.00) / 166,666.67 = 18 installments ✓ Outstanding Principal after 18 payments: 2,733,044.82 📊 STEP 3: Apply Dynamic Payoff Formula -------------------------------------------------- Formula: Total Payoff = P + (P × R/365 × D) Where: P = 2,733,044.82 (Outstanding Principal) R = 0.12 (Annual Rate) D = 15 (Days Since Last Payment) ✓ Pro-rated Interest = P × (R/365) × D = 2,733,044.82 × (0.12/365) × 15 = 13,478.03 ✓ Total Payoff = Outstanding Principal + Pro-rated Interest = 2,733,044.82 + 13,478.03 = 2,746,522.85 📤 LOAN_TOP_UP_BALANCE_RESPONSE (Message 12): ==================================================================================================== ResponseCode: 0000 (Success) CheckNumber: 12345678 LoanNumber: URL00224 SettlementAmount: 2,746,522.85 OutstandingBalance: 2,733,044.82 FSPReferenceNumber: FSP88475534 PaymentReferenceNumber: PAY91406037 FinalPaymentDate: 2025-12-18 EndDate: 20270611 ==================================================================================================== TEST CASE 2: URL00224 - NEARLY PAID OFF (90% COMPLETE) ==================================================================================================== ==================================================================================================== SIMULATING TOP_UP_PAY_OFF_BALANCE_REQUEST FOR LOAN URL00224 ==================================================================================================== 📋 LOAN INFORMATION: -------------------------------------------------- Loan Number: URL00224 Employee: Jane Sample Smith Check Number: 87654321 Vote: 28 - Tanzania Police Force Original Loan Amount: 2,000,000.00 Monthly Payment: 71,547.57 Tenure: 30 months Interest Rate: 10% 📨 ESS MESSAGE 11 DATA (TOP_UP_PAY_OFF_BALANCE_REQUEST): -------------------------------------------------- DeductionAmount (Initial Balance): 2,146,427.10 DeductionBalance (Current Balance): 214,642.71 DeductionCode: FL7456 DeductionName: URA SACCOS LTD LOAN 1 PaymentOption: Full Payment 🔧 APPLYING DYNAMIC PAYOFF FORMULA: ==================================================================================================== 📊 STEP 1: Calculate Original Loan Details -------------------------------------------------- ✓ Tenure: 30 months ✓ Original Principal (PV formula): 1,892,221.68 Formula: PV = PMT × [(1 - (1 + r)^-n) / r] Where: PMT = 71,547.57, r = 0.0083333333333333, n = 30 📊 STEP 2: Calculate Current Outstanding Principal (P) -------------------------------------------------- ✓ Payments Made = (Initial - Remaining) / Monthly = (2,146,427.10 - 214,642.71) / 71,547.57 = 27 installments ✓ Outstanding Principal after 27 payments: 211,114.41 📊 STEP 3: Apply Dynamic Payoff Formula -------------------------------------------------- Formula: Total Payoff = P + (P × R/365 × D) Where: P = 211,114.41 (Outstanding Principal) R = 0.1 (Annual Rate) D = 5 (Days Since Last Payment) ✓ Pro-rated Interest = P × (R/365) × D = 211,114.41 × (0.1/365) × 5 = 289.20 ✓ Total Payoff = Outstanding Principal + Pro-rated Interest = 211,114.41 + 289.20 = 211,403.61 📤 LOAN_TOP_UP_BALANCE_RESPONSE (Message 12): ==================================================================================================== ResponseCode: 0000 (Success) CheckNumber: 87654321 LoanNumber: URL00224 SettlementAmount: 211,403.61 OutstandingBalance: 211,114.41 FSPReferenceNumber: FSP20659053 PaymentReferenceNumber: PAY68357262 FinalPaymentDate: 2025-12-18 EndDate: 20260311 ==================================================================================================== TEST CASE 3: URL00224 - JUST STARTED (10% PAID) ==================================================================================================== ==================================================================================================== SIMULATING TOP_UP_PAY_OFF_BALANCE_REQUEST FOR LOAN URL00224 ==================================================================================================== 📋 LOAN INFORMATION: -------------------------------------------------- Loan Number: URL00224 Employee: Peter Demo Johnson Check Number: 11223344 Vote: 15 - Ministry of Health Original Loan Amount: 10,000,000.00 Monthly Payment: 322,134.70 Tenure: 36 months Interest Rate: 8% 📨 ESS MESSAGE 11 DATA (TOP_UP_PAY_OFF_BALANCE_REQUEST): -------------------------------------------------- DeductionAmount (Initial Balance): 11,596,849.20 DeductionBalance (Current Balance): 10,437,164.28 DeductionCode: FL7456 DeductionName: URA SACCOS LTD LOAN 1 PaymentOption: Full Payment 🔧 APPLYING DYNAMIC PAYOFF FORMULA: ==================================================================================================== 📊 STEP 1: Calculate Original Loan Details -------------------------------------------------- ✓ Tenure: 36 months ✓ Original Principal (PV formula): 10,279,899.89 Formula: PV = PMT × [(1 - (1 + r)^-n) / r] Where: PMT = 322,134.70, r = 0.0066666666666667, n = 36 📊 STEP 2: Calculate Current Outstanding Principal (P) -------------------------------------------------- ✓ Payments Made = (Initial - Remaining) / Monthly = (11,596,849.20 - 10,437,164.28) / 322,134.70 = 4 installments ✓ Outstanding Principal after 4 payments: 9,255,302.51 📊 STEP 3: Apply Dynamic Payoff Formula -------------------------------------------------- Formula: Total Payoff = P + (P × R/365 × D) Where: P = 9,255,302.51 (Outstanding Principal) R = 0.08 (Annual Rate) D = 20 (Days Since Last Payment) ✓ Pro-rated Interest = P × (R/365) × D = 9,255,302.51 × (0.08/365) × 20 = 40,571.19 ✓ Total Payoff = Outstanding Principal + Pro-rated Interest = 9,255,302.51 + 40,571.19 = 9,295,873.70 📤 LOAN_TOP_UP_BALANCE_RESPONSE (Message 12): ==================================================================================================== ResponseCode: 0000 (Success) CheckNumber: 11223344 LoanNumber: URL00224 SettlementAmount: 9,295,873.70 OutstandingBalance: 9,255,302.51 FSPReferenceNumber: FSP91972048 PaymentReferenceNumber: PAY60350972 FinalPaymentDate: 2025-12-18 EndDate: 20280811 ==================================================================================================== SUMMARY OF URL00224 PAYOFF CALCULATIONS ==================================================================================================== Test Case | Total Payoff | Outstanding Principal | Pro-rated Interest | Payments Made ---------------------------------------------------------------------------------------------------- 50% Paid | 2,746,522.85 | 2,733,044.82 | 13,478.03 | 18 90% Paid | 211,403.61 | 211,114.41 | 289.20 | 27 10% Paid | 9,295,873.70 | 9,255,302.51 | 40,571.19 | 4 ✅ URL00224 Dynamic Payoff Formula testing completed successfully! The formula correctly calculates payoff amounts for all test scenarios.