Commit d01a0791 by Solo Group

VSI

1 parent 2b576d2f
......@@ -25,7 +25,7 @@ def build_request(typ, vendor_produk, partner_log=None):
if cls:
data = cls()
result = data
# dict(data=data)
log.info("Build Req: mod %s rslt: %s" % (vendor_produk.modules, data))
result["f_result"] = cls_module.result
result["f_request"] = cls_module.request
result["f_response"] = cls_module.response
......
......@@ -184,10 +184,9 @@ 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 {}
self.vend_inv_no = "order_id" in data and data["order_id"] or None
if not 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
......@@ -196,6 +195,7 @@ class Vendor(VendorClass):
parsd["discount"] = inq["discount"]
self.result = parsd
log.info("ODEO Payment Result: %s" % self.result)
self.save_log('payment')
return parsd
......
......@@ -104,12 +104,13 @@ class Vendor(VendorClass):
partner_id = self.invoice_det.ar_invoice.customer_id
discount = PartnerProduk.get_discount(partner_id, product_id)
harga = self.vendor_produk.produk.harga
self.status = 1
if not harga:
raise JsonRpcError()
else:
discount = 0
harga = 0
self.status = -1
result = dict(
status="status" in data and data["status"] or "FAILED",
......@@ -118,9 +119,9 @@ class Vendor(VendorClass):
and (data["rcm"] == "00000" and "Sukses" or data["rcm"]) \
or "PENDING",
serial_number="serialnumber" in data and data["serialnumber"] or "",
subtotal=harga,
discount=discount,
total = harga-discount
subtotal=int(harga),
discount=int(discount),
total = int(harga-discount)
)
return result
......@@ -162,7 +163,8 @@ class Vendor(VendorClass):
data = xmltodict.parse(result.text)["root"]
self.response = data
else:
data = dict(error=result.status_code)
data = dict(code=result.status_code,
message=result.text)
except requests.exceptions.RequestException as e:
data = dict(code=e.errno,
message=e.strerror)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!