a97d52bc59c8592cd05cde14057500451be04686
				
			
			
		
	
		
			All checks were successful
		
		
	
	Build and Push Docker Images / Build and Push Docker Images (push) Successful in 47s
				
			Maldives Islamic Bank Payment Verification API
- 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.
 - 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.
 - 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.
 
How to deploy/get started (with docker/podman)
- Login to MIB web https://faisanet.mib.com.mv/ and get the your profile id and type:

 - copy .env.example to .env and fill your MIB Username, Password and TOTP Seed, 
PROFILE_IDandPROFILE_TYPEneeds to be filled with contents from step 1, Make sure to fillACCOUNT_NUMBERwith your account number. - Create 
compose.ymlwith the follwing contents: 
services:
  keepalive:
    env_file: .env
    image: git.shihaam.dev/shihaam/mib-payment-verify/keepalive
  cookieserver:
    env_file: .env
    image: git.shihaam.dev/shihaam/mib-payment-verify/cookieserver
  api:
    env_file: .env
    image: git.shihaam.dev/shihaam/mib-payment-verify/api
    ports:
      - 5000:5000
- Run 
docker compose up -dand that is all. 
Using the API with curl examples:
- With both benefName and accountNo:
 
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.
- With only benefName:
 
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"
         }'
- With only accountNo:
 
curl -X POST http://localhost:5000/verify-payment \
     -H "Content-Type: application/json" \
     -d '{
           "accountNo": "90103101178641000",
           "absAmount": "100",
           "time": "2024-10-16 16:08"
         }'
Exmaple Succcess responses:
- Both benefName and accountNo or only benefName provided
 
{
  "message": "Payment verified using beneficiary name",
  "success": true,
  "transaction": {
    "ref": "MALBIPS20241208190231 HBTLGAKCNUS",
    "sourceBank": "BML",
    "trxDate": "2024-12-09 00:02:36"
  }
}
- Both benefName and accountNo or only accountNo provided, but failed with benefName
 
{
  "message": "Payment verified using account number",
  "success": true,
  "transaction": {
    "ref": "1-77722758-34140519-1",
    "sourceBank": "MIB",
    "trxDate": "2024-12-05 12:57:32"
  }
}
Example Failed response:
- If transaction is not found with the provided details.
 
{
  "message": "Transaction not found, contact support",
  "success": false
}
- If session times out
 
{
  "message": "Error from tx.sh: Session Expired",
  "success": false
}
- If 500 from server
 
{
    "message": "Internal server error"
    "success": false,
}
Description
				
					Languages
				
				
								
								
									Python
								
								81.7%
							
						
							
								
								
									Shell
								
								13.1%
							
						
							
								
								
									Dockerfile
								
								5.2%