Commit 4e9e94faee69ead57813d60be3a039d5e7cafd87
1 parent
42d1be1a8d
Exists in
master
update balance setelah terima uang xltunai
Showing 1 changed file with 11 additions and 3 deletions Side-by-side Diff
main.py
... | ... | @@ -164,6 +164,7 @@ def handleSms(sms): |
164 | 164 | if sms.text.find('Anda terima uang XLTunai') >= 0: |
165 | 165 | LAST_SN = xltunai.getSNFromReceiveTransferMessage(sms.text) |
166 | 166 | logger.info('Override LAST_SN: {0}'.format(LAST_SN)) |
167 | + checkBalance(modem) | |
167 | 168 | return |
168 | 169 | |
169 | 170 | if sms.text.find('Kirim uang ke ') == 0: |
... | ... | @@ -639,9 +640,16 @@ def checkBalance(modem, do_not_update = False, return_result = False): |
639 | 640 | if response.sessionActive: |
640 | 641 | response.cancel() |
641 | 642 | |
642 | - if _BALANCE != 0 and _BALANCE < MIN_BALANCE: | |
643 | - logger.info('Disabling pull, balance {0} < {1}'.format(_BALANCE, MIN_BALANCE)) | |
644 | - disablePull() | |
643 | + if _BALANCE != 0: | |
644 | + if BALANCE < MIN_BALANCE: | |
645 | + | |
646 | + logger.info('Disabling pull, balance {0} < {1}'.format(_BALANCE, MIN_BALANCE)) | |
647 | + disablePull() | |
648 | + | |
649 | + else: | |
650 | + | |
651 | + logger.info('Enabling pull, balance {0} > {1}'.format(_BALANCE, MIN_BALANCE)) | |
652 | + enablePull() | |
645 | 653 | |
646 | 654 | except: |
647 | 655 | logger.warning('Error when requesting BALANCE by USSD') |