can print balance now

This commit is contained in:
Shihaam Abdul Rahman 2022-11-16 23:50:35 +05:00
parent d3c9f9efc8
commit b0f07dc028
Signed by: shihaam
GPG Key ID: 5641D129E0B55604

32
get-balance.sh Normal file → Executable file
View File

@ -1,30 +1,24 @@
#!/bin/bash #!/bin/bash
#Import variables
#Import variable
source .env source .env
get_balance(){
#Login #Login
$curl -s -c $COOKIE $BML_URL/login \ $curl -s -c $COOKIE $BML_URL/login \
--data-raw username=$BML_USERNAME \ --data-raw username=$BML_USERNAME \
--data-raw password=${BML_PASSWORD} --data-raw password=${BML_PASSWORD} > /dev/null
echo ""
echo "Login done"; sleep 2
echo ""
# Get profiles and select personal profile # Get profiles and select personal profile
#$curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] | .profile' | head -n 1 PROFILE=$($curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] | .profile' | head -n 1)
$curl -s -b $COOKIE $BML_URL/profile $curl -s -b $COOKIE $BML_URL/profile \
echo "" --data-raw profile=$PROFILE >> /dev/null
echo "Get Profile done"; sleep 2
echo ""
# Getting dashboard
BALANCE=$($curl -s -b $COOKIE $BML_URL/dashboard | jq -r '.payload | .dashboard |.[] | [.availableBalance] | .[]' | head -n1)
}
get_balance
# Print Balance
echo MVR: $BALANCE
#PROFILE=$($curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] | .profile' | head -n 1)
#$curl -s -b $COOKIE $BML_URL/profile \
# --data-raw profile=$PROFILE >> /dev/null
#
#$curl -s -c $COOKIE $BML_URL/api/dashboard