Skip to content

devahmedshendy/customer-statement-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Customer Statement Processor

There is some storage managed by the server, where user can upload customer statement files (xml or csv). Once file uploaded, a validation operation will be executed by the server to validate it.

Spring Batch Solution

The user can do the following:

  • Upload customer statement file (xml or csv).
  • Subscribe to Server-Sent Events.
  • Get list of all uploaded files with summarized validation result.
  • Get a full validation result for specific file.
  • Delete specific file from storage.

Build The Application - Using Docker (Remote or Local)

  • Remote
# Open new terminal tab, then run

# Build Docker image from branch 'master'
docker build -t customer-statement-processor https://github.com/devahmedshendy/customer-statement-processor.git

# Run Docker container for image 'customer_statement_processor:latest'
docker container run --detach --publish 9090:9090 --name customer-statement-processor customer-statement-processor:latest

# Watch container logs
docker container logs -f customer-statement-processor
  • Local
# Open new terminal tab, then run

# Clone repository
git clone https://github.com/devahmedshendy/customer-statement-processor.git

# Change directory to project
cd customer-statement-processor

# Build Docker image from master branch with name 'customer-statement-processor'
docker build -t customer-statement-processor .

# Run Docker container for image 'customer-statement-processor:latest'
docker container run --detach --publish 9090:9090 --name customer-statement-processor customer-statement-processor:latest

# Watch container logs
docker container logs -f customer-statement-processor

Build The Application - Using Maven

# Open new terminal tab, then run

# Clone repository
git clone https://github.com/devahmedshendy/customer-statement-processor.git

# Change directory to project
cd customer-statement-processor

# Build application using Maven
mvn clean package

# Run Spring boot application using Maven
mvn spring-boot:run

Test The Application

  • Monitor server-sent events
# Open separate terminal tab, then run
curl "http://localhost:9090/api/sse"
  • Test the application
# Open separate terminal tab, then run

# Change to project directory
cd customer-statement-processor

# Upload customer statement file that contains errors 
curl -X POST -H "Content-Type: multipart/form-data" -F "file=@./sample/bad_records.csv" "http://localhost:9090/api/storage"

# Upload customer statement file that doesn't contain errors 
curl -X POST -H "Content-Type: multipart/form-data" -F "file=@./sample/records.csv" "http://localhost:9090/api/storage"

# Get list of all uploaded files
curl -X GET "http://localhost:9090/api/storage"

# Get validation result for specific file
curl -X GET "http://localhost:9090/api/validation/{id}"

# Delete from file storage
curl -X DELETE "http://localhost:9090/api/storage?id={id}"

About

Bank X Customer Statement Processor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published