New Business (Iframe)

New Business (Iframe)

The 'New Business flow with Iframe', allows an integration partner to embed an iframe at the end of their normal question flow. This allows the gathering of finance specific data while minimizing required changes.

This does not completely remove the need to post policy data via API.

The general flow is as follows:

  1. Post setup and policy data
  2. Receive iframe link (and display to user)
  3. Receive response from iframe

Value

Method

POST

URL

/newbusinesssetup

Initial Setup

As closely as possible, the fields in this request resemble those set out in the BNP documentation, including field lengths and allowed values.

Some guidelines are provided below to help with constructing the request.

Section/Field

Description

Application

Subset of the BNP Application section

Policy

Complete BNP policy section

Customer

Subset of the BNP Customer section

Finance

Detail for declaration and providing customer final pricing information

Mapping Extensions

Some of the input values are extensions. These use a set of helpers for mapping from alternative input lists.

See Mapping Extensions

For this endpoint, the using the employmentAbiCode is required, as its not possible to specify the individual values for employmentSector and industrySector like it is in the full API.

Complete Request Example

{
  "clientCode": "SU1",
  "shopCode": "4574",
  "application": {
    "brokerReference": "BROKERREF02",
    "accountNumber": null,
    "insuranceType": 1,
    "isRenewal": false
  },
  "policy": {
    "policyInceptionDate": "2020-11-05",
    "policyRenewalDate": "2021-11-05",
    "totalCashPrice": 1320.00,
    "deposit": 132.00,
    "creditProductCode": "TNC",
    "term": 10,
    "preferredPaymentDay": 15,
    "policyPremiumAmount": 132.00,
    "brokerCreditFeeAmount": 10.0,
    "brokerCreditFeeDescription": "fees",
    "brokerFeeAmount": 120.0,
    "brokerFeeAmountDescription": "discount applicable",
    "addOnAmount": 5.0,
    "addOnAmountDescription": "Heavy Duty",
    "discountAmount": 1.0,
    "discountAmountDescription": "Discount",
    "premiumDescription": "1",
    "policyType": 1,
    "policyNumber": "mh-123456",
    "insuranceCompany": "7",
    "ropRateType": 1,
    "isEdiFlag": false
  },
  "customer": {
    "title": "Mr",
    "firstName": "Test01FN",
    "lastName": "Test01LN",
    "dateOfBirth": "1966-10-09",
    "email": "[email protected]",
    "policyholderName": "MW FORREST",
    "mobileNumber": "07700900624",
    "phoneNumber": "01632960183",
    "employment": {
      "employmentStatusCDLCode": null,
      "employmentStatus": "FT",
      "isDirectorOrBoardMember": false,
      "employmentAbiCode": 191
    },
    "address":{ //this is optional, captured in frame if not provided here
       "houseName": null,
        "houseNumber": "1",
        "streetName": "CROMWELL ROAD",
        "townland": "ELY",
        "postTown": "ELY",
        "county": null,
        "postCode": "CB6 1AS",
        "addressLineOne": null
    }
  },
  "finance": {
    "totalToBorrow": 100.00,
    "adminFee": 5.00,
    "firstMonthlyDirectDebit": 4.00,
    "numberOfMonths": 10,
    "interestRate": 4.00,
    "aprRate": 9.50,
    "totalAmountPayable": 110.00
  }
}

Response Example

{
    "data": {
        "id": "729725cb-4f9f-48bf-8a7c-9c9db2ceb730",
        "url": "https://services.aventus.cloud/bnpipf/iframe/uat?setup=eyJJZCI6IjcyOTcyNWNiLTRmOWYtNDhiZi04YTdjLTljOWRiMmNlYjczMCIsIkFkZHJlc3MiOm51bGwsIlNob3dBZmZvcmRhYmlsaXR5IjpmYWxzZSwiU2hvd01hcmtldGluZyI6ZmFsc2UsIkZpbmFuY2UiOnsiVG90YWxUb0JvcnJvdyI6MC4wMCwiQWRtaW5GZWUiOjAuMDAsIkZpcnN0TW9udGhseURpcmVjdERlYml0IjowLjAwLCJOdW1iZXJPZk1vbnRocyI6MSwiSW50ZXJlc3RSYXRlIjowLjAwLCJBcHJSYXRlIjowLjAwLCJUb3RhbEFtb3VudFBheWFibGUiOjAuMDB9fQ%3D%3D"
    },
    "validationErrors": [],
    "error": -1,
    "error_description": null,
    "successful": true
}
{
    "data": null,
    "validationErrors": [
        {
            "message": "'Policy Inception Date' must not be empty.",
            "propertyIdentifier": "Policy.PolicyInceptionDate"
        }
    ],
    "error": 1006,
    "error_description": "Validation failed",
    "successful": false
}

Loading the Iframe

The full Iframe link to embed is provided in the response to the initial setup (data.url property).

Once the iframe process is complete, it will post a response for the hosting page.

To listen for the message, add an event listener

window.addEventListener('message',function(event) {
    if(event.origin === "https://services.aventus.cloud"){
      $('#result').text(JSON.stringify(event.data))
    }
  },false);

See https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage for more information.

The success data payload is the entire response from the BNP API, including the encoded pdf.

Once this payload has been received, it is up to the hosting page to continue the user journey.

{
  "successful": true,
  "data": {
    "newBusinessResponseType": {
      "brokerReference": "BROKERREF02",
      "accountNumber": "910000014774",
      "decision": 1,
      "pdf": "{..encoded PDF..}",
      "responseStatus": 1
    },
    "errors": null
  }
}
{
  "successful": false,
  "data": {
    "message": "Error message"
  }
}