Policy Replication
Find out how to import policies from SAP Policy Management into Financial Services Accelerator.
The integration with Policy Management in SAP S/4HANA (FS-PM) enables the import of policies and contracts into Financial Services Accelerator. When you release an application in FS-PM, the system triggers publishing of all policy and contract versions that are relevant for the user of Financial Services Accelerator. Policies are checked for relevance before their import to optimize data load and performance. For this check, Financial Services Accelerator uses a REST-based API that is protected with OAuth client.
The currently effective version and all future versions of the policies/contracts in FS-PM are transferred and stored in SAP Commerce database. In My Policies section of My Account area, however, only effective version is displayed. The data for the inquiry is loaded from SAP Commerce database to avoid frequent access to SAP Policy Management.
The following figure illustrates the integration between SAP Policy Management (FS-PM) and Financial Services Accelerator:
The connection from Policy Management in SAP S/4HANA to SAP Commerce Cloud, financial services accelerator is enabled by an integration flow (iFlow) that is in the integration package SAP Commerce Cloud, financial services accelerator integration with Policy Management in SAP S/4HANA in SAP Cloud Integration , available in SAP API Business Hub. For more information on Policy Management in SAP S/4HANA, see Policy Display for SAP Commerce.
To illustrate the integration flow, a life risk insurance product is used. The sample data for this new product is stored in an ImpEx file in financialstore extension, together with other sample data content. The value mappings for this product can be found in the integration package.
Note that the implementation in Financial Services Accelerator for policy inquiry is generic and can be used in the integration scenarios with other policy management systems.
Technical Information
To learn more about technical aspects of the policy import implementation in Financial Services Accelerator, consult the following sections.
Prerequisites
- have OAuth client
- be part of integrationadmingroup
For more information, see Authentication.
Policy Relevance Check
POST /v1/sites/{baseSiteId}/catalogs/{catalogId}/versions/{versionId}/policies/relevance
In the sample implementation, the base site is insurance, and the catalog is financialProductCatalog, in either the Staged or Online version.
The check is performed in FSInsurancePoliciesController, which checks against the policyholder (mainPolicyHolderId) and the product bundle (productId), as can be seen in the following example.
Example Payload
<?xml version="1.0" encoding="UTF-8" ?>
<contracts>
<contract>
<contractId>232323232</contractId>
<mainPolicyHolderId>5000050000</mainPolicyHolderId>
<productId>LIFE_RISK_INSURANCE</productId>
</contract>
<contract>
<contractId>121212121</contractId>
<mainPolicyHolderId>5000050000</mainPolicyHolderId>
<productId>LIFE_NOT_RELEVANT</productId>
</contract>
<contract>
<contractId>222222222</contractId>
<mainPolicyHolderId>XXXXXXXXXX</mainPolicyHolderId>
<productId>LIFE_RISK_INSURANCE</productId>
</contract>
<contract>
<contractId>333333333</contractId>
<mainPolicyHolderId>XXXXXXXXXX</mainPolicyHolderId>
<productId>LIFE_NOT_RELEVANT</productId>
</contract>
</contracts>
As a response to a web service call, a list of all policies sent for checking is retrieved with the relevance flag set to true or false. Only when both the policyholder and product bundle exist in SAP Commerce, a policy or policies originated in another back-end system are deemeed relevant and can be imported. In this example, only the first policy is relevant, since in all other cases, either the user or the product bundle doesn't exist in Financial Services Accelerator.
Example Response
<?xml version="1.0" encoding="UTF-8" ?>
<contracts>
<contract>
<contractId>232323232</contractId>
<mainPolicyHolderId>5000050000</mainPolicyHolderId>
<productId>LIFE_RISK_INSURANCE</productId>
<relevant>true</relevant>
</contract>
<contract>
<contractId>121212121</contractId>
<mainPolicyHolderId>5000050000</mainPolicyHolderId>
<productId>LIFE_NOT_RELEVANT</productId>
<relevant>false</relevant>
</contract>
<contract>
<contractId>222222222</contractId>
<mainPolicyHolderId>XXXXXXXXXX</mainPolicyHolderId>
<productId>LIFE_RISK_INSURANCE</productId>
<relevant>false</relevant>
</contract>
<contract>
<contractId>333333333</contractId>
<mainPolicyHolderId>XXXXXXXXXX</mainPolicyHolderId>
<productId>LIFE_NOT_RELEVANT</productId>
<relevant>false</relevant>
</contract>
</contracts>
Note that OAuth token should be provided before the web service could be called.
Policy Import
To import insurance policies into SAP Commerce from SAP Cloud Integration or any other environment, two endpoints are delivered:
-
EDMX Schema (GET)
/odata2webservices/InboundInsurancePolicy/$metadata
- POST Request
/odata2webservices/InboundInsurancePolicy/InsurancePolicies
Basic authentication is needed for both calls - you need to provide the username and password for the integration group member.
Example Integration Product - Life Risk Insurance
Generic API for importing insurance policies into Financial Services Accelerator is enabled out of the box for the life risk insurance product. Note that the life risk insurance product is only used for the integration purposes and is not otherwise available on UI. The necessary configurations are given in the insurance-policy-integration.impex file of financialstore extension. You can modify this file so that it is applicable to other integration objects.
For testing purposes you can use the sample user Donna Moore, which has 'SMOKE001" as externalId reference.
Example JSON
Content-Type: application/http
Content-Transfer-Encoding: binary
POST InsurancePolicies HTTP/1.1
Content-Language: en
Accept: application/json
Content-Type: application/json
Pre-Persist-Hook: fsInsurancePolicyPrePersistHook
{
"@odata.context": "$metadata#InsurancePolicy/$entity",
"user": {
"externalId": "SMOKE001"
},
"policyId": "00000055",
"contractId": "00000055",
"technicalId":"0001",
"versionNumber":"1",
"policyEffectiveDate": "2018-05-11T08:59:04",
"policyStartDate": "2018-05-11T08:59:04",
"policyExpiryDate": "2028-07-11T08:59:04",
"policyStatus": {
"code": "ACTIVE"
},
"paymentFrequency": {
"code": "YEARLY"
},
"premiumAmount": "102.39",
"currency": {
"isocode": "EUR"
},
"category": {
"code": "insurances_life",
"catalogVersion": {
"version": "Online",
"catalog": {
"id": "financialProductCatalog"
}
}
},
"coverages": [
{
"coverageProduct": {
"code": "LIFE_RISK_SOD_PREMIUM_EXEMPTION",
"catalogVersion": {
"version": "Online",
"catalog": {
"id": "financialProductCatalog"
}
}
},
"coverageType": {
"code": "ADDITIONAL"
},
"coverageAmount": "124.23",
"coverageId": "00000055C1V1",
"technicalId": "0001-0000-0001"
},
{
"coverageProduct": {
"code": "LIFE_RISK",
"catalogVersion": {
"version": "Online",
"catalog": {
"id": "financialProductCatalog"
}
}
},
"coverageType": {
"code": "MAIN"
},
"coverageAmount": "121.23",
"coverageId": "00000055C2V1",
"technicalId": "0001-0000-0002"
},
{
"coverageId": "00000055C3V1",
"technicalId": "0001-0000-0003",
"coverageProduct": {
"code": "LIFE_RISK_SUPPLEMENTARY_ACCIDENT_INSURANCE",
"catalogVersion": {
"version": "Online",
"catalog": {
"id": "financialProductCatalog"
}
}
},
"coverageType": {
"code": "ADDITIONAL"
},
"coverageAmount": "121.23"
}
],
"insuredObjects": [
{
"insuredObjectId": "00000055IO1V1",
"technicalId": "0001-0000-0001",
"insuredObjectType": {"code":"PERSON"},
"insuredObjectItems": [
{
"itemId": "00000055IO1IT1V1",
"label": "firstName",
"externalValue": "Donna"
},
{
"itemId": "00000055IO1IT2V1",
"label": "lastName",
"externalValue": "Moore"
},
{
"itemId": "00000055IO1IT3V1",
"label": "birthday",
"format": "DATE",
"externalValue": "1992-05-11T08:59:04"
}
]
}
]
}
Mass Import of Policies
- batch mode: in case there is an error with one batch entry, no entry is persisted
- bulk mode: in case there is an error with one batch entry, only entry that has an error should not be persisted
https://financialservices.local:9002/odata2webservices/InboundInsurancePolicy/$batch
https://financialservices.local:9002/odata2webservices/InboundInsurancePolicy/$bulk
Make sure to pass the right headers as part of the request (e.g. Content-Type = multipart/mixed; boundary=batch ).
Hooks
As SAP Cloud Integration OData Adapter in its current version does not support functions, persistence hooks are used to provide a stopgap measure.
To enable the successful import of policies into Financial Services Accelerator, a persistance hook FSInsurancePolicyPrePersistHook has been implemented. The purpose of FSInsurancePolicyPrePersistHook is to handle date formats and ordering of insured object item.
FSInsurancePolicyPrePersistHook
As Object type is not yet supported by integration APIs, it has to be converted to String format before data can be imported into SAP Commerce. In case of Financial Services Accelerator, this constraint affects InsuredObjectItem, as the value attribute of InsuredObjectItem needs to be converted from Object to String format before policies can be stored in SAP Commerce.
- SAP Policy Management sends all versions of a policy that has been changed and is relevant for SAP Commerce
- Before import, the value attributes for InsuredObjectItems are stored at externalValue property in String format
- When policies are imported, FSInsurancePolicyPrePersistHook processes the externalValue attributes and saves them to the value attributes of InsuredObjectItem
"insuredObjects": [
{
"insuredObjectId": "00000055IO1V1",
"insuredObjectType": {"code":"PERSON"},
"insuredObjectItems": [
{
"itemId": "00000055IO1IT1V1",
"label": "firstName",
"externalValue": "Donna"
},
{
"itemId": "00000055IO1IT2V1",
"label": "lastName",
"externalValue": "Moore"
},
{
"itemId": "00000055IO1IT3V1",
"label": "birthday",
"format": "DATE",
"externalValue": "1992-05-11T08:59:04"
}
]
}
]
As both first name and last name are already in String format, FSInsurancePolicyPrePersistHook just stores them to insuredObjectItem.value property.
With date of birth, the FSInsurancePolicyPrePersistHook is used to convert String to Date format. The hook can be extended to handle some other formats if needed.
key: Pre-Persist-Hook value:fsInsurancePolicyPrePersistHook
Data Model
The main changes to data model as a result of this integration include full support for version handling and import of policies that can have multiple contracts (insured persons). For more information, see Insurance Data Model.