Insurance Calculator Development for 1C-Bitrix
An insurance calculator is a conversion tool with high responsibility: the user makes a financial protection decision based on the figure shown. If the calculator is wrong or gives unrealistic values, the client goes to a competitor. Correct implementation requires precise mathematics, up-to-date rates from the database and a smooth UX that does not overwhelm with the number of questions.
Types of Insurance Products for the Calculator
| Product | Key Parameters | Formula |
|---|---|---|
| MTPL (CTP) | Engine power, region, BMC, experience | Base rate × set of coefficients |
| Comprehensive (CASCO) | Make, model, year, vehicle value, options | Percentage of value with coefficients |
| VHI (voluntary health) | Age, service package, region, number of people | Base rate × age coefficient |
| Real estate | Type, area, wall material, region | Rate × insured sum |
| Life & health | Age, occupation, insured sum, term | Actuarial tables |
Architecture of Rate Tables
Insurance rates change — sometimes several times a year. Hard-coding in PHP is out of the question. Everything is stored in the database.
For simple products — a HighLoad block InsuranceTariffs:
| Field | Type | Description |
|---|---|---|
UF_PRODUCT_TYPE |
Enum | Insurance product type |
UF_PARAM_KEY |
String | Parameter key (region_code, power_from, etc.) |
UF_PARAM_VALUE |
String | Parameter value |
UF_COEFFICIENT |
Float | Coefficient (for multipliers) |
UF_BASE_RATE |
Float | Base rate (for base tariffs) |
UF_VALID_FROM |
Date | Effective date |
UF_VALID_TO |
Date | Expiry date (NULL = indefinite) |
MTPL Calculation: Sample Implementation
MTPL is the most complex calculation due to the large number of central bank coefficients:
namespace MyProject\Services\Calculators;
class OsagoCalculator
{
// Engine power coefficients (Central Bank table)
private const KM_COEFFICIENTS = [
50 => 0.6,
70 => 1.0,
100 => 1.1,
120 => 1.2,
150 => 1.4,
PHP_INT_MAX => 1.6,
];
public static function calculate(
float $baseTariff, // base tariff for the vehicle category
int $horsePower, // engine power
float $kbm, // bonus-malus coefficient (0.5–2.45)
float $kt, // regional coefficient
int $driversCount, // number of drivers
int $minDriverAge, // minimum driver age
int $minDriverExp // minimum driver experience
): array {
$km = self::getPowerCoefficient($horsePower);
$kvs = self::getAgeExpCoefficient($minDriverAge, $minDriverExp);
$ko = $driversCount === 0 ? 1.87 : 1.0; // unlimited drivers
$premium = $baseTariff * $kbm * $kt * $km * $kvs * $ko;
return [
'base_tariff' => $baseTariff,
'premium' => round($premium, 2),
'coefficients' => [
'KBM' => $kbm,
'KT' => $kt,
'KM' => $km,
'KVS' => $kvs,
'KO' => $ko,
],
'valid_days' => 365,
];
}
private static function getPowerCoefficient(int $horsePower): float
{
foreach (self::KM_COEFFICIENTS as $maxPower => $coef) {
if ($horsePower <= $maxPower) {
return $coef;
}
}
return 1.6;
}
private static function getAgeExpCoefficient(int $age, int $experience): float
{
// Central Bank table: age × experience
if ($age < 22 && $experience < 3) return 1.87;
if ($age < 22) return 1.66;
if ($experience < 3) return 1.04;
return 1.0;
}
}
Bonus-Malus (BMC) — Reference Integration
The driver's current BMC should be retrieved from the insurers' union database. Insurance companies integrate with the AIS database via API:
// Retrieving BMC from external API (simplified)
public static function getKbmFromRsa(string $driverLicense, string $birthDate): float
{
$apiUrl = 'https://api.rsa.ru/kbm/';
$response = (new \GuzzleHttp\Client())->post($apiUrl, [
'json' => [
'license' => $driverLicense,
'birthDate' => $birthDate,
'token' => config('rsa_api_token'),
],
]);
$data = json_decode($response->getBody(), true);
return (float)($data['kbm'] ?? 1.0);
}
If integration with the registry is not possible — the calculator accepts BMC from the user (insurance class) with a correction during policy issuance.
Online Policy Issuance
After the calculation — a form to receive the policy:
- The user confirms the calculation and enters data (passport, vehicle documents)
- Data is passed to the CRM (Bitrix24 or the built-in CRM module)
- A manager verifies and issues an invoice
- Payment via payment gateway (YooKassa, CloudPayments)
- Policy is sent by email via
\Bitrix\Main\Mail\Event
Regular Rate Updates
Insurance rates are updated through the admin interface. For critical data (central bank base rate) — import from an XML file via a Bitrix agent:
// Rate update agent
function updateInsuranceTariffs(): string
{
$xml = simplexml_load_file('https://cbr.ru/insurance/tariffs.xml');
// parse and update in the HL block
TariffUpdater::importFromCbr($xml);
return '\updateInsuranceTariffs();'; // schedule next run
}
Timelines
| Task | Timeline |
|---|---|
| Simple calculator (1 product, manual rates, application form) | 1–1.5 weeks |
| MTPL calculator with central bank coefficients, rates in DB, CRM integration | 3–5 weeks |
| Full insurance calculator (multiple products, registry integration, online issuance) | 2–4 months |
An insurance calculator is a public commitment to the client. The figure displayed on screen must correspond to the real cost of the policy. A discrepancy "due to additional conditions" destroys trust and leads to abandoned applications.







