<?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" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_CreditMgmt">
  <bpmn:process id="Process_CreditMgmt" isExecutable="false">
    <bpmn:startEvent id="SE_Start" name="Sales Order Saved"><bpmn:outgoing>SF_1</bpmn:outgoing></bpmn:startEvent>
    <bpmn:serviceTask id="T_Calc" name="Calculate Credit Exposure"><bpmn:incoming>SF_1</bpmn:incoming><bpmn:outgoing>SF_2</bpmn:outgoing></bpmn:serviceTask>
    <bpmn:exclusiveGateway id="GW_Limit" name="Exposure Exceeds Limit?"><bpmn:incoming>SF_2</bpmn:incoming><bpmn:outgoing>SF_NoBlock</bpmn:outgoing><bpmn:outgoing>SF_Block</bpmn:outgoing></bpmn:exclusiveGateway>
    <bpmn:endEvent id="SE_Released" name="Order Released for Delivery"><bpmn:incoming>SF_NoBlock</bpmn:incoming><bpmn:incoming>SF_CreditOK</bpmn:incoming></bpmn:endEvent>
    <bpmn:userTask id="T_Blocked" name="Apply Credit Block"><bpmn:incoming>SF_Block</bpmn:incoming><bpmn:outgoing>SF_3</bpmn:outgoing></bpmn:userTask>
    <bpmn:userTask id="T_Review" name="Credit Controller Reviews"><bpmn:incoming>SF_3</bpmn:incoming><bpmn:outgoing>SF_4</bpmn:outgoing></bpmn:userTask>
    <bpmn:exclusiveGateway id="GW_Decision" name="Decision?"><bpmn:incoming>SF_4</bpmn:incoming><bpmn:outgoing>SF_CreditOK</bpmn:outgoing><bpmn:outgoing>SF_Cancelled</bpmn:outgoing></bpmn:exclusiveGateway>
    <bpmn:endEvent id="SE_Cancelled" name="Order Cancelled"><bpmn:incoming>SF_Cancelled</bpmn:incoming></bpmn:endEvent>
    <bpmn:sequenceFlow id="SF_1" sourceRef="SE_Start" targetRef="T_Calc"/>
    <bpmn:sequenceFlow id="SF_2" sourceRef="T_Calc" targetRef="GW_Limit"/>
    <bpmn:sequenceFlow id="SF_NoBlock" name="No" sourceRef="GW_Limit" targetRef="SE_Released"/>
    <bpmn:sequenceFlow id="SF_Block" name="Yes" sourceRef="GW_Limit" targetRef="T_Blocked"/>
    <bpmn:sequenceFlow id="SF_3" sourceRef="T_Blocked" targetRef="T_Review"/>
    <bpmn:sequenceFlow id="SF_4" sourceRef="T_Review" targetRef="GW_Decision"/>
    <bpmn:sequenceFlow id="SF_CreditOK" name="Release" sourceRef="GW_Decision" targetRef="SE_Released"/>
    <bpmn:sequenceFlow id="SF_Cancelled" name="Reject" sourceRef="GW_Decision" targetRef="SE_Cancelled"/>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_CreditMgmt">
      <bpmndi:BPMNShape id="Sh_SE_Start" bpmnElement="SE_Start"><dc:Bounds x="52" y="182" width="36" height="36"/><bpmndi:BPMNLabel><dc:Bounds x="30" y="225" width="80" height="27"/></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Sh_T_Calc" bpmnElement="T_Calc"><dc:Bounds x="140" y="160" width="120" height="80"/></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Sh_GW_Limit" bpmnElement="GW_Limit" isMarkerVisible="true"><dc:Bounds x="320" y="175" width="50" height="50"/><bpmndi:BPMNLabel><dc:Bounds x="300" y="232" width="90" height="27"/></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Sh_SE_Released" bpmnElement="SE_Released"><dc:Bounds x="432" y="182" width="36" height="36"/><bpmndi:BPMNLabel><dc:Bounds x="408" y="225" width="84" height="27"/></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Sh_T_Blocked" bpmnElement="T_Blocked"><dc:Bounds x="300" y="330" width="120" height="80"/></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Sh_T_Review" bpmnElement="T_Review"><dc:Bounds x="480" y="330" width="120" height="80"/></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Sh_GW_Decision" bpmnElement="GW_Decision" isMarkerVisible="true"><dc:Bounds x="660" y="345" width="50" height="50"/><bpmndi:BPMNLabel><dc:Bounds x="651" y="402" width="68" height="14"/></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Sh_SE_Cancelled" bpmnElement="SE_Cancelled"><dc:Bounds x="772" y="352" width="36" height="36"/><bpmndi:BPMNLabel><dc:Bounds x="750" y="395" width="80" height="27"/></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Ed_SF_1" bpmnElement="SF_1"><di:waypoint x="88" y="200"/><di:waypoint x="140" y="200"/></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Ed_SF_2" bpmnElement="SF_2"><di:waypoint x="260" y="200"/><di:waypoint x="320" y="200"/></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Ed_SF_NoBlock" bpmnElement="SF_NoBlock"><di:waypoint x="370" y="200"/><di:waypoint x="432" y="200"/><bpmndi:BPMNLabel><dc:Bounds x="392" y="182" width="18" height="14"/></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Ed_SF_Block" bpmnElement="SF_Block"><di:waypoint x="345" y="225"/><di:waypoint x="345" y="330"/><bpmndi:BPMNLabel><dc:Bounds x="351" y="268" width="22" height="14"/></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Ed_SF_3" bpmnElement="SF_3"><di:waypoint x="420" y="370"/><di:waypoint x="480" y="370"/></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Ed_SF_4" bpmnElement="SF_4"><di:waypoint x="600" y="370"/><di:waypoint x="660" y="370"/></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Ed_SF_CreditOK" bpmnElement="SF_CreditOK"><di:waypoint x="685" y="345"/><di:waypoint x="685" y="200"/><di:waypoint x="468" y="200"/><bpmndi:BPMNLabel><dc:Bounds x="690" y="268" width="38" height="14"/></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Ed_SF_Cancelled" bpmnElement="SF_Cancelled"><di:waypoint x="710" y="370"/><di:waypoint x="772" y="370"/><bpmndi:BPMNLabel><dc:Bounds x="726" y="352" width="28" height="14"/></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
