Commit 0bb582cf by Solo Group

ar_invoce

1 parent 8dab2fbb
......@@ -94,11 +94,15 @@ class Vendor(VendorClass):
self.save_log('inquiry')
return parsd
def gagal_transaksi(self):
self.status = -2
def gagal_transaksi(self, code):
if code==400:
self.status = -3
else:
self.status = -2
parsd = dict(
status="FAILED",
code=-2,
code=code,
message="Gagal Transaksi"
)
self.result = parsd
......@@ -132,7 +136,7 @@ class Vendor(VendorClass):
data = "data" in result and result["data"] or None
# cel rc status
if not data:
return self.gagal_transaksi()
return self.gagal_transaksi(500)
if "rc" in data:
parsd["code"] = int(data["rc"])
......@@ -164,7 +168,8 @@ class Vendor(VendorClass):
return parsd
else: # BAD REQUEST
return self.gagal_transaksi()
return self.gagal_transaksi(resp.status_code)
def advice(self):
......
......@@ -192,9 +192,14 @@ def proses_odeo(request):
if status == "COMPLETED":
order.status = 1
else:
order.status = -1
order.status = -2
order.notify = data
flush_row(order)
#todo: add to customer notify table
#todo: create cron for notify
#proses jika status 1 notify ada isinya tapi belum ada field result
#todo: create cron torecurring order to other vendor
#jika status = -2 proses vendor yang lain
#
# customer = Partner.query_id(order.customer_id).first()
# if customer and customer.website:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!