Commit a2a25d8d by Solo Group
2 parents ed7bdb93 85ff40f5
......@@ -76,30 +76,37 @@ def purchase_notify(order):
def payment_notify(order):
customer = order.customer
# if customer: # for test
if customer and customer.website:
url = customer.website
users = customer.users
typ = "PAYMENT"
key = order.cust_inv_no + users.user_name + users.api_key + typ
signature = sha256(key)
data = dict(
data = order.notify["result"]
# tx_id merchant harus dikirim
tx_id = order.tx_id
if not tx_id:
pay_request = 'request' in order.payment and order.payment['request'] or {}
tx_id = 'tx_id' in pay_request and pay_request['tx_id'] or ""
data.update(dict(
invoice_no=order.cust_inv_no,
signature=signature,
type=typ
)
data.update(order.notify["result"])
type=typ,
tx_id=tx_id
))
# data.update(order.notify["result"])
# print('>>>', json.dumps(data, indent=4, sort_keys=True))
js = get_jsonrpc(method="notify", params=dict(data=data))
log.info("Notify: %s %s" % (url, js))
try:
# pass
requests.post(url, data=js, timeout=20)
except:
pass
return
def proses_np(data):
# todo:
pass
@view_config(route_name='api-vendor-notify', renderer='json')
def api_vendor_notify(request):
......
......@@ -16,27 +16,37 @@ class Vendor(VendorClass): # VendorClass
def __init__(self, vendor_produk, invoice_det, **kwargs):
VendorClass.__init__(self, vendor_produk, invoice_det=invoice_det, **kwargs)
settings = get_settings()
self.v_produk_kd = vendor_produk.kode
self.bank_cd, self.pay_method = self.v_produk_kd.split('-')
self.mid = 'np_mid' in settings and settings['np_mid'] or None
# khusus payloan, imidnya tersendiri. jika tdk diset, maka disamakan dgn yg lain
# tambahkan setting np_loan_mid di ini file
if self.pay_method == '06' and 'np_loan_mid' in settings and settings['np_loan_mid']:
self.mid = settings['np_load_mid']
self.key = 'np_key' in settings and settings['np_key'] or None
self.url = 'np_url' in settings and settings['np_url'] or None
self.callback_url = "{}/api/vendor/np/callback".format(get_host())
self.notify_url = "{}/api/vendor/np/notify".format(get_host())
key = ":".join([self.mid, self.key]).encode()
self.auth = base64.b64encode(key).decode()
self.v_produk_kd = vendor_produk.kode
self.ccard = "ccard" in kwargs and kwargs["ccard"] or None
self.cp = "cp" in kwargs and kwargs["cp"] or None
self.cvs = "cvs" in kwargs and kwargs["cvs"] or None
self.va = "va" in kwargs and kwargs["va"] or None
self.pl = "pl" in kwargs and kwargs["pl"] or None
customer = self.invoice_det.customer
if customer:
self.cust_kd = customer.kode
self.cust_inv_no = self.invoice_det.cust_inv_no
self.bank_cd, self.pay_method = self.v_produk_kd.split('-')
if self.pay_method == "02" and is_devel():
self.mid = "VACTFOPEND"
# self.mid = "VACTFOPEND" # sama dgn yang lain
key = ":".join([self.mid, self.key]).encode()
self.auth = base64.b64encode(key).decode()
......@@ -164,10 +174,12 @@ class Vendor(VendorClass): # VendorClass
Nicepay.set('vacctValidTm', self.invoice_det.inv_valid_time)
if self.invoice_det.inv_cust_va:
self.va_typ = 'fixed'
Nicepay.set('merFixAcctId', self.invoice_det.inv_cust_va)
# Nicepay.set('merFixAcctId', self.invoice_det.inv_cust_va)
else:
self.va_typ = 'float'
# Nicepay.set('merFixAcctId', '')
# merFixAcctId dikosongkan saja
Nicepay.set('merFixAcctId', '')
# For CVS
......@@ -623,7 +635,7 @@ def get_result(response, pay_method):
# cancel_amt="cancelAmt" in response and int(response["cancelAmt"]) or 0,
# deposit_date="depositDt" in response and response["depositDt"] or "",
# deposit_time="depositTm" in response and response["depositTm"] or "",
# tx_id=response[''], # <=
# tx_id= "", # <= diisi tx_id merchant saat request register
invoice_no="referenceNo" in response and response["referenceNo"] or "",
amount="amt" in response and int(response["amt"]) or 0,
match_cl="matchCl" in response and int(response["matchCl"]) or 0,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!