Page though all lines (not using our db of lines and hitting one by one, but using the /lines API and just paging though it in as large as we can get the pages at once).
Any line under 100 MB left, check if they allow in their plan settings to buy more for this month (amount billed so far this month + 5GB price in their currency < configured limit) if no then send a warning “your data is running low and your configured limits do not allow buying more this month” if yes then check balance if it’s too low then use LowBalance to auto top up or warn (passing LowBalance the target amount) if topped up then proceed else done. If enough balance (or enough after auto top up runs) then hit the API to buy 5GB for this line and debit their balance.
If over 100MB but under 250MB check if they cannot be topped up because of plan limit or low balance and if so send a warning message (otherwise should we warn since it will just bill and keep working? also if their balance is low but auto top up is on should we bother warning? this is mostly for BTC users to run out and put more in before their data runs out I expect)
I see this is labeled as a jmp-pay and not an sgx-jmp
I also suggest this,
build the data top up functionality into sgx-jmp, then the payment implementation into jmp-pay.
sgx-jmp is then triggered to do the batch process by a jabber message from a cron job.
run cron job
cron job sends a jabber message to sgx-jmp
sgx-jmp does all the checks then charges with jmp-pay
sgx-jmp then uses keepgo api’s to do the data balances.
if keepgo balance is low, it tells and admin or does tops up company keepgo account (if an api for that exists)
“If over 100MB but under 250MB check if they cannot be topped up because of plan limit or low balance and if so send a warning message (otherwise should we warn since it will just bill and keep working?”
isn’t this the same as the statements preceding this? why is 100MB - 250MB special?
if balance is low with auto top up, a warning is still good but inform them auto renew is on.
but there’d be the issue of data running out while in use and then waiting for auto topup.