Commit 34d109a7 by taufikyu

perbaiki error handling bjb va

1 parent dd410676
...@@ -582,7 +582,7 @@ def sendrpc(request, kd_bayar): ...@@ -582,7 +582,7 @@ def sendrpc(request, kd_bayar):
headers = {'Content-Type':'application/json'} headers = {'Content-Type':'application/json'}
if not 'pemdaqris_url' in settings and not settings['pemdaqris_url']: if not 'pemdaqris_url' in settings and not settings['pemdaqris_url']:
log.error('pemdaqris_url belum ada di settings') log.error('pemdaqris_url belum ada di settings')
return raise Exception('pemdaqris_url belum ada di settings')
url = settings['pemdaqris_url'] url = settings['pemdaqris_url']
try: try:
...@@ -591,7 +591,14 @@ def sendrpc(request, kd_bayar): ...@@ -591,7 +591,14 @@ def sendrpc(request, kd_bayar):
headers=headers, headers=headers,
verify=False) verify=False)
log.info('Response RPC CALLBACK PEMDA : {}'.format(resp.content)) log.info('Response RPC CALLBACK PEMDA : {}'.format(resp.content))
try:
jsonr = json.loads(resp.content)
if jsonr.get('success')==False:
raise Exception(jsonr.get('message'))
except Exception as err:
log.error(err)
raise Exception(err)
return True return True
except requests.exceptions.RequestException as err: except requests.exceptions.RequestException as err:
log.error('Error send BJBQRIS to pemda : {}'.format(err)) log.error('Error send BJBQRIS to pemda : {}'.format(err))
return
\ No newline at end of file \ No newline at end of file
raise Exception(err)
\ No newline at end of file \ No newline at end of file
...@@ -678,7 +678,7 @@ def sendrpc(request, kd_bayar): ...@@ -678,7 +678,7 @@ def sendrpc(request, kd_bayar):
headers = {'Content-Type':'application/json'} headers = {'Content-Type':'application/json'}
if not 'pemdava_url' in settings and not settings['pemdava_url']: if not 'pemdava_url' in settings and not settings['pemdava_url']:
log.error('pemdava_url belum ada di settings') log.error('pemdava_url belum ada di settings')
return raise Exception('pemdava_url belum ada di settings')
url = settings['pemdava_url'] url = settings['pemdava_url']
try: try:
...@@ -687,7 +687,14 @@ def sendrpc(request, kd_bayar): ...@@ -687,7 +687,14 @@ def sendrpc(request, kd_bayar):
headers=headers, headers=headers,
verify=False) verify=False)
log.info('Response RPC CALLBACK PEMDA : {}'.format(resp.content)) log.info('Response RPC CALLBACK PEMDA : {}'.format(resp.content))
try:
jsonr = json.loads(resp.content)
if jsonr.get('success')==False:
raise Exception(jsonr.get('message'))
except Exception as err:
log.error(err)
raise Exception(err)
return True return True
except requests.exceptions.RequestException as err: except requests.exceptions.RequestException as err:
log.error('Error send BJBVA to pemda : {}'.format(err)) log.error('Error send BJBVA to pemda : {}'.format(err))
return
\ No newline at end of file \ No newline at end of file
raise Exception(err)
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!