Skip to content

Commit

Permalink
Add --allow-remaining option
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Dec 30, 2023
1 parent 05201fb commit f027154
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,41 @@ each individual payment you receive will have an associated bank-transfer
generated.

```
$ venmo-auto-cashout --token=XXX
Your balance is $74.95
$ venmo-auto-cashout --token=XXX --allow-remaining
Your balance is $50
There are 3 transactions to cash-out
-> Transfer: $15.00 -- Mako (Dia beacon museum tickets)
-> Transfer: $15.00 -- David (Dia beacon museum tickets)
-> Transfer: $20.00 -- Randolf (Dinner)
-> Transfer: $24.95 of remaining balance
All money transfered out!
```

This can be used as a cron script to automatically cash out your Venmo for you.

### Consistent tracking

By default the tool will only cashout amounts ammounts that add up to the most
recent transactions. This is useful when the script is running on a cron-job
and you want to be sure it never misses an individual payment cash out (This
can happen when the tool runs immeidatley after a payment is recieved, but
before the payment appears in the transaction list)

If you wish to cash-out everything use the `--allow-remaining` option.
Otherwise the tool will exit when there is a remainder.

```
$ venmo-auto-cashout --token=XXX --allow-remaining
Your balance is $39.95
There are 3 transactions to cash-out
-> Transfer: $15.00 -- Mako (Dia beacon museum tickets)
-> Transfer: $24.95 of remaining balance
All money transfered out!
```

### Lunchmoney integration

In addition to automatic-cashout, this script can also integrate with
Expand Down
12 changes: 11 additions & 1 deletion venmo_auto_cashout/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def run_cli():
action=argparse.BooleanOptionalAction,
help="Do not actually initiate bank transfers",
)
parser.add_argument(
"--allow-remaining",
action=argparse.BooleanOptionalAction,
help="Allow remaining balance to be cashed-out",
)
parser.add_argument(
"--token",
type=str,
Expand Down Expand Up @@ -194,7 +199,12 @@ def output(msg: str):

# Nothing left to do in dry-run mode
if args.dry_run:
output("\ndry-run -- Not initiating transfers")
output("\ndry-run. Not initiating transfers")
return

# Do not cash out if
if not args.allow_remaining and remaining_balance > 0:
output("\nRemaining balance without --allow-remaining. Not initiating transfers")
return

# Do the transactions
Expand Down

0 comments on commit f027154

Please sign in to comment.