26 lines
1.1 KiB
Bash
26 lines
1.1 KiB
Bash
#!/bin/bash
|
||
|
||
# Login and save cookie
|
||
echo "<22><><EFBFBD> Logging in..."
|
||
curl -c cookies.txt -X POST http://localhost:8080/api/auth/login \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"email":"test@skymoney.com","password":"password123"}' > /dev/null 2>&1
|
||
|
||
# Check current plans
|
||
echo "<22><><EFBFBD> Plans BEFORE income:"
|
||
curl -s -b cookies.txt http://localhost:8080/api/fixed-plans | jq '.plans[] | {name: .name, funded: (.fundedCents/100), total: (.totalCents/100), isOverdue: .isOverdue, overdueAmt: (.overdueAmount/100)}'
|
||
|
||
# Post $1000 income
|
||
echo -e "\n<><6E><EFBFBD> Posting $1000 income..."
|
||
RESULT=$(curl -s -b cookies.txt -X POST http://localhost:8080/api/income \
|
||
-H "Content-Type: application/json" \
|
||
-d "{\"amountCents\": 100000, \"postedAt\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\", \"note\": \"Test income\"}")
|
||
|
||
echo "$RESULT" | jq '{overduePaid, fixedAllocations, variableAllocations}'
|
||
|
||
# Check plans after
|
||
echo -e "\n<><6E><EFBFBD> Plans AFTER income:"
|
||
curl -s -b cookies.txt http://localhost:8080/api/fixed-plans | jq '.plans[] | {name: .name, funded: (.fundedCents/100), total: (.totalCents/100), isOverdue: .isOverdue, overdueAmt: (.overdueAmount/100)}'
|
||
|
||
rm -f cookies.txt
|