mib-payment-verify/README.md

100 lines
3.1 KiB
Markdown
Raw Normal View History

2024-10-20 01:41:57 +05:00
### Maldives Islamic Bank Payment Verification API
2024-10-22 01:52:46 +05:00
- This api will allow you to match customers payment and your MIB account history, it will match with transaction time, account owner name and amount.
2024-10-22 01:53:50 +05:00
- Issue with using account number name is that, MIB to MIB transaction sometimes have MIBs made-up name for the account owner name, This is challenging, so work around that, I added option to send customers account number to fetch the made-up name and match with it.
2024-10-22 01:52:46 +05:00
- BML (Farava) transations works perfectly with just the name!
- It uses cookie from webssion to fetch everything, it also has a keepalive service so websession does not expire after 5mins.
2024-10-22 01:22:45 +05:00
## How to deploy/get started (with docker/podman)
2024-10-22 01:36:16 +05:00
1. Login to MIB web [https://faisanet.mib.com.mv/](https://faisanet.mib.com.mv/) and get the cookie:
2024-10-22 01:22:45 +05:00
![get_cookie_env.png](get_cookie_env.png)
2024-10-22 01:45:20 +05:00
2. copy .env.example to .env and fill `QL_0` and `IBSID` with contents from step 1, Make sure to fill `ACCOUNT_NUMBER` with your account number.
2024-10-22 01:36:16 +05:00
3. Create `compose.yml` with the follwing contents:
2024-10-22 01:22:45 +05:00
```yaml
services:
keepalive:
env_file: .env
image: git.shihaam.dev/shihaam/mib-payment-verify/keepalive
api:
env_file: .env
image: git.shihaam.dev/shihaam/mib-payment-verify/api
ports:
- 5000:5000
```
3. Run `docker compose up -d` and that is all.
2024-10-22 01:36:16 +05:00
## Using the API with curl examples:
2024-10-20 01:33:33 +05:00
1. With both benefName and accountNo:
2024-10-20 01:39:32 +05:00
```bash
2024-10-20 01:33:33 +05:00
curl -X POST http://localhost:5000/verify-payment \
-H "Content-Type: application/json" \
-d '{
"benefName": "ABDLA.MAJUDHU AHMED",
"accountNo": "90103101178641000",
"absAmount": "100",
"time": "2024-10-16 16:08"
}'
```
In this request, it will first try to verify with benfName, if it fails, then it will try with accountNo.
2. With only benefName:
2024-10-20 01:39:32 +05:00
```bash
2024-10-20 01:33:33 +05:00
curl -X POST http://localhost:5000/verify-payment \
-H "Content-Type: application/json" \
-d '{
"benefName": "ABDLA.MAJUDHU AHMED",
"absAmount": "100",
"time": "2024-10-16 16:08"
}'
```
3. With only accountNo:
2024-10-20 01:39:32 +05:00
```bash
2024-10-19 03:11:52 +05:00
curl -X POST http://localhost:5000/verify-payment \
-H "Content-Type: application/json" \
-d '{
2024-10-20 01:33:33 +05:00
"accountNo": "90103101178641000",
2024-10-19 03:11:52 +05:00
"absAmount": "100",
2024-10-20 01:33:33 +05:00
"time": "2024-10-16 16:08"
2024-10-19 03:11:52 +05:00
}'
```
2024-10-20 01:39:32 +05:00
2024-10-22 01:36:16 +05:00
## Exmaple Succcess responses:
2024-10-20 01:39:32 +05:00
1. Both benefName and accountNo or only benefName provided
```json
{
"message": "Payment verified using beneficiary name",
"success": true,
"transaction": {
"ref": "MALBIPS20241208190231 HBTLGAKCNUS",
"sourceBank": "BML",
"trxDate": "2024-12-09 00:02:36"
}
2024-10-20 01:39:32 +05:00
}
2024-10-20 01:39:32 +05:00
```
2. Both benefName and accountNo or only accountNo provided, but failed with benefName
```json
{
"message": "Payment verified using account number",
"success": true,
"transaction": {
"ref": "1-77722758-34140519-1",
"sourceBank": "MIB",
"trxDate": "2024-12-05 12:57:32"
}
2024-10-20 01:39:32 +05:00
}
```
2024-10-22 01:36:16 +05:00
## Example Failed response:
1. If transaction is not found with the provided details.
2024-10-20 01:39:32 +05:00
```json
{
"message": "Transaction not found, contact support",
"success": false
}
```