<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="@bpmnkit/core" exporterVersion="0.0.23" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.9.0">
  <bpmn:process id="customer-kyc-onboarding" name="Customer KYC Onboarding" isExecutable="true">
    <bpmn:extensionElements>
      <zeebe:versionTag value="1.0.0"/>
    </bpmn:extensionElements>
    <bpmn:startEvent id="application-received" name="Application received">
      <bpmn:outgoing>Flow_application-received_verify-identity</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:serviceTask id="verify-identity" name="Verify identity">
      <bpmn:extensionElements>
        <zeebe:taskDefinition type="kyc-identity-verify"/>
        <zeebe:ioMapping>
          <zeebe:output source="=status" target="identityStatus"/>
        </zeebe:ioMapping>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_application-received_verify-identity</bpmn:incoming>
      <bpmn:outgoing>Flow_verify-identity_screen-sanctions</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:serviceTask id="screen-sanctions" name="Screen sanctions lists">
      <bpmn:extensionElements>
        <zeebe:taskDefinition type="kyc-sanctions-screen"/>
        <zeebe:ioMapping>
          <zeebe:output source="=hits" target="sanctionHits"/>
        </zeebe:ioMapping>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_verify-identity_screen-sanctions</bpmn:incoming>
      <bpmn:outgoing>Flow_screen-sanctions_assess-risk</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:businessRuleTask id="assess-risk" name="Assess risk tier">
      <bpmn:extensionElements>
        <zeebe:calledDecision decisionId="kyc-risk-tier" resultVariable="riskTier"/>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_screen-sanctions_assess-risk</bpmn:incoming>
      <bpmn:outgoing>Flow_assess-risk_risk-route</bpmn:outgoing>
    </bpmn:businessRuleTask>
    <bpmn:exclusiveGateway id="risk-route" name="Risk tier?" default="Flow_risk-route_compliance-review">
      <bpmn:incoming>Flow_assess-risk_risk-route</bpmn:incoming>
      <bpmn:outgoing>Flow_risk-route_open-merge</bpmn:outgoing>
      <bpmn:outgoing>Flow_risk-route_compliance-review</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:userTask id="compliance-review" name="Compliance review">
      <bpmn:extensionElements>
        <zeebe:userTask/>
        <zeebe:assignmentDefinition candidateGroups="compliance"/>
        <zeebe:priorityDefinition priority="80"/>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_risk-route_compliance-review</bpmn:incoming>
      <bpmn:outgoing>Flow_compliance-review_cleared</bpmn:outgoing>
    </bpmn:userTask>
    <bpmn:exclusiveGateway id="cleared" name="Cleared?" default="Flow_cleared_decline-application">
      <bpmn:incoming>Flow_compliance-review_cleared</bpmn:incoming>
      <bpmn:outgoing>Flow_cleared_open-merge</bpmn:outgoing>
      <bpmn:outgoing>Flow_cleared_decline-application</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:serviceTask id="decline-application" name="Decline application">
      <bpmn:extensionElements>
        <zeebe:taskDefinition type="customer-notify"/>
        <zeebe:taskHeaders>
          <zeebe:header key="template" value="kyc-declined"/>
        </zeebe:taskHeaders>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_cleared_decline-application</bpmn:incoming>
      <bpmn:outgoing>Flow_decline-application_application-declined</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:endEvent id="application-declined" name="Application declined">
      <bpmn:incoming>Flow_decline-application_application-declined</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:exclusiveGateway id="open-merge">
      <bpmn:incoming>Flow_risk-route_open-merge</bpmn:incoming>
      <bpmn:incoming>Flow_cleared_open-merge</bpmn:incoming>
      <bpmn:outgoing>Flow_open-merge_open-account</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:serviceTask id="open-account" name="Open account">
      <bpmn:extensionElements>
        <zeebe:taskDefinition type="core-banking-account-open"/>
        <zeebe:ioMapping>
          <zeebe:output source="=accountNumber" target="accountNumber"/>
        </zeebe:ioMapping>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_open-merge_open-account</bpmn:incoming>
      <bpmn:outgoing>Flow_open-account_account-opened</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:endEvent id="account-opened" name="Account opened">
      <bpmn:incoming>Flow_open-account_account-opened</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_application-received_verify-identity" sourceRef="application-received" targetRef="verify-identity"/>
    <bpmn:sequenceFlow id="Flow_verify-identity_screen-sanctions" sourceRef="verify-identity" targetRef="screen-sanctions"/>
    <bpmn:sequenceFlow id="Flow_screen-sanctions_assess-risk" sourceRef="screen-sanctions" targetRef="assess-risk"/>
    <bpmn:sequenceFlow id="Flow_assess-risk_risk-route" sourceRef="assess-risk" targetRef="risk-route"/>
    <bpmn:sequenceFlow id="Flow_risk-route_open-merge" sourceRef="risk-route" targetRef="open-merge" name="low">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=riskTier = "low"</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="Flow_risk-route_compliance-review" sourceRef="risk-route" targetRef="compliance-review" name="review"/>
    <bpmn:sequenceFlow id="Flow_compliance-review_cleared" sourceRef="compliance-review" targetRef="cleared"/>
    <bpmn:sequenceFlow id="Flow_cleared_open-merge" sourceRef="cleared" targetRef="open-merge" name="yes">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=complianceCleared</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="Flow_cleared_decline-application" sourceRef="cleared" targetRef="decline-application" name="no"/>
    <bpmn:sequenceFlow id="Flow_decline-application_application-declined" sourceRef="decline-application" targetRef="application-declined"/>
    <bpmn:sequenceFlow id="Flow_open-merge_open-account" sourceRef="open-merge" targetRef="open-account"/>
    <bpmn:sequenceFlow id="Flow_open-account_account-opened" sourceRef="open-account" targetRef="account-opened"/>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="customer-kyc-onboarding_di">
    <bpmndi:BPMNPlane id="customer-kyc-onboarding_di_plane" bpmnElement="customer-kyc-onboarding">
      <bpmndi:BPMNShape id="application-received_di" bpmnElement="application-received">
        <dc:Bounds x="72" y="42" width="36" height="36"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds x="20" y="82" width="140" height="14"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="verify-identity_di" bpmnElement="verify-identity">
        <dc:Bounds x="208" y="20" width="100" height="80"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="screen-sanctions_di" bpmnElement="screen-sanctions">
        <dc:Bounds x="408" y="20" width="100" height="80"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="assess-risk_di" bpmnElement="assess-risk">
        <dc:Bounds x="608" y="20" width="100" height="80"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="risk-route_di" bpmnElement="risk-route">
        <dc:Bounds x="808" y="35" width="50" height="50"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds x="798" y="89" width="70" height="14"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="compliance-review_di" bpmnElement="compliance-review">
        <dc:Bounds x="958" y="20" width="100" height="80"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="cleared_di" bpmnElement="cleared">
        <dc:Bounds x="1158" y="35" width="50" height="50"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1155" y="89" width="56" height="14"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="decline-application_di" bpmnElement="decline-application">
        <dc:Bounds x="1308" y="20" width="100" height="80"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="application-declined_di" bpmnElement="application-declined">
        <dc:Bounds x="1540" y="42" width="36" height="36"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1488" y="82" width="140" height="14"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="open-merge_di" bpmnElement="open-merge">
        <dc:Bounds x="1333" y="195" width="50" height="50"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="open-account_di" bpmnElement="open-account">
        <dc:Bounds x="1508" y="180" width="100" height="80"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="account-opened_di" bpmnElement="account-opened">
        <dc:Bounds x="1708" y="202" width="36" height="36"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1677" y="242" width="98" height="14"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_application-received_verify-identity_di" bpmnElement="Flow_application-received_verify-identity">
        <di:waypoint x="108" y="60"/>
        <di:waypoint x="208" y="60"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_verify-identity_screen-sanctions_di" bpmnElement="Flow_verify-identity_screen-sanctions">
        <di:waypoint x="308" y="60"/>
        <di:waypoint x="408" y="60"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_screen-sanctions_assess-risk_di" bpmnElement="Flow_screen-sanctions_assess-risk">
        <di:waypoint x="508" y="60"/>
        <di:waypoint x="608" y="60"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_assess-risk_risk-route_di" bpmnElement="Flow_assess-risk_risk-route">
        <di:waypoint x="708" y="60"/>
        <di:waypoint x="808" y="60"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_risk-route_open-merge_di" bpmnElement="Flow_risk-route_open-merge">
        <di:waypoint x="833" y="85"/>
        <di:waypoint x="833" y="220"/>
        <di:waypoint x="1333" y="220"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1063" y="196" width="40" height="14"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_risk-route_compliance-review_di" bpmnElement="Flow_risk-route_compliance-review">
        <di:waypoint x="858" y="60"/>
        <di:waypoint x="958" y="60"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds x="887" y="36" width="42" height="14"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_compliance-review_cleared_di" bpmnElement="Flow_compliance-review_cleared">
        <di:waypoint x="1058" y="60"/>
        <di:waypoint x="1158" y="60"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_cleared_open-merge_di" bpmnElement="Flow_cleared_open-merge">
        <di:waypoint x="1183" y="85"/>
        <di:waypoint x="1183" y="148"/>
        <di:waypoint x="1358" y="148"/>
        <di:waypoint x="1358" y="195"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1251" y="124" width="40" height="14"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_cleared_decline-application_di" bpmnElement="Flow_cleared_decline-application">
        <di:waypoint x="1208" y="60"/>
        <di:waypoint x="1308" y="60"/>
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1238" y="36" width="40" height="14"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_decline-application_application-declined_di" bpmnElement="Flow_decline-application_application-declined">
        <di:waypoint x="1408" y="60"/>
        <di:waypoint x="1540" y="60"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_open-merge_open-account_di" bpmnElement="Flow_open-merge_open-account">
        <di:waypoint x="1383" y="220"/>
        <di:waypoint x="1508" y="220"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_open-account_account-opened_di" bpmnElement="Flow_open-account_account-opened">
        <di:waypoint x="1608" y="220"/>
        <di:waypoint x="1708" y="220"/>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

