Commit 60870575 by Solo Group

auto-push

1 parent 5d678412
......@@ -133,14 +133,20 @@ class Vendor(VendorClass):
number=self.id_pel
)
)
self.request = params
log.info("ODEO Payment Request: %s" % self.request)
self.save_log("payment")
inq = None
if self.vendor_produk.produk.kategori=="e-payment":
inq = self.inquiry()
resp = self.request_post(params, '/prepaid/purchase')
try:
result = json.loads(resp.text)
except:
result = resp and resp.text or ""
result = resp and resp.text or {}
self.response = result
log.info("ODEO Payment Response: %s" % self.response)
......@@ -148,9 +154,10 @@ class Vendor(VendorClass):
# 0200 ok
# 0400 bad request
# 0401 auth error
parsd = {}
if resp.status_code == 200: # 0200
data = "data" in result and result["data"] or None
if resp.status_code == 200 and type(result) is dict: # 0200
data = "data" in result and result["data"] or {}
# cel rc status
if not data:
return self.gagal_transaksi(500)
......@@ -176,10 +183,17 @@ class Vendor(VendorClass):
self.serial_number = 'serial_number' in data and data["serial_numner"] \
or self.serial_number
self.vend_inv_no = "order_id" in data and data["order_id"] or None
self.amt_buy = "price" in data and data["price"] or 0
self.vend_inv_no = "order_id" in data and data["order_id"] or {}
if inq:
self.amt_buy = "price" in data and data["price"] or 0
parsd["total"] = self.amt_buy
else:
self.amt_buy = "price" in data and data["price"] or 0
parsd["total"] = inq["total"]
parsd["subtotal"] = inq["subtotal"]
parsd["discount"] = inq["discount"]
parsd["total"] = self.amt_buy
self.result = parsd
self.save_log('payment')
return parsd
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!