Skip to content

Commit 51dc1c1

Browse files
authored
feat: create code challenge java (#1)
1 parent a73a5ed commit 51dc1c1

2 files changed

Lines changed: 109 additions & 2 deletions

File tree

README.md

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,84 @@
1-
# app-java-codechallenge
2-
Code challenge for potential Yaperos
1+
# Yape Code Challenge :rocket:
2+
3+
Our code challenge will let you marvel us with your Jedi coding skills :smile:.
4+
5+
Don't forget that the proper way to submit your work is to fork the repo and create a PR :wink: ... have fun !!
6+
7+
- [Yape Code Challenge :rocket:](#yape-code-challenge-rocket)
8+
- [Problem](#problem)
9+
- [Tech Stack](#tech-stack)
10+
- [Optional](#optional)
11+
- [Send us your challenge](#send-us-your-challenge)
12+
13+
# Problem
14+
15+
Every time a financial transaction is created it must be validated by our anti-fraud microservice and then the same service sends a message back to update the transaction status.
16+
For now, we have only three transaction statuses:
17+
18+
<ol>
19+
<li>pending</li>
20+
<li>approved</li>
21+
<li>rejected</li>
22+
</ol>
23+
24+
Every transaction with a value greater than 1000 should be rejected.
25+
26+
```mermaid
27+
flowchart LR
28+
Transaction -- Save Transaction with pending Status --> transactionDatabase[(Database)]
29+
Transaction --Send transaction Created event--> Anti-Fraud
30+
Anti-Fraud -- Send transaction Status Approved event--> Transaction
31+
Anti-Fraud -- Send transaction Status Rejected event--> Transaction
32+
Transaction -- Update transaction Status event--> transactionDatabase[(Database)]
33+
```
34+
35+
# Tech Stack
36+
37+
<ol>
38+
<li>Java. You can use any framework you want</li>
39+
<li>Any database</li>
40+
<li>Kafka</li>
41+
</ol>
42+
43+
We do provide a `Dockerfile` to help you get started with a dev environment.
44+
45+
You must have two resources:
46+
47+
1. Resource to create a transaction that must containt:
48+
49+
```json
50+
{
51+
"accountExternalIdDebit": "Guid",
52+
"accountExternalIdCredit": "Guid",
53+
"tranferTypeId": 1,
54+
"value": 120
55+
}
56+
```
57+
58+
2. Resource to retrieve a transaction
59+
60+
```json
61+
{
62+
"transactionExternalId": "Guid",
63+
"transactionType": {
64+
"name": ""
65+
},
66+
"transactionStatus": {
67+
"name": ""
68+
},
69+
"value": 120,
70+
"createdAt": "Date"
71+
}
72+
```
73+
74+
## Optional
75+
76+
You can use any approach to store transaction data but you should consider that we may deal with high volume scenarios where we have a huge amount of writes and reads for the same data at the same time. How would you tackle this requirement?
77+
78+
You can use Graphql;
79+
80+
# Send us your challenge
81+
82+
When you finish your challenge, after forking a repository, you **must** open a pull request to our repository. There are no limitations to the implementation, you can follow the programming paradigm, modularization, and style that you feel is the most appropriate solution.
83+
84+
If you have any questions, please let us know.

docker-compose.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: "3.7"
2+
services:
3+
postgres:
4+
image: postgres:14
5+
ports:
6+
- "5432:5432"
7+
environment:
8+
- POSTGRES_USER=postgres
9+
- POSTGRES_PASSWORD=postgres
10+
zookeeper:
11+
image: confluentinc/cp-zookeeper:5.5.3
12+
environment:
13+
ZOOKEEPER_CLIENT_PORT: 2181
14+
kafka:
15+
image: confluentinc/cp-enterprise-kafka:5.5.3
16+
depends_on: [zookeeper]
17+
environment:
18+
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
19+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
20+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
21+
KAFKA_BROKER_ID: 1
22+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
23+
KAFKA_JMX_PORT: 9991
24+
ports:
25+
- 9092:9092

0 commit comments

Comments
 (0)