SAP Commerce Cloud is highly extensible and includes a very flexible dynamic business process module. The order fulfillment process leverages this module heavily to allow organizations to customize their fullfillment process to their business needs. This example shows an example of an external fraud check process running in the SAP BTP, Kyma runtime that is invoked asyncronously via the dynamic business process for order management.
The example fraud check function performs the following checks:
-
Email address validation using external email validation service
-
Number of customer orders
-
Total order value (e.g. > $500)
For more information about extending SAP Commerce Cloud business processes please see the SAP Help Portal - Extending BPM Processes
The architecture diagram describes use case flow.
- Order Validation Theoretical Explanation
- Order Validation Event Configuration and Lambda Creation
- Order Validation Extended Scenario
-
SAP Commerce Cloud environment connected to SAP BTP Kyma runtime.
- v2011 or greater in order to use the Integration APIs with OAUTH and Admin API (available since v1811.)
- Include the
adminapi
andyacceleratorfulfilmentprocess
extensions adminapi
requires theOAuthClientDetails
for Kyma to have theROLE_ADMINGROUP
Authority.
Ensure the Commerce system has the kymaintegrationservices
, odata2webservices
and adminapi
extensions.
The extension requires a Secret
named order-validation
configured in the Kyma namespace containing the following values:
-
baseSite
: The SAP Commerce Cloud baseSite value e.g.electronics-spa
, required by the SAP Commerce Cloud OCC API. -
gateway_url_occ
- URL for the SAP Commerce Cloud OCC API provided by the Kyma Central Application Gateway -
gateway_url_fraudreport
- URL for the SAP Commerce Cloud Integration API for Customer Reviews provided by the Kyma Central Application Gateway -
gateway_url_adminapi
- URL for the SAP Commerce Cloud Integration API for Customer Reviews provided by the Kyma Central Application Gateway -
url_email_check_service
- URL for the third-party email validation API -
slackUrl
- The Slack webhook for posting messages to the notification channel.
-
Set up environment variables
-
OSX
export NS={your-namespace}
-
Windows PowerShell
$NS={your-namespace}
-
kubectl apply -n $NS -f order-validation.yaml
kubectl apply -n $NS -f subscription.yaml
Import the following files in commerce-impex in your SAP Commerce Cloud environment via the Adminstration Cockpit (hAC) or alternative method.
commerce/businessprocess.impex
commerce/fraudcheck-event.impex
commerce/odata-service.impex
See the SAP Commmerce Help topic on Data Management with Impex.
Add the Integration Object to the registered Kyma Destination Target using SAP Commerce Cloud Backoffice as described in Expose Your API – Existing Destination Target section in this blog post on SAP Community
Deploy the function:
kubectl apply -n $NS -f lambdas/k8s/function.yaml
kubectl apply -n $NS -f lambdas/k8s/subscription.yaml
- Access the SAP Commerce Cloud tenant web shop storefront
- Add a high value item (> $500.00) to the cart and complete checkout
- In a few moments a Slack message appears showing the order has failed validation due to high order value.
- In Commerce backoffice, find the order and view the fraud report and resulting scores.