Commit f2168af1 by Solo Group

vsi_pln_post

1 parent 8721ff30
......@@ -15,6 +15,25 @@ from .vsi import Vendor as VendorClass
class Vendor(VendorClass):
# def __init__(self, product_kd, trx_id=None, cid=None):
# VendorClass.__init__(self, product_kd, cid)
def pars_data(self, data):
return {
"bill_no": "subid" in data and data["subid"] or self.bill_no,
"nama": "nama" in data and data["nama"] or "NO-NAME",
"pokok": "tagihan" in data and data["tagihan"] or 0,
"denda": "denda" in data and data["denda"] or 0,
"admin": "admin" in data and data["admin"] or 0,
"total": "total" in data and data["total"] or 0,
"ppn": "ppn" in data and data["ppn"] or 0,
"trx_id": "trxid" in data and data["trxid"] or self.partner_log_id,
"ref_no": "refnum" in data and data["refnum"] or "",
"jml_bulan": "bulan" in data and data["bulan"] or "",
"tgh_bulan": "blth" in data and data["blth"] or "",
"tarif": "tarif" in data and data["tarif"] or "",
"tgl_bayar" : "date" in data and data["date"] or "",
"info" : "info1" in data and data["info1"] or "",
"stand_meter" : "standmeter" in data and data["standmeter"] or "",
}
def inquiry(self):
"""
:return:
......@@ -91,18 +110,8 @@ class Vendor(VendorClass):
self.response = data
self.save_log('inquiry', row)
if "status" in data and data["status"] and data["status"] == "SUCCESS":
data = {
"bill_no": "subid" in data and data["subid"] or self.bill_no,
"nama": "nama" in data and data["nama"] or "NO-NAME",
"pokok": "tagihan" in data and data["tagihan"] or 0,
"admin": "admin" in data and data["admin"] or 0,
"total": "total" in data and data["total"] or 0,
"trx_id": "trxid" in data and data["trxid"] or row.id,
"ref_no": "refnum" in data and data["refnum"] or "",
"jml_bulan": "bulan" in data and data["bulan"] or "",
"tgh_bulan": "blth" in data and data["blth"] or "",
"tarif": "tarif" in data and data["tarif"] or "",
}
data = self.pars_data(data)
elif "status" in data and data["status"] and data["status"] == "ERROR":
#todo: apakah data akan dimapping errornya?
data = dict(error=data["rcm"],
......@@ -175,4 +184,11 @@ class Vendor(VendorClass):
data = dict(error=result.status_code)
self.response = data
self.save_log('payment', row)
if "status" in data and data["status"] and data["status"] == "SUCCESS":
data = self.pars_data(data)
elif "status" in data and data["status"] and data["status"] == "ERROR":
#todo: apakah data akan dimapping errornya?
data = dict(error=data["rcm"],
code=data["rc"])
return data
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!