Price Calculation

Financial Services Accelerator enables anonymous and registered users to check premium rates from the back-end systems (FS-PRO) in real time, based on the inputs they have provided.

Integration Package

Integration Flow (iFlow): Calculate Anonymous New Business Quotation from SAP Commerce FSA in Policy Management in SAP S4HANA
Value Mappings SAP Commerce to S4HANA Value Mapping

Overview

Financial Services Accelerator enables anonymous and registered users to check prices from the back-end systems (FS-PRO) in real time, based on the inputs they have provided.

The logic for calculating prices is triggered on the first three checkout steps for auto insurance:
  • Step 1(Choose a Cover): when a user clicks the FIND PRICES button

  • Step 2 (What's Included / Comparison Table): when a user selects a product plan

  • Step 3 (Add Options page): when a user adds or removes optional coverages

Although each user action on these checkout steps triggers price calculation or recalculation, a call to FS-PRO is triggered only if there are any changes in the data entered by the user. To enable this, a caching mechanism has been put in place.

Integration Object

The integration object OutboundAnonymousCart is defined in the projectdata-anonymouscart-outbound.impex file in the sappqmintegrationfacades extension.

$integrationgroup = integrationadmingroup
$defaultPassword = 123456
$lang = en

INSERT_UPDATE IntegrationObject; code[unique = true];
; OutboundAnonymousCart

INSERT_UPDATE IntegrationObjectItem; integrationObject(code)[unique = true]; code[unique = true]; type(code)
; OutboundAnonymousCart ; Cart               ; Cart               ;
; OutboundAnonymousCart ; Currency           ; Currency           ;
; OutboundAnonymousCart ; CartEntry          ; CartEntry          ;
; OutboundAnonymousCart ; Product            ; Product            ;
; OutboundAnonymousCart ; InsuranceQuote     ; InsuranceQuote     ;
; OutboundAnonymousCart ; FSPaymentFrequency ; FSPaymentFrequency ;
; OutboundAnonymousCart ; InsuredObject      ; InsuredObject      ;

INSERT_UPDATE IntegrationObjectItemAttribute; integrationObjectItem(integrationObject(code), code)[unique = true]; attributeName[unique = true]; attributeDescriptor(enclosingType(code), qualifier); returnIntegrationObjectItem(integrationObject(code), code); unique[default = false]; autoCreate[default = false]
; OutboundAnonymousCart:Cart               ; cartId           ; Cart:code                       ;                                          ; true ;
; OutboundAnonymousCart:Cart               ; currency         ; Cart:currency                   ; OutboundAnonymousCart:Currency
; OutboundAnonymousCart:Cart               ; coverages        ; Cart:entries                    ; OutboundAnonymousCart:CartEntry          ;      ;
; OutboundAnonymousCart:Cart               ; quoteInformation ; Cart:insuranceQuote             ; OutboundAnonymousCart:InsuranceQuote     ;      ;

; OutboundAnonymousCart:Currency           ; isocode          ; Currency:isocode                ;                                          ;      ;

; OutboundAnonymousCart:CartEntry          ; insuredObject    ; CartEntry:insuredObject         ; OutboundAnonymousCart:InsuredObject      ;      ;
; OutboundAnonymousCart:CartEntry          ; entryNumber      ; CartEntry:entryNumber           ;                                          ; true ;
; OutboundAnonymousCart:CartEntry          ; product          ; CartEntry:product               ; OutboundAnonymousCart:Product            ;      ;

; OutboundAnonymousCart:InsuranceQuote     ; startDate        ; InsuranceQuote:startDate        ;                                          ;      ;
; OutboundAnonymousCart:InsuranceQuote     ; paymentFrequency ; InsuranceQuote:paymentFrequency ; OutboundAnonymousCart:FSPaymentFrequency ;      ;

; OutboundAnonymousCart:FSPaymentFrequency ; code             ; FSPaymentFrequency:code         ;                                          ; true ;

; OutboundAnonymousCart:Product            ; code             ; Product:code                    ;                                          ; true ;

; OutboundAnonymousCart:InsuredObject      ; insuredObjectId  ; InsuredObject:insuredObjectId   ;                                          ; true ;

You can view and modify the integration object in the Integration UI Tool perspective of Backoffice, under Modelling node.

Example Payload and Response

The PQMQuoteServiceFacade calls the OutboundServiceFacade to prepare the payload.

Sometimes, as is the case with quote creation, the payload needs to be decorated in a specific way. The PQMCartRequestDecorator removes the key and value labels from the payload to make it more readable.

The following code shows the example payload request:

{
  {
  "quoteInformation": {
    "paymentFrequency": {
      "code": "MONTHLY"
    },
    "startDate": "/Date(1565301600000)/",
    "insuredObjects": [
      {
        "childInsuredObjects": [
          {
            "driverDob": "/Date(282178800000)/",
            "driverLicenceDate": "/Date(944953200000)/",
            "driverCategory": "Main",
            "insuredObjectType": "DRIVER",
            "insuredObjectId": "00026500",
            "driverGender": "Female",
            "driverMaritalStatus": "Married"
          }
        ],
        "vehicleYear": "2019",
        "vehicleUsage": "Personal",
        "insuredObjectType": "AUTO",
        "vehicleOwnerPostalCode": "68167",
        "insuredObjectId": "00026499",
        "vehicleModel": "A5",
        "vehicleValue": "30000",
        "vehiclePurchaseDate": "/Date(1550962800000)/",
        "vehicleAnnualMileage": "12000",
        "vehicleMake": "Audi",
        "vehicleType": "A5Quattro"
      }
    ]
  },
  "currency": {
    "isocode": "EUR"
  },
  "mainProduct": "AUTO_INSURANCE_GOLD",
  "coverages": [
    {
      "insuredObject": {
        "insuredObjectId": "00026499"
      },
      "entryNumber": 0,
      "product": {
        "features": [
          {
            "code": "limit",
            "type": "bodilyinjurylimit",
            "amount": "2000000.0"
          },
          {
            "code": "limit",
            "type": "propertydamagedlimit",
            "amount": "200000.0"
          }
        ],
        "code": "AUTO_TPL_GOLD"
      }
    },
    {
      "insuredObject": {
        "insuredObjectId": "00026499"
      },
      "entryNumber": 1,
      "product": {
        "features": [
          {
            "code": "deductible",
            "type": "deductible",
            "amount": "1000.0"
          }
        ],
        "code": "AUTO_COLLISION_COVERAGE_GOLD"
      }
    },
    {
      "insuredObject": {
        "insuredObjectId": "00026499"
      },
      "entryNumber": 2,
      "product": {
        "features": [
          {
            "code": "deductible",
            "type": "deductible",
            "amount": "1000.0"
          }
        ],
        "code": "AUTO_COMPREHENSIVE_COVERAGE_GOLD"
      }
    },
    {
      "insuredObject": {
        "insuredObjectId": "00026499"
      },
      "entryNumber": 3,
      "product": {
        "code": "AUTO_UNINSURED_COVERAGE_GOLD"
      }
    },
    {
      "insuredObject": {
        "insuredObjectId": "00026499"
      },
      "entryNumber": 4,
      "product": {
        "code": "AUTO_ROADSIDE_ASSISTANCE_GOLD"
      }
    }
  ],
  "selectedQuoteVariant": "AUTO_INSURANCE_GOLD"
}

Response

The PQMQuoteServiceFacade is responsible for response and error handling. The following code example illustrates a response received from SAP Cloud Integration:

{
  "coverages": [
    {
      "entryNumber": "0",
      "premiumAfterTax": "506.9",
      "premiumBeforeTax": "506.9"
    },
    {
      "entryNumber": "1",
      "premiumAfterTax": "2.42",
      "premiumBeforeTax": "2.42"
    },
    {
      "entryNumber": "2",
      "premiumAfterTax": "8.73",
      "premiumBeforeTax": "8.73"
    },
    {
      "entryNumber": "3",
      "premiumAfterTax": "5.0",
      "premiumBeforeTax": "5.0"
    },
    {
      "entryNumber": "4",
      "premiumAfterTax": "5.0",
      "premiumBeforeTax": "5.0"
    }
  ],
  "quoteInformation": {
    "premiumAfterTax": "528.05",
    "premiumBeforeTax": "528.05"
  }
}

You can monitor the outbound requests in the Integration UI Tool perspective of Backoffice, under the Start of the navigation pathMonitoring Next navigation step OutboundEnd of the navigation path node.

To view a specific payload, select it from the list and double-click within the Request Payload field. This action opens a context-menu. Download the payload data and open it with a JSON Viewer of your choice.