214 lines
12 KiB
XML

<?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:spiffworkflow="http://spiffworkflow.org/bpmn/schema/1.0/core" id="Definitions_96f6665" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
<bpmn:process id="Proccess_tlws0al" isExecutable="true">
<bpmn:userTask id="Activity_0yes9h3" name="Submit Invoice">
<bpmn:extensionElements>
<spiffworkflow:properties>
<spiffworkflow:property name="formUiSchemaFilename" value="Submit-the-invoice_UISchema.json" />
<spiffworkflow:property name="formJsonSchemaFilename" value="Submit-the-invoice_JSONSchema.json" />
</spiffworkflow:properties>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1qe930f</bpmn:incoming>
</bpmn:userTask>
<bpmn:serviceTask id="Activity_1hdxh4e" name="Save Invoice Date to DyamoDB">
<bpmn:extensionElements>
<spiffworkflow:serviceTaskOperator id="aws/AddDynamoItem" resultVariable="resp_AddDynamoItem">
<spiffworkflow:parameters>
<spiffworkflow:parameter id="item_data" type="any" value="{ &#34;ContributorName&#34;: contributorName, &#34;ContributorId&#34;: contributorId, &#34;InvoiceId&#34;: invoiceId, &#34;InvoiceAmount&#34;: invoiceAmount, &#34;InvoiceCurrency&#34;: invoiceCurrency, &#34;DueDate&#34;: dueDate }" />
<spiffworkflow:parameter id="table_name" type="str" value="&#34;Invoice&#34;" />
</spiffworkflow:parameters>
</spiffworkflow:serviceTaskOperator>
</bpmn:extensionElements>
</bpmn:serviceTask>
<bpmn:serviceTask id="Activity_00fpxb0" name="Save PDF Document to S3">
<bpmn:extensionElements>
<spiffworkflow:serviceTaskOperator id="aws/UploadFileData" resultVariable="resp_UploadFileData">
<spiffworkflow:parameters>
<spiffworkflow:parameter id="bucket" type="str" value="&#39;sartography-status-pdfs&#39;" />
<spiffworkflow:parameter id="file_data" type="str" value="filesAccept" />
<spiffworkflow:parameter id="object_name" type="str" value="&#39;Invoice_xxxx.pdf&#39;" />
</spiffworkflow:parameters>
</spiffworkflow:serviceTaskOperator>
<spiffworkflow:postScript />
</bpmn:extensionElements>
</bpmn:serviceTask>
<bpmn:scriptTask id="Activity_0y8b7ok" name="Delete Temp File">
<bpmn:script>del(filesAccept)</bpmn:script>
</bpmn:scriptTask>
<bpmn:serviceTask id="Activity_1lu7ioj" name="Send Waku Message: Invoice Submitted">
<bpmn:extensionElements>
<spiffworkflow:serviceTaskOperator id="waku/SendMessage" resultVariable="wr_SendInvocieSubmitted">
<spiffworkflow:parameters>
<spiffworkflow:parameter id="message" type="str" value="&#34;Invocie submitted&#34;" />
<spiffworkflow:parameter id="message_type" type="str" value="&#34;wakuext_sendOneToOneMessage&#34;" />
<spiffworkflow:parameter id="recipient" type="str" />
</spiffworkflow:parameters>
</spiffworkflow:serviceTaskOperator>
</bpmn:extensionElements>
</bpmn:serviceTask>
<bpmn:intermediateThrowEvent id="Event_03t9lyz" name="Invoice Submitted" />
<bpmn:subProcess id="Activity_1p94uz7" name="Compare Submitted with Bamboo Salary">
<bpmn:serviceTask id="Activity_0vjn1x3" name="Get Bamboo Salary">
<bpmn:extensionElements>
<spiffworkflow:serviceTaskOperator id="bamboohr/GetPayRate" resultVariable="resp_GetPayRate">
<spiffworkflow:parameters>
<spiffworkflow:parameter id="employee_id" type="str" value="109" />
</spiffworkflow:parameters>
</spiffworkflow:serviceTaskOperator>
</bpmn:extensionElements>
<bpmn:outgoing>Flow_0wa6brf</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:scriptTask id="Activity_1s9t7oz" name="Set Annual Salary" scriptFormat="python">
<bpmn:extensionElements>
<spiffworkflow:unitTests>
<spiffworkflow:unitTest id="ScriptUnitTest_070ewva">
<spiffworkflow:inputJson>{"resp_BambooPayRate": {"amount": "10000"}}</spiffworkflow:inputJson>
<spiffworkflow:expectedOutputJson>{"annual_salary":10000,"annual_salary_str":"10000","resp_BambooPayRate":{"amount":"10000"}}</spiffworkflow:expectedOutputJson>
</spiffworkflow:unitTest>
</spiffworkflow:unitTests>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0wa6brf</bpmn:incoming>
<bpmn:outgoing>Flow_1j5gzff</bpmn:outgoing>
<bpmn:script>annual_salary_str = resp_GetPayRate["amount"]
annual_salary = float(annual_salary_str)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_1j5gzff" sourceRef="Activity_1s9t7oz" targetRef="Activity_1idn241" />
<bpmn:businessRuleTask id="Activity_1idn241" name="Check Amounts">
<bpmn:extensionElements>
<spiffworkflow:calledDecisionId>Check_Amounts</spiffworkflow:calledDecisionId>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1j5gzff</bpmn:incoming>
</bpmn:businessRuleTask>
<bpmn:sequenceFlow id="Flow_0wa6brf" sourceRef="Activity_0vjn1x3" targetRef="Activity_1s9t7oz" />
</bpmn:subProcess>
<bpmn:intermediateThrowEvent id="Event_1x4b5bx" name="Invoice Approval Rejected" />
<bpmn:intermediateThrowEvent id="Event_049kpe7" name="Invoice Approved" />
<bpmn:startEvent id="Event_1t15ahv">
<bpmn:outgoing>Flow_1qe930f</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="Activity_0jewccr" name="Create Invoice in Xero">
<bpmn:extensionElements>
<spiffworkflow:serviceTaskOperator id="xero/CreateInvoice" resultVariable="resp_xeroCreateInvoice">
<spiffworkflow:parameters>
<spiffworkflow:parameter id="access_token" type="any" value="&#34;secret:xero/OAuth&#34;" />
<spiffworkflow:parameter id="amount" type="str" value="invoiceAmount" />
<spiffworkflow:parameter id="contact_email" type="str" value="&#39;harmeet@status.im&#39;" />
<spiffworkflow:parameter id="contact_name" type="str" value="contributorName" />
<spiffworkflow:parameter id="description" type="str" value="&#39;Monthly pay&#39;" />
</spiffworkflow:parameters>
</spiffworkflow:serviceTaskOperator>
</bpmn:extensionElements>
</bpmn:serviceTask>
<bpmn:serviceTask id="Activity_12nu7wk" name="Get Bamboo Salary">
<bpmn:extensionElements>
<spiffworkflow:serviceTaskOperator id="bamboohr/GetPayRate" resultVariable="resp_GetPayRate">
<spiffworkflow:parameters>
<spiffworkflow:parameter id="employee_id" type="str" value="109" />
</spiffworkflow:parameters>
</spiffworkflow:serviceTaskOperator>
</bpmn:extensionElements>
</bpmn:serviceTask>
<bpmn:scriptTask id="Activity_00amiia" name="Convert Bamboo Annual Salary" scriptFormat="python">
<bpmn:extensionElements>
<spiffworkflow:unitTests>
<spiffworkflow:unitTest id="ScriptUnitTest_070ewva">
<spiffworkflow:inputJson>{"resp_BambooPayRate": {"amount": "10000"}}</spiffworkflow:inputJson>
<spiffworkflow:expectedOutputJson>{"annual_salary":10000,"annual_salary_str":"10000","resp_BambooPayRate":{"amount":"10000"}}</spiffworkflow:expectedOutputJson>
</spiffworkflow:unitTest>
</spiffworkflow:unitTests>
</bpmn:extensionElements>
<bpmn:script>annual_salary_str = resp_GetPayRate["amount"]
annual_salary = float(annual_salary_str)</bpmn:script>
</bpmn:scriptTask>
<bpmn:businessRuleTask id="Activity_123qmhe" name="Check Amounts">
<bpmn:extensionElements>
<spiffworkflow:calledDecisionId>Check_Amounts</spiffworkflow:calledDecisionId>
</bpmn:extensionElements>
</bpmn:businessRuleTask>
<bpmn:sequenceFlow id="Flow_1qe930f" sourceRef="Event_1t15ahv" targetRef="Activity_0yes9h3" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Proccess_tlws0al">
<bpmndi:BPMNShape id="Activity_0kzge8i_di" bpmnElement="Activity_1hdxh4e">
<dc:Bounds x="440" y="670" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1mjhyvs_di" bpmnElement="Activity_00fpxb0">
<dc:Bounds x="580" y="670" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0i29no8_di" bpmnElement="Activity_0y8b7ok">
<dc:Bounds x="710" y="670" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1m5hrik_di" bpmnElement="Activity_1lu7ioj">
<dc:Bounds x="860" y="670" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_03t9lyz_di" bpmnElement="Event_03t9lyz">
<dc:Bounds x="1012" y="692" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="987" y="735" width="88" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1we7w4j_di" bpmnElement="Activity_0yes9h3">
<dc:Bounds x="250" y="137" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0kd0p6j_di" bpmnElement="Activity_1p94uz7">
<dc:Bounds x="1090" y="670" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1x4b5bx_di" bpmnElement="Event_1x4b5bx">
<dc:Bounds x="1612" y="682" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1590" y="725" width="81" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_049kpe7_di" bpmnElement="Event_049kpe7">
<dc:Bounds x="1722" y="682" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1698" y="725" width="85" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1t15ahv_di" bpmnElement="Event_1t15ahv">
<dc:Bounds x="132" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_051lqwz_di" bpmnElement="Activity_0jewccr">
<dc:Bounds x="1820" y="670" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_1ullu4q" bpmnElement="Activity_12nu7wk">
<dc:Bounds x="1220" y="670" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_0w5h19r" bpmnElement="Activity_00amiia">
<dc:Bounds x="1350" y="670" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_1i3tn4m" bpmnElement="Activity_123qmhe">
<dc:Bounds x="1470" y="670" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1qe930f_di" bpmnElement="Flow_1qe930f">
<di:waypoint x="168" y="177" />
<di:waypoint x="250" y="177" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmndi:BPMNDiagram id="BPMNDiagram_162off7">
<bpmndi:BPMNPlane id="BPMNPlane_1l04ngk" bpmnElement="Activity_1p94uz7">
<bpmndi:BPMNShape id="Activity_0afx55v_di" bpmnElement="Activity_0vjn1x3">
<dc:Bounds x="350" y="190" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1o0ktq1_di" bpmnElement="Activity_1s9t7oz">
<dc:Bounds x="510" y="190" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0uvbn2c_di" bpmnElement="Activity_1idn241">
<dc:Bounds x="670" y="190" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1j5gzff_di" bpmnElement="Flow_1j5gzff">
<di:waypoint x="610" y="230" />
<di:waypoint x="670" y="230" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0wa6brf_di" bpmnElement="Flow_0wa6brf">
<di:waypoint x="450" y="230" />
<di:waypoint x="510" y="230" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>