Skip to content

Commit

Permalink
feat creating a first draft
Browse files Browse the repository at this point in the history
  • Loading branch information
Hafflgav committed Aug 21, 2024
1 parent 8ca6be1 commit 252102c
Show file tree
Hide file tree
Showing 10 changed files with 268 additions and 47 deletions.
134 changes: 129 additions & 5 deletions connector-workshop/kyc-process-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,134 @@

<artifactId>kyc-process-app</artifactId>

<properties>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-bom</artifactId>
<version>${zeebe.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.2.0</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>

<dependency>
<groupId>io.camunda.spring</groupId>
<artifactId>spring-boot-starter-camunda</artifactId>
<version>${spring-zeebe.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.camunda.spring</groupId>
<artifactId>spring-boot-starter-camunda-test</artifactId>
<version>${spring-zeebe.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.43.0</version>
<configuration>
<formats>
<format>
<includes>
<include>*.md</include>
<include>.gitignore</include>
</includes>
<trimTrailingWhitespace/>
<endWithNewline/>
<indent>
<spaces>true</spaces>
<spacesPerTab>2</spacesPerTab>
</indent>
</format>
</formats>
<java>
<googleJavaFormat/>
</java>
<pom/>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<mainClass>io.miragon.consulting.connectorworkshop.KycProcessApplication</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.miragon.consulting.connectorworkshop;

import io.camunda.zeebe.spring.client.EnableZeebeClient;
import io.camunda.zeebe.spring.client.annotation.JobWorker;
import io.camunda.zeebe.spring.client.annotation.VariablesAsType;
import io.miragon.consulting.connectorworkshop.dtos.Application;
import io.miragon.consulting.connectorworkshop.dtos.CheckResult;
import io.miragon.consulting.connectorworkshop.dtos.VerificationResult;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Map;


@SpringBootApplication
@EnableZeebeClient
public class KycProcessApplication {
public static void main(String[] args) {
SpringApplication.run(KycProcessApplication.class, args);
}

@JobWorker()
public CheckResult checkApplicant(@VariablesAsType Application application){
return new CheckResult(true);
}

@JobWorker()
public VerificationResult verifyApplication(@VariablesAsType Application application){
return new VerificationResult(true);
}

@JobWorker()
public void startOnboardingProcess(@VariablesAsType Application application){

}

@JobWorker()
public void restCall(@VariablesAsType Application application){
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.miragon.consulting.connectorworkshop.dtos;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.checkerframework.checker.signature.qual.FullyQualifiedName;

@Getter
@AllArgsConstructor
public class Application {
private String accountType;
private boolean additionalServices;
private String address;
private String dateOfBirth;
private String email;
private String fullName;
private String phoneNumber;
private boolean termsAgreement;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.miragon.consulting.connectorworkshop.dtos;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class CheckResult {
private boolean applicantCheck;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.miragon.consulting.connectorworkshop.dtos;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class VerificationResult {
private boolean applicationVerified;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://docs.camunda.io/docs/apis-tools/spring-zeebe-sdk/getting-started/
# https://docs.camunda.io/docs/apis-tools/spring-zeebe-sdk/configuration/

server:
port: 9100

zeebe:
client:
cloud:
cluster-id: ${CAMUNDA_CLUSTER_ID}
client-id: ${ZEEBE_CLIENT_ID}
client-secret: ${ZEEBE_CLIENT_SECRET}
region: ${CAMUNDA_CLUSTER_REGION:ont-1}
auth-url: ${ZEEBE_AUTHORIZATION_SERVER_URL}
broker:
gateway-address: ${ZEEBE_ADDRESS:localhost:26500}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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:modeler="http://camunda.org/schema/modeler/1.0" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Web Modeler" exporterVersion="3ffff27" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.5.0" camunda:diagramRelationId="1869a2d6-68d9-401a-8b85-6d3438defdfd">
<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:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:modeler="http://camunda.org/schema/modeler/1.0" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.26.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.5.0" camunda:diagramRelationId="1869a2d6-68d9-401a-8b85-6d3438defdfd">
<bpmn:collaboration id="Collaboration_1utc6yp" name="KYC Process">
<bpmn:participant id="Participant_00zep8j" name="Simplified KYC Process" processRef="Process_0n9gegm" />
<bpmn:participant id="Participant_1ljcfb1" name="Credit Score Service (REST)" />
Expand Down Expand Up @@ -29,29 +29,18 @@
<bpmn:outgoing>Flow_0v75tgo</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:serviceTask id="Activity_0r0pydg" name="Check name and address">
<bpmn:extensionElements>
<zeebe:taskDefinition type="checkApplicant" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_13n9ou0</bpmn:incoming>
<bpmn:outgoing>Flow_0lbdc9b</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="Activity_1367xtj" name="Verify information">
<bpmn:incoming>Flow_1q4y0er</bpmn:incoming>
<bpmn:outgoing>Flow_0gs4f3n</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="Activity_1eduolb" name="Check credit score" zeebe:modelerTemplate="io.camunda.connectors.HttpJson.v2" zeebe:modelerTemplateVersion="8" zeebe:modelerTemplateIcon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE3LjAzMzUgOC45OTk5N0MxNy4wMzM1IDEzLjQ0NzUgMTMuNDI4MSAxNy4wNTI5IDguOTgwNjUgMTcuMDUyOUM0LjUzMzE2IDE3LjA1MjkgMC45Mjc3NjUgMTMuNDQ3NSAwLjkyNzc2NSA4Ljk5OTk3QzAuOTI3NzY1IDQuNTUyNDggNC41MzMxNiAwLjk0NzA4MyA4Ljk4MDY1IDAuOTQ3MDgzQzEzLjQyODEgMC45NDcwODMgMTcuMDMzNSA0LjU1MjQ4IDE3LjAzMzUgOC45OTk5N1oiIGZpbGw9IiM1MDU1NjIiLz4KPHBhdGggZD0iTTQuOTMxMjYgMTQuMTU3MUw2Ljc4MTA2IDMuNzE0NzFIMTAuMTM3NUMxMS4xOTE3IDMuNzE0NzEgMTEuOTgyNCAzLjk4MzIzIDEyLjUwOTUgNC41MjAyN0MxMy4wNDY1IDUuMDQ3MzYgMTMuMzE1IDUuNzMzNTggMTMuMzE1IDYuNTc4OTJDMTMuMzE1IDcuNDQ0MTQgMTMuMDcxNCA4LjE1NTIyIDEyLjU4NDEgOC43MTIxNUMxMi4xMDY3IDkuMjU5MTMgMTEuNDU1MyA5LjYzNzA1IDEwLjYyOTggOS44NDU5TDEyLjA2MTkgMTQuMTU3MUgxMC4zMzE1TDkuMDMzNjQgMTAuMDI0OUg3LjI0MzUxTDYuNTEyNTQgMTQuMTU3MUg0LjkzMTI2Wk03LjQ5NzExIDguNTkyODFIOS4yNDI0OEM5Ljk5ODMyIDguNTkyODEgMTAuNTkwMSA4LjQyMzc0IDExLjAxNzcgOC4wODU2MUMxMS40NTUzIDcuNzM3NTMgMTEuNjc0MSA3LjI2NTEzIDExLjY3NDEgNi42Njg0MkMxMS42NzQxIDYuMTkxMDYgMTEuNTI0OSA1LjgxODExIDExLjIyNjUgNS41NDk1OUMxMC45MjgyIDUuMjcxMTMgMTAuNDU1OCA1LjEzMTkgOS44MDkzNiA1LjEzMTlIOC4xMDg3NEw3LjQ5NzExIDguNTkyODFaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K">
<bpmn:extensionElements>
<zeebe:taskDefinition type="io.camunda:http-json:1" retries="3" />
<zeebe:ioMapping>
<zeebe:input source="noAuth" target="authentication.type" />
<zeebe:input source="GET" target="method" />
<zeebe:input target="url" />
<zeebe:input source="20" target="connectionTimeoutInSeconds" />
<zeebe:input source="20" target="readTimeoutInSeconds" />
</zeebe:ioMapping>
<zeebe:taskHeaders>
<zeebe:header key="retryBackoff" value="PT0S" />
</zeebe:taskHeaders>
<zeebe:taskDefinition type="verifyApplication" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_0lbdc9b</bpmn:incoming>
<bpmn:outgoing>Flow_1q4y0er</bpmn:outgoing>
<bpmn:incoming>Flow_1q4y0er</bpmn:incoming>
<bpmn:outgoing>Flow_0gs4f3n</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:userTask id="Activity_1o74p9o" name="Review application">
<bpmn:extensionElements>
Expand All @@ -61,18 +50,31 @@
<bpmn:outgoing>Flow_0mkbsfh</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sendTask id="Activity_0z68zqg" name="Onboard new customer">
<bpmn:extensionElements>
<zeebe:taskDefinition type="startOnboardingProcess" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_0ubuozt</bpmn:incoming>
<bpmn:incoming>Flow_0v75tgo</bpmn:incoming>
<bpmn:outgoing>Flow_0d41t30</bpmn:outgoing>
</bpmn:sendTask>
<bpmn:sequenceFlow id="Flow_13n9ou0" sourceRef="StartEvent_1" targetRef="Activity_0r0pydg" />
<bpmn:sequenceFlow id="Flow_0gs4f3n" sourceRef="Activity_1367xtj" targetRef="Gateway_0wi5mmb" />
<bpmn:sequenceFlow id="Flow_10loogk" name="medium" sourceRef="Gateway_0wi5mmb" targetRef="Activity_1o74p9o" />
<bpmn:sequenceFlow id="Flow_0ubuozt" name="none" sourceRef="Gateway_0wi5mmb" targetRef="Activity_0z68zqg" />
<bpmn:sequenceFlow id="Flow_1pa53fs" name="high" sourceRef="Gateway_0wi5mmb" targetRef="Activity_1xaulds" />
<bpmn:sequenceFlow id="Flow_10loogk" name="medium" sourceRef="Gateway_0wi5mmb" targetRef="Activity_1o74p9o">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=creditscore &gt; 60 and creditscore &lt; 81</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_0ubuozt" name="none" sourceRef="Gateway_0wi5mmb" targetRef="Activity_0z68zqg">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=creditScore &gt; 80</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_1pa53fs" name="high" sourceRef="Gateway_0wi5mmb" targetRef="Activity_1xaulds">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=creditscore &lt; 61</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_0mkbsfh" sourceRef="Activity_1o74p9o" targetRef="Gateway_0z0vb4r" />
<bpmn:sequenceFlow id="Flow_0kd9kar" name="no" sourceRef="Gateway_0z0vb4r" targetRef="Activity_1xaulds" />
<bpmn:sequenceFlow id="Flow_0v75tgo" name="yes" sourceRef="Gateway_0z0vb4r" targetRef="Activity_0z68zqg" />
<bpmn:sequenceFlow id="Flow_0kd9kar" name="no" sourceRef="Gateway_0z0vb4r" targetRef="Activity_1xaulds">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=decision = "decline"</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_0v75tgo" name="yes" sourceRef="Gateway_0z0vb4r" targetRef="Activity_0z68zqg">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=decision = "accept"</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_0lbdc9b" sourceRef="Activity_0r0pydg" targetRef="Activity_1eduolb" />
<bpmn:sequenceFlow id="Flow_1q4y0er" sourceRef="Activity_1eduolb" targetRef="Activity_1367xtj" />
<bpmn:sequenceFlow id="Flow_1gwqmtt" sourceRef="Activity_1xaulds" targetRef="Event_1wfv0y9" />
Expand All @@ -85,23 +87,19 @@
</bpmn:endEvent>
<bpmn:callActivity id="Activity_1xaulds" name="Notify about rejection">
<bpmn:extensionElements>
<zeebe:ioMapping>
<zeebe:input source="refresh" target="authentication.type" />
<zeebe:input target="authentication.token" />
<zeebe:input target="authentication.clientId" />
<zeebe:input target="authentication.tenantId" />
<zeebe:input source="chat" target="data.type" />
<zeebe:input source="sendMessageToChat" target="data.method" />
<zeebe:input target="data.chatId" />
<zeebe:input target="data.content" />
<zeebe:input source="TEXT" target="data.bodyType" />
</zeebe:ioMapping>
<zeebe:calledElement processId="Process_129lkee" propagateAllChildVariables="false" propagateAllParentVariables="false" />
<zeebe:calledElement processId="Process_129lkee" propagateAllChildVariables="false" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_1pa53fs</bpmn:incoming>
<bpmn:incoming>Flow_0kd9kar</bpmn:incoming>
<bpmn:outgoing>Flow_1gwqmtt</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:serviceTask id="Activity_1eduolb" name="Check credit score">
<bpmn:extensionElements>
<zeebe:taskDefinition type="restCall" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_0lbdc9b</bpmn:incoming>
<bpmn:outgoing>Flow_1q4y0er</bpmn:outgoing>
</bpmn:serviceTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1utc6yp">
Expand Down Expand Up @@ -133,9 +131,6 @@
<bpmndi:BPMNShape id="Activity_057io8i_di" bpmnElement="Activity_1367xtj">
<dc:Bounds x="660" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1oj2e24_di" bpmnElement="Activity_1eduolb" bioc:stroke="#205022" bioc:fill="#c8e6c9" color:background-color="#c8e6c9" color:border-color="#205022">
<dc:Bounds x="500" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_19qm22d_di" bpmnElement="Activity_1o74p9o">
<dc:Bounds x="940" y="330" width="100" height="80" />
</bpmndi:BPMNShape>
Expand All @@ -157,6 +152,9 @@
<bpmndi:BPMNShape id="Activity_1j8tyr9_di" bpmnElement="Activity_1xaulds" bioc:stroke="#205022" bioc:fill="#c8e6c9" color:background-color="#c8e6c9" color:border-color="#205022">
<dc:Bounds x="1170" y="440" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_00hzlog_di" bpmnElement="Activity_1eduolb">
<dc:Bounds x="500" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_13n9ou0_di" bpmnElement="Flow_13n9ou0">
<di:waypoint x="288" y="260" />
<di:waypoint x="340" y="260" />
Expand Down
12 changes: 8 additions & 4 deletions connector-workshop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
<module>kyc-process-app</module>
<module>notifiy-customer-integration</module>
</modules>

<properties>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>21</java.version>
<spring-boot.version>3.3.2</spring-boot.version>
<zeebe.version>8.5.2</zeebe.version>
<spring-zeebe.version>8.5.4</spring-zeebe.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<lombok.version>1.18.32</lombok.version>
</properties>


</project>

0 comments on commit 252102c

Please sign in to comment.