Commit 685979f2 by Solo Group

pars odeo

1 parent 6a9c70e9
...@@ -68,15 +68,22 @@ class Vendor(VendorClass): ...@@ -68,15 +68,22 @@ class Vendor(VendorClass):
except: except:
content = resp.text content = resp.text
self.status = 1
if resp.ok: if resp.ok:
result = content self.status = 1 # sukses
result = json.loads(content)
parsd = self.pars_data(result)
elif resp.status_code == 400:
self.status = -3
parsd = dict(code=resp.status_code,
message=resp.text)
else: else:
result = dict(code=resp.status_code, self.status = -4
message=resp.text) parsd = dict(code=500,
message="Other Error")
self.response = content self.response = content
self.save_log('inquiry') self.save_log('inquiry')
return self.pars_data(result) return parsd
def payment(self): def payment(self):
if not self.v_produk_kd or not self.bill_no: if not self.v_produk_kd or not self.bill_no:
...@@ -96,16 +103,21 @@ class Vendor(VendorClass): ...@@ -96,16 +103,21 @@ class Vendor(VendorClass):
content = resp.text content = resp.text
if resp.ok: if resp.ok:
result = content self.status = 1 # sukses
self.status = 1 result = json.loads(content)
parsd = self.pars_data(result)
elif resp.status_code==400:
self.status = -3
parsd = dict(code=resp.status_code,
message=resp.text)
else: else:
self.status = -1 self.status = -4
result = dict(code=resp.status_code, parsd = dict(code=500,
message=resp.text) message="Other Error")
self.response = content self.response = content
self.save_log('payment') self.save_log('payment')
return self.pars_data(result) return parsd
def advice(self): def advice(self):
if not self.v_produk_kd or not self.bill_no or not self.partner_log_id: if not self.v_produk_kd or not self.bill_no or not self.partner_log_id:
...@@ -135,12 +147,17 @@ class Vendor(VendorClass): ...@@ -135,12 +147,17 @@ class Vendor(VendorClass):
if resp.ok: if resp.ok:
self.status = 1 # sukses self.status = 1 # sukses
result = json.loads(content) result = json.loads(content)
else: parsd = self.pars_data(result)
self.status = -1 elif resp.status_code==400:
self.status = -3
result = dict(code=resp.status_code, result = dict(code=resp.status_code,
message=resp.text) message=resp.text)
else:
self.status = -4
parsd = dict(code=500,
message="Other Error")
self.response = content self.response = content
parsd = self.pars_data(result)
self.save_log('advice') self.save_log('advice')
return parsd return parsd
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!