Docs

Docs

  • Support

›Home SDK

Ticket Cancellation SDK

  • Introduction
  • Configuration
  • Insurance Recommendation
  • Finalise Purchase
  • Example

Ticket Cancellation API

  • Quote
  • Policy

Device SDK

  • Introduction
  • Configuration
  • Insurance Recommendation
  • Finalise Purchase

Device API

  • Quote
  • Policy

Home SDK

  • Introduction
  • Configuration
  • Insurance Recommendation
  • Finalise Purchase

Home API

  • Quote
  • Policy

Travel SDK

  • Introduction
  • Configuration
  • Insurance Recommendation
  • Finalise Purchase

Travel API

  • Configuration Params
  • Quote
  • Quote by Product
  • Policy

Authentication

  • Authentication

Support

  • Support

Notifications

  • Get notified

Insurance Recommendation

Passing cart items

At the point when you want to request an insurance offer pass the following parameters to the SDK. Make sure to repeat this step every time when one of the parameters gets updated (e.g. the address of the real estate has changed).

vern.homes([{
    start: '2019-09-01T17:00:00.000Z',
    end: '2019-09-01T19:00:00.000Z',
    address: '1052 Budapest Kossuth Lajos utca 12.',
    ownership: 'owned',
    area: 101,
    roof: 'slate',
    wall: 'brick',
    constructionYear: 1911,
    currency: 'HUF'
}]);

Where:

  • currency: currency code the offer should be returned in (currently only HUF is allowed)
  • start: start date of the event as UTC ISO8601 string (eg: 2019-04-11T13:03:54.002Z)
  • end: end date of the event as UTC ISO8601 string (eg: 2019-04-11T15:03:54.002Z)
  • ownership: type of ownership, either owned or rented
  • area: area of the real estate in m2
  • roof: type of the roof, either plate,slate,tile,bitumen_plate,other,reeds or wood
  • wall: type of the wall, either mixed,lightweight,wood,brick,stone,concrete or other
  • constructionYear: year the real estate was built

Note: don't forget to wait until the SDK is ready.

Loading a recommendation

The Vern backend will attempt to find a recommended configuration for the given contents of the cart. At the start of this process, the SDK fires the quote.requested event, in order to make the display of a loading state available.

Although this step improves the user experience, it is only optional.

vern.on('quote.requested', function() {
    console.log('Display loading bar');
});

Display available recommendation

This event fill be fired when there is an available insurance for the current cart:

vern.on('quote.create.succeeded', function(insurance) {
    console.log(insurance.price, insurance.currency);
});

In the callback you'll receive an object with the following structure:

{
    "price": 1340, // price of the insurance
    "currency": "HUF" // currency of the insurance
}

Once you receive an available insurance you can either automatically choose it or let the user decide whether they want activate it.

vern.on('quote.create.succeeded', function(insurance) {
    vern.open();
});

or

vern.on('quote.create.succeeded', function(insurance) {
    var activateButton = document.createElement('button');
    activateButton.addEventListener('click', () => vern.open(), false);
});

If you are a Vern partner, we will also provide you a ready-made example component to display and select the insurance.

Store the recommendation

After the insurance modal was activated and the customer filled out all the required information, the SDK will fire the quote.configured event and you can add the insurance to the cart.

Please note that the vern.homes() event shouldn't be called this time!

vern.on('quote.configured', function(insurance) {
    storeOnBackend(insurance.quoteId)
});

The quote is an identifier of the created recommendation which you should store on your backend and let us know once the order on your side has been fulfilled.

Delete recommendation from the cart (optional)

If the user decides to remove the insurance from the cart, you have to call vern.remove(), so we can invalidate the created recommendation.

Control the modal (optional)

In any case if you have to control the display of the insurance modal from the content, you can call vern.open() to open, and vern.close() to close the modal. Be aware that force closing the modal might result in loss of entered input.

← ConfigurationFinalise Purchase →
  • Passing cart items
  • Loading a recommendation
  • Display available recommendation
  • Store the recommendation
  • Delete recommendation from the cart (optional)
  • Control the modal (optional)
Docs
Docs
SDK
Copyright © 2019 Vernsurance