Go Bank Transfer is a simple API for some card-to-card transaction routines with notification messages, and then get the reports out of it
This is an attempt to implement a clean architecture, and some other design patterns such as adapter and singelton in combination
- Docker
- Docker-compose
- golang:1.18-alpine docker image
- mysql docker image
we have simple makefile in root of our project
make clean
will do everything for you to come up and runnig
URL | HTTP Method | Discription |
---|---|---|
/v1/transfers |
POST |
Make card to card transaction with Given json data |
/v1/report |
GET |
Gets you the Report of last transactions within 10 minutes last |
/v1/health |
ALL METHODS |
Checks App is up and Runnig |
you can test APIs with curl or post man as follow
curl -i --request POST 'http://localhost:8000/v1/transfer' \
--header 'Content-Type: application/json' \
--data-raw '{
"from_card_number": "5022291302421266",
"to_card_number": "5041721005782710"
"transaction_amount": 123456
}
{
"ReceiverMsg": {
"Msg": "\n واریز\n 5041721005782710\n به مبلغ\n 123456\n مانده\n 823456",
"To": "+989033934262"
},
"SenderMsg": {
"Msg": "\n برداشت از\n 5022291302421266\n به مبلغ\n 123456\n مانده\n 26044",
"To": "+989123993699"
},
"status": {
"Message": "Done"
}
}
you can also change text and formates of these messages by just changing xml files inside of /template
folder one for deposit.xml
and one for withdraw.xml
it also supports Persian Or Arabic Numbers like below but of course its and error because of wrong card number pattern !!!
{
"card_from_number" : "۱۲۳۴۵۶۷۸۱۲۳۴۵۶۷۸",
"card_to_number": "۱۲۳۴۵۶۷۸۱۲۳۴۵۶۷۸",
"transaction_amount":"۱۱۱۱۱"
}
this API will give you 3 tpos users within last 10 minutes
curl -i --request GET 'http://localhost:8000/v1/report'
you can give optional parameter as t like
curl -i --request GET 'http://localhost:8000/v1/report?t=1000'
it will change the default last 10 minutes time of query to 1000
[
{
"CustomerID": "1003",
"TransactionId": "1006",
"CardIdFrom": "4003",
"CardIdTo": "4007",
"Amount": 123456,
"TransactionType": 0,
"TransactionTime": "2023-04-02 07:36:54",
"Index": 1
},
{
"CustomerID": "1004",
"TransactionId": "1006",
"CardIdFrom": "4003",
"CardIdTo": "4007",
"Amount": 123456,
"TransactionType": 0,
"TransactionTime": "2023-04-02 07:36:54",
"Index": 1
}
]
still fixing bugs for v1
Copyright © 2020 Omid-h70. This project is MIT licensed. its free to EveryOne,
Thanks