<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_return_after_settlement" targetNamespace="https://www.analystengineering.com/iso-20022/payment-process-bpmn" exporter="Analyst Engineering" exporterVersion="1.0">
  <bpmn:collaboration id="Collaboration_1">
    <bpmn:documentation>Return after settlement: pacs.004 AC04. In a batch scheme the payment settles before the creditor agent applies it; the creditor agent then finds the account closed and sends the money back with a pacs.004 return, reason AC04. The debtor saw ACSC, and later receives the funds back with a camt.054 carrying the return reason. Source: https://www.analystengineering.com/iso-20022/payment-process-bpmn#return-after-settlement</bpmn:documentation>
    <bpmn:participant id="Participant_debtor" name="Debtor (customer who pays)" />
    <bpmn:participant id="Participant_dbtr" name="Debtor agent (debtor bank)" processRef="Process_dbtr" />
    <bpmn:participant id="Participant_csm" name="Clearing and settlement mechanism (CSM)" processRef="Process_csm" />
    <bpmn:participant id="Participant_cdtr" name="Creditor agent (creditor bank)" processRef="Process_cdtr" />
    <bpmn:messageFlow id="Message_1" name="pain.001" sourceRef="Participant_debtor" targetRef="Node_e0" />
    <bpmn:messageFlow id="Message_2" name="pain.002 ACSC" sourceRef="Node_e2" targetRef="Participant_debtor" />
    <bpmn:messageFlow id="Message_3" name="pacs.008" sourceRef="Node_e2" targetRef="Node_g0" />
    <bpmn:messageFlow id="Message_4" name="pacs.008" sourceRef="Node_g1" targetRef="Node_h0" />
    <bpmn:messageFlow id="Message_5" name="pacs.004 AC04" sourceRef="Node_h4" targetRef="Node_g3" />
    <bpmn:messageFlow id="Message_6" name="pacs.004 AC04" sourceRef="Node_g4" targetRef="Node_e6" />
    <bpmn:messageFlow id="Message_7" name="camt.054 return AC04" sourceRef="Node_e8" targetRef="Participant_debtor" />
  </bpmn:collaboration>
  <bpmn:process id="Process_dbtr" name="Debtor agent (debtor bank)" isExecutable="false">
    <bpmn:startEvent id="Node_e0" name="pain.001 received">
      <bpmn:outgoing>Flow_1</bpmn:outgoing>
      <bpmn:messageEventDefinition id="Node_e0_def" />
    </bpmn:startEvent>
    <bpmn:serviceTask id="Node_e1" name="Validate, screen, debit">
      <bpmn:incoming>Flow_1</bpmn:incoming>
      <bpmn:outgoing>Flow_2</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:sendTask id="Node_e2" name="Send pacs.008, report settled">
      <bpmn:incoming>Flow_2</bpmn:incoming>
      <bpmn:outgoing>Flow_3</bpmn:outgoing>
    </bpmn:sendTask>
    <bpmn:eventBasedGateway id="Node_e3" name="Return window">
      <bpmn:incoming>Flow_3</bpmn:incoming>
      <bpmn:outgoing>Flow_4</bpmn:outgoing>
      <bpmn:outgoing>Flow_5</bpmn:outgoing>
    </bpmn:eventBasedGateway>
    <bpmn:intermediateCatchEvent id="Node_e4" name="Return window closed">
      <bpmn:incoming>Flow_5</bpmn:incoming>
      <bpmn:outgoing>Flow_6</bpmn:outgoing>
      <bpmn:timerEventDefinition id="Node_e4_def"><bpmn:timeDuration xsi:type="bpmn:tFormalExpression">P3D</bpmn:timeDuration></bpmn:timerEventDefinition>
    </bpmn:intermediateCatchEvent>
    <bpmn:endEvent id="Node_e5" name="Payment final">
      <bpmn:incoming>Flow_6</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:intermediateCatchEvent id="Node_e6" name="Return received">
      <bpmn:incoming>Flow_4</bpmn:incoming>
      <bpmn:outgoing>Flow_7</bpmn:outgoing>
      <bpmn:messageEventDefinition id="Node_e6_def" />
    </bpmn:intermediateCatchEvent>
    <bpmn:serviceTask id="Node_e7" name="Credit debtor account">
      <bpmn:incoming>Flow_7</bpmn:incoming>
      <bpmn:outgoing>Flow_8</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:endEvent id="Node_e8" name="Notify the return">
      <bpmn:incoming>Flow_8</bpmn:incoming>
      <bpmn:messageEventDefinition id="Node_e8_def" />
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_1" sourceRef="Node_e0" targetRef="Node_e1" />
    <bpmn:sequenceFlow id="Flow_2" sourceRef="Node_e1" targetRef="Node_e2" />
    <bpmn:sequenceFlow id="Flow_3" sourceRef="Node_e2" targetRef="Node_e3" />
    <bpmn:sequenceFlow id="Flow_4" sourceRef="Node_e3" targetRef="Node_e6" />
    <bpmn:sequenceFlow id="Flow_5" sourceRef="Node_e3" targetRef="Node_e4" />
    <bpmn:sequenceFlow id="Flow_6" sourceRef="Node_e4" targetRef="Node_e5" />
    <bpmn:sequenceFlow id="Flow_7" sourceRef="Node_e6" targetRef="Node_e7" />
    <bpmn:sequenceFlow id="Flow_8" sourceRef="Node_e7" targetRef="Node_e8" />
  </bpmn:process>
  <bpmn:process id="Process_csm" name="Clearing and settlement mechanism (CSM)" isExecutable="false">
    <bpmn:startEvent id="Node_g0" name="pacs.008 received">
      <bpmn:outgoing>Flow_9</bpmn:outgoing>
      <bpmn:messageEventDefinition id="Node_g0_def" />
    </bpmn:startEvent>
    <bpmn:sendTask id="Node_g1" name="Settle in cycle, forward">
      <bpmn:incoming>Flow_9</bpmn:incoming>
      <bpmn:outgoing>Flow_10</bpmn:outgoing>
    </bpmn:sendTask>
    <bpmn:endEvent id="Node_g2" name="Settled">
      <bpmn:incoming>Flow_10</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:startEvent id="Node_g3" name="pacs.004 received">
      <bpmn:outgoing>Flow_11</bpmn:outgoing>
      <bpmn:messageEventDefinition id="Node_g3_def" />
    </bpmn:startEvent>
    <bpmn:sendTask id="Node_g4" name="Settle return, forward">
      <bpmn:incoming>Flow_11</bpmn:incoming>
      <bpmn:outgoing>Flow_12</bpmn:outgoing>
    </bpmn:sendTask>
    <bpmn:endEvent id="Node_g5" name="Return settled">
      <bpmn:incoming>Flow_12</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_9" sourceRef="Node_g0" targetRef="Node_g1" />
    <bpmn:sequenceFlow id="Flow_10" sourceRef="Node_g1" targetRef="Node_g2" />
    <bpmn:sequenceFlow id="Flow_11" sourceRef="Node_g3" targetRef="Node_g4" />
    <bpmn:sequenceFlow id="Flow_12" sourceRef="Node_g4" targetRef="Node_g5" />
  </bpmn:process>
  <bpmn:process id="Process_cdtr" name="Creditor agent (creditor bank)" isExecutable="false">
    <bpmn:startEvent id="Node_h0" name="pacs.008 received">
      <bpmn:outgoing>Flow_13</bpmn:outgoing>
      <bpmn:messageEventDefinition id="Node_h0_def" />
    </bpmn:startEvent>
    <bpmn:serviceTask id="Node_h1" name="Apply to creditor account">
      <bpmn:incoming>Flow_13</bpmn:incoming>
      <bpmn:outgoing>Flow_14</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:exclusiveGateway id="Node_h2" name="Account usable?">
      <bpmn:incoming>Flow_14</bpmn:incoming>
      <bpmn:outgoing>Flow_15</bpmn:outgoing>
      <bpmn:outgoing>Flow_16</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:serviceTask id="Node_h3" name="Prepare return">
      <bpmn:incoming>Flow_15</bpmn:incoming>
      <bpmn:outgoing>Flow_17</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:sendTask id="Node_h4" name="Return funds">
      <bpmn:incoming>Flow_17</bpmn:incoming>
      <bpmn:outgoing>Flow_18</bpmn:outgoing>
    </bpmn:sendTask>
    <bpmn:endEvent id="Node_h5" name="Returned">
      <bpmn:incoming>Flow_18</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:serviceTask id="Node_h6" name="Credit creditor account">
      <bpmn:incoming>Flow_16</bpmn:incoming>
      <bpmn:outgoing>Flow_19</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:endEvent id="Node_h7" name="Credited">
      <bpmn:incoming>Flow_19</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_13" sourceRef="Node_h0" targetRef="Node_h1" />
    <bpmn:sequenceFlow id="Flow_14" sourceRef="Node_h1" targetRef="Node_h2" />
    <bpmn:sequenceFlow id="Flow_15" name="Closed" sourceRef="Node_h2" targetRef="Node_h3" />
    <bpmn:sequenceFlow id="Flow_16" name="Yes" sourceRef="Node_h2" targetRef="Node_h6" />
    <bpmn:sequenceFlow id="Flow_17" sourceRef="Node_h3" targetRef="Node_h4" />
    <bpmn:sequenceFlow id="Flow_18" sourceRef="Node_h4" targetRef="Node_h5" />
    <bpmn:sequenceFlow id="Flow_19" sourceRef="Node_h6" targetRef="Node_h7" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1" name="Return after settlement: pacs.004 AC04">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1">
      <bpmndi:BPMNShape id="Participant_debtor_di" bpmnElement="Participant_debtor" isHorizontal="true"><dc:Bounds x="8" y="8" width="1506" height="52" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Participant_dbtr_di" bpmnElement="Participant_dbtr" isHorizontal="true"><dc:Bounds x="8" y="124" width="1506" height="228" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Participant_csm_di" bpmnElement="Participant_csm" isHorizontal="true"><dc:Bounds x="8" y="416" width="1506" height="124" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Participant_cdtr_di" bpmnElement="Participant_cdtr" isHorizontal="true"><dc:Bounds x="8" y="604" width="1506" height="228" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_e0_di" bpmnElement="Node_e0"><dc:Bounds x="98" y="168" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="66" y="208" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_e1_di" bpmnElement="Node_e1"><dc:Bounds x="190" y="150" width="100" height="72" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_e2_di" bpmnElement="Node_e2"><dc:Bounds x="314" y="150" width="100" height="72" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_e3_di" bpmnElement="Node_e3"><dc:Bounds x="463" y="161" width="50" height="50" /><bpmndi:BPMNLabel><dc:Bounds x="438" y="142" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_e4_di" bpmnElement="Node_e4"><dc:Bounds x="594" y="272" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="562" y="312" width="100" height="26" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_e5_di" bpmnElement="Node_e5"><dc:Bounds x="718" y="272" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="686" y="312" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_e6_di" bpmnElement="Node_e6"><dc:Bounds x="1090" y="168" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="1058" y="149" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_e7_di" bpmnElement="Node_e7"><dc:Bounds x="1182" y="150" width="100" height="72" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_e8_di" bpmnElement="Node_e8"><dc:Bounds x="1338" y="168" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="1306" y="208" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_g0_di" bpmnElement="Node_g0"><dc:Bounds x="346" y="460" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="314" y="500" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_g1_di" bpmnElement="Node_g1"><dc:Bounds x="438" y="442" width="100" height="72" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_g2_di" bpmnElement="Node_g2"><dc:Bounds x="594" y="460" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="562" y="500" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_g3_di" bpmnElement="Node_g3"><dc:Bounds x="966" y="460" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="934" y="441" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_g4_di" bpmnElement="Node_g4"><dc:Bounds x="1058" y="442" width="100" height="72" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_g5_di" bpmnElement="Node_g5"><dc:Bounds x="1214" y="460" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="1182" y="500" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_h0_di" bpmnElement="Node_h0"><dc:Bounds x="470" y="648" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="438" y="688" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_h1_di" bpmnElement="Node_h1"><dc:Bounds x="562" y="630" width="100" height="72" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_h2_di" bpmnElement="Node_h2" isMarkerVisible="true"><dc:Bounds x="711" y="641" width="50" height="50" /><bpmndi:BPMNLabel><dc:Bounds x="686" y="622" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_h3_di" bpmnElement="Node_h3"><dc:Bounds x="810" y="630" width="100" height="72" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_h4_di" bpmnElement="Node_h4"><dc:Bounds x="934" y="630" width="100" height="72" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_h5_di" bpmnElement="Node_h5"><dc:Bounds x="1090" y="648" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="1058" y="688" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_h6_di" bpmnElement="Node_h6"><dc:Bounds x="810" y="734" width="100" height="72" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Node_h7_di" bpmnElement="Node_h7"><dc:Bounds x="966" y="752" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="934" y="792" width="100" height="13" /></bpmndi:BPMNLabel></bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_1_di" bpmnElement="Flow_1"><di:waypoint x="134" y="186" /><di:waypoint x="190" y="186" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_2_di" bpmnElement="Flow_2"><di:waypoint x="290" y="186" /><di:waypoint x="314" y="186" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_3_di" bpmnElement="Flow_3"><di:waypoint x="414" y="186" /><di:waypoint x="463" y="186" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_4_di" bpmnElement="Flow_4"><di:waypoint x="513" y="186" /><di:waypoint x="1090" y="186" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_5_di" bpmnElement="Flow_5"><di:waypoint x="488" y="211" /><di:waypoint x="488" y="290" /><di:waypoint x="594" y="290" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_6_di" bpmnElement="Flow_6"><di:waypoint x="630" y="290" /><di:waypoint x="718" y="290" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_7_di" bpmnElement="Flow_7"><di:waypoint x="1126" y="186" /><di:waypoint x="1182" y="186" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_8_di" bpmnElement="Flow_8"><di:waypoint x="1282" y="186" /><di:waypoint x="1338" y="186" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_9_di" bpmnElement="Flow_9"><di:waypoint x="382" y="478" /><di:waypoint x="438" y="478" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_10_di" bpmnElement="Flow_10"><di:waypoint x="538" y="478" /><di:waypoint x="594" y="478" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_11_di" bpmnElement="Flow_11"><di:waypoint x="1002" y="478" /><di:waypoint x="1058" y="478" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_12_di" bpmnElement="Flow_12"><di:waypoint x="1158" y="478" /><di:waypoint x="1214" y="478" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_13_di" bpmnElement="Flow_13"><di:waypoint x="506" y="666" /><di:waypoint x="562" y="666" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_14_di" bpmnElement="Flow_14"><di:waypoint x="662" y="666" /><di:waypoint x="711" y="666" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_15_di" bpmnElement="Flow_15"><di:waypoint x="761" y="666" /><di:waypoint x="810" y="666" /><bpmndi:BPMNLabel><dc:Bounds x="767" y="649" width="60" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_16_di" bpmnElement="Flow_16"><di:waypoint x="736" y="691" /><di:waypoint x="736" y="770" /><di:waypoint x="810" y="770" /><bpmndi:BPMNLabel><dc:Bounds x="742" y="694" width="60" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_17_di" bpmnElement="Flow_17"><di:waypoint x="910" y="666" /><di:waypoint x="934" y="666" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_18_di" bpmnElement="Flow_18"><di:waypoint x="1034" y="666" /><di:waypoint x="1090" y="666" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_19_di" bpmnElement="Flow_19"><di:waypoint x="910" y="770" /><di:waypoint x="966" y="770" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Message_1_di" bpmnElement="Message_1"><di:waypoint x="116" y="60" /><di:waypoint x="116" y="168" /><bpmndi:BPMNLabel><dc:Bounds x="123" y="78" width="96" height="28" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Message_2_di" bpmnElement="Message_2"><di:waypoint x="364" y="150" /><di:waypoint x="364" y="60" /><bpmndi:BPMNLabel><dc:Bounds x="371" y="78" width="96" height="28" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Message_3_di" bpmnElement="Message_3"><di:waypoint x="364" y="222" /><di:waypoint x="364" y="460" /><bpmndi:BPMNLabel><dc:Bounds x="371" y="370" width="96" height="28" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Message_4_di" bpmnElement="Message_4"><di:waypoint x="488" y="514" /><di:waypoint x="488" y="648" /><bpmndi:BPMNLabel><dc:Bounds x="495" y="558" width="96" height="28" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Message_5_di" bpmnElement="Message_5"><di:waypoint x="984" y="630" /><di:waypoint x="984" y="496" /><bpmndi:BPMNLabel><dc:Bounds x="991" y="558" width="96" height="28" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Message_6_di" bpmnElement="Message_6"><di:waypoint x="1108" y="442" /><di:waypoint x="1108" y="204" /><bpmndi:BPMNLabel><dc:Bounds x="1115" y="370" width="96" height="28" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Message_7_di" bpmnElement="Message_7"><di:waypoint x="1356" y="168" /><di:waypoint x="1356" y="60" /><bpmndi:BPMNLabel><dc:Bounds x="1363" y="78" width="96" height="28" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
