#!/bin/bash # Login and save cookie echo " 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 " 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 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 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