Skip to content

blueswallow99/anyfin-pythondev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anyfin-Pythondev

Built With

Design

I used flask to deploy this small API for credit policies, project contains a simple app.py, Dockerfile, docker-compose.yml, and a requirements.txt. It's a simple rest API which can return all of the reasons for credit rejection. I used a decorator for the /ceredit-policies API to catch exception and return a meaningfull response.

I choose to keep the API simple for now, but I could have made an authentication system to send requests and save data to related users if they got accepted to use in further processes.

Installation

1: clone the project in to your device or server

2: go into project directory

3: run command sudo docker-compose up

4: send your requests to http://localhost/credit-policies or http://localhost:5000/credit-policies

Request and Response examples

request 1:

{
   "data":{
               "customer_income": 1000,
               "customer_debt": 500,
               "payment_remarks_12m": 0,
               "payment_remarks": 1,
               "customer_age": 20
           }
}

response 1:

{
   "category": "ACCEPT",
   "message": "credit check passed",
   "status": 200
}

request 2:

{
   "data":{
               "customer_income": 1000,
               "customer_debt": 5000,
               "payment_remarks_12m": 3,
               "payment_remarks": 1,
               "customer_age": 20
           }
}

response 2:

{
   "category": "REJECT",
   "message": [
       "HIGH_DEBT_FOR_INCOME",
       "PAYMENT_REMARKS_12M"
   ],
   "status": 200
}

request 3:

{
   "data":{
               "customer_income": 100,
               "customer_debt": 5000,
               "payment_remarks_12m": 13,
               "payment_remarks": 4,
               "customer_age": 17
           }
}}

response 3:

{
   "category": "REJECT",
   "message": [
       "LOW_INCOME",
       "HIGH_DEBT_FOR_INCOME",
       "PAYMENT_REMARKS_12M",
       "PAYMENT_REMARKS",
       "UNDERAGE"
   ],
   "status": 200
}

request 4:

{
   "data":{
               "customer_income": 100,
               "customer_debt": 50,
               "payment_remarks_12m": 0,
               "payment_remarks": 1,
               "customer_age": 22
           }
}

response 4:

{
   "category": "REJECT",
   "message": [
       "LOW_INCOME"
   ],
   "status": 200
}

request 5:

{
   "data":{
               "customer_income": 10000,
               "customer_debt": 505,
               "payment_remarks_12m": 0,
               "customer_age": 34
           }
}

response 5:

{
   "message": [
       "payment_remarks"
   ],
   "status": 500
}

Contact

Parastoo Maleki - [email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published