Skip to content

Linking Events to Insurance ​


1. Application Created/Saved ​

Since insurance is linked to an application when created

  • Routing Key: core.entity.loanapplication.save
  • Event Type: LOANAPPLICATION_SAVE (in header and message body)
  • long id: application id
  • Modification Type: CREATED

Methods:

  • POST /main/loan-apps
  • GET /main/loan-apps/init/client-id/{clientId} (Initialize new application)

2. Insurance Creation ​

After the application is created - insurance is created with a link to the application.

  • Routing Key: core.entity.insurance.save
  • Event Type: INSURANCE_SAVE (in header and message body)
  • long id: insurance id
  • Modification Type: CREATED

Method: POST /main/insurance

Parameters:

json
{
  "loanApplicationId": 6943,
  "insuranceProgramId": 10,
  "amount": 1000,
  "cost": null,
  "creationDate": "2025-08-26T14:27:43.000Z",
  "expirationDate": "2025-09-26T14:27:43.000Z",
  "code": "001608",
  "includeInLoanAmount": false,
  "premium": 1.25,
  "smsCode": "",
  "signed": false,
  "signDate": 1756218000,
  "newExpirationDate": null,
  "terminationDate": null,
  "type": "LifeInsurance"
}

The type field contains the insurance type, one of CivilLiabilityInsurance, ExtAutoInsurance, LifeInsurance. Application ID and insurance program ID are required.


3. Application Status Change ​

After insurance is created, the application is approved, the event is transmitted with a status change.

Event:

  • Event Type: LOANAPPLICATION_STATUS_CHANGE
  • Message body: {"eventType":"LOANAPPLICATION_STATUS_CHANGE","id":6943,"status":"IN_CONSIDERATION"}

For status IN_CONSIDERATION - POST /bs-core/main/loan-apps/{loanApplicationId}/accept-in-consideration - application review stage.


4. Sequential Status Changes ​

All status change events are transmitted in sequence.

  • Event Type: LOANAPPLICATION_STATUS_CHANGE
  • Message body: {"eventType":"LOANAPPLICATION_STATUS_CHANGE","id":6943,"status":"AUTO_VERIFICATION"}

AUTO_VERIFICATION – automatic verification (POST /bs-core/main/loan-apps/{loanApplicationId}/accept-in-consideration).

Application status change events end with a contract creation event:

  • Message body: {"eventType":"LOANAPPLICATION_STATUS_CHANGE","id":6943,"status":"CONTRACT"}

"status":"CONTRACT" – GET /bs-core/main/contracts/init/loan-app-id/{loanApplicationId} (Initialize new contract).


5. Credit Contract Creation ​

A credit contract is created for the application.

  • Event Type: CONTRACT_SAVE
  • Message body: {"eventType":"CONTRACT_SAVE","id":4553,"modificationType":"CREATED"}
  • Method: POST /bs-core/main/contracts

6. Insurance Update ​

After that, an insurance update (change) event is generated, at this point the insurance is assigned contractId and insuranceAccountId.

  • Event Type: INSURANCE_SAVE
  • Message body: {"eventType":"INSURANCE_SAVE","id":245,"modificationType":"UPDATED"}
  • Method: PUT /main/insurance/{id}

When the insurance is assigned insuranceAccountId, the wallet creation method by insurance ID is triggered: POST /main/insurance/{id}/account (no parameters are passed).

Response example:

json
{
  "id": 4554,
  "name": "",
  "creationDate": "2025-08-26",
  "issueDate": null,
  "closeDate": null,
  "branchId": 101301,
  "subdivisionId": 101791,
  "clientId": 3244,
  "contractLine": {
    "id": 4535,
    "lineLimit": null
  },
  "contractTypeId": 101916,
  "createUserId": 1334,
  "createSubdivisionId": 101791,
  "relatedInsuranceId": 245
}

7. Saving Cash Flow (Income) ​

Cash flow income on the Insurance object – Immediate accrual and repayment of insurance occurs, the event is transmitted – Saving Cash Flow.

  • Event Type: FUNDTRANSACTION_SAVE
  • Message body: {"eventType":"FUNDTRANSACTION_SAVE","id":3728,"contractId":4554}
  • Method: POST /bs-core/main/fund-transactions

contractId here equals insuranceAccountId. When passing parameters, specify the id from insuranceAccountId in "contractId".


8. Wallet Contract Issuance ​

An event is transmitted for Contract Issuance with type 101916 Insurance Accounting (type is not displayed in the event).

  • Event Type: CONTRACT_ISSUE
  • Message body: {"eventType":"CONTRACT_ISSUE","id":4554}
  • Method: POST /bs-core/main/fund-transactions/{id}/autoaccept (Apply auto-accept to cash flow).

9. Balance Change (Accrual) ​

After the contract (insurance wallet) is issued, a balance change event is transmitted, since an "Accrual" operation occurs after auto-accept.(Process: Insurance accrual -> Accrual document for insurance -> Amount type: Insurance -> Movement type: Accrual)

  • Event Type: CONTRACT_BALANCE_CHANGED
  • Message body: {"eventType":"CONTRACT_BALANCE_CHANGED","contractId":4554,"amountTypeIds":[10129158,10129159],"operations":[{"id":38433,"operDate":1756222558000},{"id":null,"operDate":1756222558000}]}

10. Wallet Contract Closure ​

A Contract (wallet) Closure event is transmitted, since after cash flow, Accrual and Repayment of the entire amount occur simultaneously.

  • Event Type: CONTRACT_CLOSE
  • Message body: {"eventType":"CONTRACT_CLOSE","id":4554,"closedStatusId":null,"closeDate":1756155600000}
  • Method: PUT /main/contract/{id} ("closeDate" parameter is passed)

11. Balance Change (Repayment) ​

A balance change event is transmitted, since when the contract (wallet) is closed, the balance changed and became zero upon repayment.(Process: Insurance repayment -> Repayment document for insurance -> Amount type: Insurance -> Movement type: Repayment)

  • Event Type: CONTRACT_BALANCE_CHANGED
  • Message body: {"eventType":"CONTRACT_BALANCE_CHANGED","contractId":4554,"amountTypeIds":[1012911,10129158,10129159],"operations":[{"id":null,"operDate":1756222558000},{"id":38434,"operDate":1756222558000},{"id":null,"operDate":1756222558000}]}

12. Wallet Contract Repayment ​

A repayment event is transmitted, since the contract (wallet) is actually closed with a zero balance.(Process: Insurance repayment -> Repayment document for insurance -> Amount type: Insurance -> Movement type: Repayment)

  • Event Type: CONTRACT_REPAYMENT
  • Message body: {"eventType":"CONTRACT_REPAYMENT","contractId":4554,"amountTypeIds":[10129158,10129159],"operations":[{"id":38434,"operDate":1756222558000},{"id":null,"operDate":1756222558000}]}