Commit b82a3511 by Solo Group

add time pput

1 parent 556de23b
...@@ -94,8 +94,9 @@ class Doc(Transaction): ...@@ -94,8 +94,9 @@ class Doc(Transaction):
self.log_info("REQUEST {}".format(data)) self.log_info("REQUEST {}".format(data))
try: try:
results = requests.post(url, json=data, headers=headers, timeout=timeout) # data=jsondata, results = requests.post(url, json=data, headers=headers, timeout=timeout) # data=jsondata,
except Excetions as e: except Exception as e:
print(e) print(e)
return
if results.status_code != 200: if results.status_code != 200:
self.log_error(results) self.log_error(results)
...@@ -185,6 +186,8 @@ class Doc(Transaction): ...@@ -185,6 +186,8 @@ class Doc(Transaction):
return self.ack_invalid_number() return self.ack_invalid_number()
data = self.get_data() data = self.get_data()
rows = self.send_rpc('inquiry', data) rows = self.send_rpc('inquiry', data)
if not rows:
return self.ack_inquiry_timeout()
if 'error' in rows: if 'error' in rows:
code = rows['error']['code'] \ code = rows['error']['code'] \
...@@ -562,7 +565,7 @@ class Doc(Transaction): ...@@ -562,7 +565,7 @@ class Doc(Transaction):
def ack_inquiry_timeout(self): def ack_inquiry_timeout(self):
msg = ERR_INQUIRY_TIMEOUT.format( msg = ERR_INQUIRY_TIMEOUT.format(
kd_bayar=self.invoice_id['Nomor Bayar']) kd_bayar=self.invoice_id['Nomor Bayar'])
self.ack_other(msg) self.ack_timeout(msg)
def ack_already_paid(self): def ack_already_paid(self):
msg = ERR_ALREADY_PAID.format(invoice_id=self.invoice_id_raw) msg = ERR_ALREADY_PAID.format(invoice_id=self.invoice_id_raw)
...@@ -576,7 +579,7 @@ class Doc(Transaction): ...@@ -576,7 +579,7 @@ class Doc(Transaction):
kd_bayar = self.invoice_profile['Nomor Bayar'] kd_bayar = self.invoice_profile['Nomor Bayar']
ntb = self.from_iso.get_ntb() ntb = self.from_iso.get_ntb()
msg = ERR_PAYMENT_TIMEOUT.format(kd_bayar=kd_bayar, ntb=ntb) msg = ERR_PAYMENT_TIMEOUT.format(kd_bayar=kd_bayar, ntb=ntb)
self.ack_other(msg) self.ack_timeout(msg)
def ack_payment_failed(self, result): def ack_payment_failed(self, result):
kd_bayar = self.invoice_profile['Nomor Bayar'] kd_bayar = self.invoice_profile['Nomor Bayar']
...@@ -601,7 +604,7 @@ class Doc(Transaction): ...@@ -601,7 +604,7 @@ class Doc(Transaction):
kd_bayar = self.invoice_profile['Nomor Bayar'] kd_bayar = self.invoice_profile['Nomor Bayar']
ntb = self.from_iso.get_ntb() ntb = self.from_iso.get_ntb()
msg = ERR_REVERSAL_TIMEOUT.format(kd_bayar=kd_bayar, ntb=ntb) msg = ERR_REVERSAL_TIMEOUT.format(kd_bayar=kd_bayar, ntb=ntb)
self.ack_other(msg) self.ack_timeout(msg)
def ack_reversal_failed(self, result): def ack_reversal_failed(self, result):
kd_bayar = self.invoice_profile['Nomor Bayar'] kd_bayar = self.invoice_profile['Nomor Bayar']
......
...@@ -259,5 +259,8 @@ class Transaction(BaseTransaction, Log): ...@@ -259,5 +259,8 @@ class Transaction(BaseTransaction, Log):
self.setBit(62, msg) self.setBit(62, msg)
BaseTransaction.ack_other(self, msg) BaseTransaction.ack_other(self, msg)
def ack_timeout(self, msg='Biller Timeout'):
self.ack(68, msg)
def set_transaction_code(self, code): def set_transaction_code(self, code):
self.setBit(3, code) self.setBit(3, code)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!