Basic Quote Calculation¶
A step-by-step guide to calculating a simple insurance quote using EverSharp Quote Extension.
Scenario¶
Calculate a new business quote for:
- Product: Home Contents Insurance
- Base Premium: £450
- Customer Age: 35
- No Claims Years: 3
- Commission Rate: 15%
- IPT Rate: 12%
Complete Script¶
// Step 1: Initialize Pricing Matrix
$SetCurrencyToPricingMatrix("GBP");
$SetCommissionRateToPricingMatrix(0.15);
$SetIptRateToPricingMatrix(0.12);
// Step 2: Add Base Premium
$AddItemToPricingMatrix("Contents Cover", 450.00, 1.0);
// Step 3: Apply No Claims Discount
// 3 years no claims = 10% discount
if (Customer.NoClaimsYears >= 3) {
$AddFactorToPricingMatrix("No Claims Discount", 0.90, true, 0);
}
// Step 4: Add Admin Fee
$SetFeeToPricingMatrix(25.00);
// Step 5: Calculate Final Premium
$CalculatePremiumAdditive("NewBusiness");
// Step 6: Access Results
let totalPremium = Output.Premium;
let monthlyPayment = Output.Monthly.MonthlyPayment;
// Display to customer
$Log("Annual Premium: £" + $ToString(totalPremium));
$Log("Monthly Payment: £" + $ToString(monthlyPayment));
Step-by-Step Breakdown¶
Step 1: Initialize Pricing Matrix¶
$SetCurrencyToPricingMatrix("GBP");
$SetCommissionRateToPricingMatrix(0.15);
$SetIptRateToPricingMatrix(0.12);
What This Does:
- Sets currency to British Pounds
- Configures 15% commission rate
- Configures 12% Insurance Premium Tax (IPT)
State After:
PricingMatrix = {
Currency: "GBP",
CommissionRate: 0.15,
IptRate: 0.12,
Items: [],
Factors: [],
Premium: 0
}
Step 2: Add Base Premium¶
What This Does:
- Adds base premium item: £450
- Quantity: 1.0 (standard)
State After:
Step 3: Apply Discount¶
if (Customer.NoClaimsYears >= 3) {
$AddFactorToPricingMatrix("No Claims Discount", 0.90, true, 0);
}
What This Does:
- Checks if customer has 3+ years no claims
- If yes, applies 10% discount (factor of 0.90)
accumulative: truemeans it multiplies the current premiumapplicability: 0means applies to all items
Calculation:
Step 4: Add Admin Fee¶
What This Does:
- Adds £25 admin fee
- Fee is subject to commission and IPT
Step 5: Calculate Final Premium¶
What This Does:
- Processes all pricing matrix components
- Calculates commission on each item
- Applies IPT
- Generates ledger entries
- Populates Output object
- Calculates monthly payment breakdown
Full Calculation:
Contents Cover (after no claims discount):
Net: £405.00
Commission (15%): £71.47
Gross: £476.47
IPT (12%): £57.18
Total: £533.65
Admin Fee:
Net: £25.00
Commission (15%): £4.41
Gross: £29.41
IPT (12%): £3.53
Total: £32.94
Final Premium: £533.65 + £32.94 = £566.59
Step 6: Access Results¶
let totalPremium = Output.Premium; // £566.59
let monthlyPayment = Output.Monthly.MonthlyPayment; // ~£49.48
Output Structure:
Output = {
Premium: 566.59,
IptApplied: 0.12,
Monthly: {
MonthlyPayment: 49.48,
Deposit: 98.96,
NumberOfPayments: 11,
TotalPayable: 643.24
}
}
Ledger Breakdown¶
The calculation generates these ledger entries:
Ledger = [
{
LedgerSection: "Policy",
EntryType: "Item",
Description: "Contents Cover",
NetAmount: 405.00,
CommissionAmount: 71.47,
TaxAmount: 57.18,
TaxRate: 0.12,
TaxType: "IPT",
GrossAmount: 533.65,
Currency: "GBP",
IsReversal: false
},
{
LedgerSection: "Fee",
EntryType: "Regular",
Description: "Admin Fee",
NetAmount: 25.00,
CommissionAmount: 4.41,
TaxAmount: 3.53,
TaxRate: 0.12,
TaxType: "IPT",
GrossAmount: 32.94,
Currency: "GBP",
IsReversal: false
}
]
Adding Complexity¶
Optional Add-Ons¶
// After base premium, before calculation
// Legal Expenses Cover (optional)
if (Customer.WantsLegalExpenses) {
$AddAddOnToPricingMatrix(
"Legal Expenses", // name
25.00, // net rate
0.15, // commission rate
0.12, // IPT rate
true, // is refundable
true, // discount allowed
false // is full premium MTA (pro-rated)
);
}
// Home Emergency Cover (optional)
if (Customer.WantsHomeEmergency) {
$AddAddOnToPricingMatrix(
"Home Emergency",
45.00,
0.10,
0.12,
true, // is refundable
true, // discount allowed
false // is full premium MTA (pro-rated)
);
}
$CalculatePremiumAdditive("NewBusiness");
Age-Based Pricing¶
// Calculate age
let customerAge = $CalculateAge($Today(), Customer.DateOfBirth);
// Age-based base premium
let basePremium = 450.00;
if (customerAge < 25) {
basePremium = 600.00; // Higher risk
} else if (customerAge > 70) {
basePremium = 550.00; // Elevated risk
}
$AddItemToPricingMatrix("Contents Cover", basePremium, 1.0);
Territory-Based Factors¶
// Apply territory risk factor
if (Customer.PostcodeRisk == "High") {
$AddFactorToPricingMatrix("High Risk Area", 1.35, true, 0);
} else if (Customer.PostcodeRisk == "Low") {
$AddFactorToPricingMatrix("Low Risk Area", 0.85, true, 0);
}
Complete Enhanced Example¶
// Customer data
let Customer = {
DateOfBirth: $ToDate("1988-05-15"),
NoClaimsYears: 5,
PostcodeRisk: "Medium",
ContentsValue: 50000,
WantsLegalExpenses: true,
WantsHomeEmergency: false
};
// Initialize
$SetCurrencyToPricingMatrix("GBP");
$SetCommissionRateToPricingMatrix(0.15);
$SetIptRateToPricingMatrix(0.12);
// Calculate age
let age = $CalculateAge($Today(), Customer.DateOfBirth);
// Age-based pricing
let basePremium = 450.00;
if (age < 25) { basePremium = 600.00; }
else if (age > 70) { basePremium = 550.00; }
// High value adjustment
if (Customer.ContentsValue > 40000) {
basePremium = basePremium * 1.15;
}
$AddItemToPricingMatrix("Contents Cover", basePremium, 1.0);
// No claims discount
if (Customer.NoClaimsYears >= 5) {
$AddFactorToPricingMatrix("No Claims Discount", 0.85, true, 0); // 15% off
} else if (Customer.NoClaimsYears >= 3) {
$AddFactorToPricingMatrix("No Claims Discount", 0.90, true, 0); // 10% off
}
// Territory factor
if (Customer.PostcodeRisk == "High") {
$AddFactorToPricingMatrix("High Risk Area", 1.35, true, 0);
} else if (Customer.PostcodeRisk == "Low") {
$AddFactorToPricingMatrix("Low Risk Area", 0.85, true, 0);
}
// Optional coverages
if (Customer.WantsLegalExpenses) {
$AddAddOnToPricingMatrix("Legal Expenses", 25.00, 0.15, 0.12, true, true, false);
}
if (Customer.WantsHomeEmergency) {
$AddAddOnToPricingMatrix("Home Emergency", 45.00, 0.10, 0.12, true, true, false);
}
// Admin fee
$SetFeeToPricingMatrix(25.00);
// Calculate
$CalculatePremiumAdditive("NewBusiness");
// Results
let result = {
CustomerAge: age,
AnnualPremium: Output.Premium,
MonthlyPayment: Output.Monthly.MonthlyPayment,
Deposit: Output.Monthly.Deposit,
LedgerEntries: $Count(Ledger)
};
$Log("Quote Result", result);
Testing the Quote¶
// Validate premium is within expected range
if (Output.Premium < 100 || Output.Premium > 2000) {
$Log("Warning: Premium outside normal range");
}
// Verify ledger matches output
let ledgerTotal = $Sum($Map(Ledger, fn(e) => e.GrossAmount));
let difference = $Abs(ledgerTotal - Output.Premium);
if (difference > 0.01) {
$Log("Error: Ledger mismatch");
}
// Check monthly payment calculation
let expectedTotal = Output.Monthly.Deposit +
(Output.Monthly.MonthlyPayment * Output.Monthly.NumberOfPayments);
let monthlySumDiff = $Abs(expectedTotal - Output.Monthly.TotalPayable);
if (monthlySumDiff > 0.01) {
$Log("Warning: Monthly payment calculation discrepancy");
}
Next Steps¶
- Midterm Adjustments - Modify existing policies
- Cancellation Scenarios - Handle cancellations
- Underwriting Workflow - Add underwriting logic