def call_back_url(Req, OrderId): # ok_invoice # ok_txn_status rlog_req = OutRequest(raw_text=str(Req.REQUEST), from_ip=get_client_ip(Req)) Body = "ok_verify=true&{0}".format(Req.body) Url = "https://www.okpay.com/ipn-verify.html" headers = {'User-Agent': 'Mozilla 5.10', 'Content-Type': 'text/xml'} request = urllib2.Request(Url, Body, headers) response = urllib2.urlopen(request) d = response.read() rlog_req.raw_text = rlog_req.raw_text + " response '{0}' ".format(d) import logging logging.error("okpay" + d) if d != u"VERIFIED": #and d!= u"TEST": rlog_req.save() return json_false(Req) rlog_req.save() FactAmnt = Decimal(Req.REQUEST["ok_txn_net"]) if Req.REQUEST[u"ok_txn_status"] == u"completed": if process_in(Req.REQUEST["ok_invoice"], FactAmnt, Decimal("0.0"), settings.COMMON_SALT): return json_true(Req) else: return json_false(Req) return json_false(Req)
def call_back_url(Req, OrderId): # ok_invoice # ok_txn_status rlog_req = OutRequest(raw_text=str(Req.REQUEST), from_ip=get_client_ip(Req)) Body = "ok_verify=true&{0}".format(Req.body) Url = "https://www.okpay.com/ipn-verify.html" headers = {"User-Agent": "Mozilla 5.10", "Content-Type": "text/xml"} request = urllib2.Request(Url, Body, headers) response = urllib2.urlopen(request) d = response.read() rlog_req.raw_text = rlog_req.raw_text + " response '{0}' ".format(d) import logging logging.error("okpay" + d) if d != u"VERIFIED": # and d!= u"TEST": rlog_req.save() return json_false(Req) rlog_req.save() FactAmnt = Decimal(Req.REQUEST["ok_txn_net"]) if Req.REQUEST[u"ok_txn_status"] == u"completed": if process_in(Req.REQUEST["ok_invoice"], FactAmnt, Decimal("0.0"), settings.COMMON_SALT): return json_true(Req) else: return json_false(Req) return json_false(Req)
def call_back_url(Req): # ok_invoice # ok_txn_status rlog_req = OutRequest(raw_text=str(Req.REQUEST), from_ip=get_client_ip(Req)) rlog_req.save() FactAmnt = Decimal(Req.REQUEST["amount"]) body = Req.body sha1_hash = Req.REQUEST['sha1_hash'] if sha1_hash != signature(Req.REQUEST, sdk.ya_settings.SECRET): return json_false(Req) if process_in(Req.REQUEST["label"], FactAmnt, Decimal("0.0"), settings.COMMON_SALT): return json_true(Req) else: return json_false(Req)
def call_back_url_fail(Req, OrderId): return json_false(Req)