Commit 620a10d2969182682c264e78ff5e44cf7db97ecc
1 parent
90278b780f
Exists in
master
disable_by_monthly_limit
Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff
main.py
... | ... | @@ -41,6 +41,7 @@ BALANCE = 0 |
41 | 41 | |
42 | 42 | DISABLE_SEM=0 |
43 | 43 | DISABLE_SEM_ON_TRX=60 |
44 | +DISABLE_BY_MONTHLY_LIMIT=False | |
44 | 45 | |
45 | 46 | LAST_REQUEST_ID = None |
46 | 47 | LAST_SN = None |
... | ... | @@ -66,6 +67,7 @@ redis_client = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT, db=0) |
66 | 67 | |
67 | 68 | def handleSms(sms): |
68 | 69 | global DISABLE_SEM |
70 | + global DISABLE_BY_MONTHLY_LIMIT | |
69 | 71 | |
70 | 72 | logger.info(u'Incoming SMS from: {0}; Time: {1}; Message: {2}'.format(sms.number, sms.time, sms.text)) |
71 | 73 | |
... | ... | @@ -96,6 +98,7 @@ def handleSms(sms): |
96 | 98 | |
97 | 99 | elif sms.text.find('Mohon maaf, transaksi Anda melebihi limit nominal bulanan') >= 0: |
98 | 100 | pushTopupStatus(LAST_REQUEST_ID, '40', sms.text) |
101 | + DISABLE_BY_MONTHLY_LIMIT = True | |
99 | 102 | return |
100 | 103 | |
101 | 104 | elif sms.text.find('Maaf, transaksi Anda masih dalam proses') >= 0: |
... | ... | @@ -480,7 +483,9 @@ def publishMessageToRedis(): |
480 | 483 | pass |
481 | 484 | |
482 | 485 | def pullLoop(modem): |
483 | - while (True): | |
486 | + global DISABLE_BY_MONTHLY_LIMIT | |
487 | + | |
488 | + while not DISABLE_BY_MONTHLY_LIMIT: | |
484 | 489 | pull(modem) |
485 | 490 | sleep(PULL_INTERVAL) |
486 | 491 |