Commit 63d68582 by Solo Group

add notify test

1 parent a8ab70a7
...@@ -36,6 +36,7 @@ def purchase_notify(order): ...@@ -36,6 +36,7 @@ def purchase_notify(order):
# Callback to merchant # Callback to merchant
if hasattr(order, "customer_id"): if hasattr(order, "customer_id"):
customer = order.customer customer = order.customer
invoice = order
else: else:
invoice = order.invoice invoice = order.invoice
customer = invoice.customer customer = invoice.customer
...@@ -48,6 +49,7 @@ def purchase_notify(order): ...@@ -48,6 +49,7 @@ def purchase_notify(order):
or "PENDING" or "PENDING"
key = invoice.cust_inv_no + users.user_name + users.api_key + status key = invoice.cust_inv_no + users.user_name + users.api_key + status
signature = sha256(key) signature = sha256(key)
data = [] data = []
produk = [] produk = []
dat = dict( dat = dict(
...@@ -66,9 +68,8 @@ def purchase_notify(order): ...@@ -66,9 +68,8 @@ def purchase_notify(order):
)) ))
dat.update(produk=produk) dat.update(produk=produk)
data.append(dat) data.append(dat)
log.info("Notify Save: %s %s" % (data)) log.info("Notify Save: %s" % (data))
order.notify["result"] = data order.notify["result"] = data
flush_row(order) flush_row(order)
js = get_jsonrpc(method="notify", params=dict(data=data)) js = get_jsonrpc(method="notify", params=dict(data=data))
log.info("Notify: %s %s" % (url, js)) log.info("Notify: %s %s" % (url, js))
...@@ -101,7 +102,8 @@ def payment_notify(order): ...@@ -101,7 +102,8 @@ def payment_notify(order):
type=typ, type=typ,
tx_id=tx_id tx_id=tx_id
)) ))
js = get_jsonrpc(method="notify", params=dict(data=data)) params = dict(data=data)
js = get_jsonrpc(method="notify", params=params)
log.info("Notify: %s %s" % (url, js)) log.info("Notify: %s %s" % (url, js))
try: try:
......
...@@ -62,7 +62,7 @@ def proses(data): ...@@ -62,7 +62,7 @@ def proses(data):
# todo: add to customer notify table # todo: add to customer notify table
# todo: create cron for notify # todo: create cron for notify
# proses jika status 1 notify ada isinya tapi belum ada field result # proses jika status 1 notify ada isinya tapi belum ada field result
# todo: create cron torecurring order to other vendor # todo: create cron to recurring order to other vendor
# jika status = -2 proses vendor yang lain # jika status = -2 proses vendor yang lain
purchase_notify(order) purchase_notify(order)
return order return order
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!