Developing an insurance calculator using 1C-Bitrix

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

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:

  1. The user confirms the calculation and enters data (passport, vehicle documents)
  2. Data is passed to the CRM (Bitrix24 or the built-in CRM module)
  3. A manager verifies and issues an invoice
  4. Payment via payment gateway (YooKassa, CloudPayments)
  5. 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.