Exemplo n.º 1
0
    def post(self):
        logging.info("/shafa/notify/ start")
        params = self.request.arguments.copy()
        logging.info(params)
        try:
            data = self.get_argument("data")
        except Exception:
            logging.error("/shafa/notify/ 获得的传入参数有误")
            self.write("获得的传入参数有误")
            return

        data_json = json.loads(data)
        price = data_json['price']
        quantity = data_json['quantity']
        custom_data = data_json['custom_data']
        time = data_json['time']
        custom_data = data_json['custom_data']
        logging.info("/shafa/notify/ 1 custom_data:"+custom_data)
        custom_data_json = json.loads(custom_data)
        ptorder = custom_data_json['ptorder']
        app_order_id,hurl = ptorder.split('_')
        url = "%s/shafa/notify/" % hurl
        print "shafa notify url:",url
        params = dict(app_order_id=app_order_id, price=price, quantity=quantity, time=time)
        respose = yield httpclient.fetch(httputil.url_concat(url, params))
        self.write("SUCCESS")
        logging.info("/shafa/notify/ end")
Exemplo n.º 2
0
    def get(self):
        logging.info("/xmpay/notify/ start")
        try:
            cpOrderId = self.get_argument("cpOrderId")
            orderStatus = self.get_argument("orderStatus")
            payFee = self.get_argument("payFee")
            payTime = self.get_argument("payTime")
            signature = self.get_argument("signature")  
            cpUserInfo = self.get_argument("cpUserInfo")             
        except Exception:
            raise web.HTTPError(400, "Argument error")

        params = self.request.arguments.copy()
        params.pop('signature')
        for x, y in params.items():
            params[x] = y[0]
        params = yield self.format_params(params, False)
        m = hashlib.md5()   
        m.update(params) 
        _sign = m.hexdigest()  
        if signature != _sign:
            url = "%s/xmpay/notify/" % cpUserInfo
            params = dict(cpOrderId=cpOrderId, orderStatus=orderStatus, payFee=payFee, payTime=payTime)
            yield httpclient.fetch(httputil.url_concat(url, params))

            ret = dict(error_code=200)
        else:
            ret = dict(error_code=1525, errMsg=E.errmsg(E.ERR_SIGN))
        reb = zlib.compress(escape.json_encode(ret))
        self.write(ret)
        logging.info("XmNotifyHandler /xmpay/notify/ end.")
Exemplo n.º 3
0
    def get(self):
        logging.info("/lgpay/notify/ start")
        try:
            serial_no = self.get_argument("serial_no")
            transaction_id = self.get_argument("transaction_id")
            result_code = self.get_argument("result_code")
            fee = self.get_argument("fee")           
        except Exception:
            raise web.HTTPError(400, "Argument error")

        r,zoneid = serial_no.split('_')
        logging.info("/lgpay/notify/ zoneid:",zoneid)
        res = yield self.sql.runQuery("SELECT domain FROM core_zone WHERE zoneid=%s", (zoneid, ))
        if res:
            domain, = res[0] 
        if int(result_code) == 120:
            url = "%s/lgpay/notify/" % domain
            logging.info("/lgpay/notify/ url:",url)

            params = dict(serial_no=serial_no, transaction_id=transaction_id, fee=fee)
            yield httpclient.fetch(httputil.url_concat(url, params))
            ret = dict(serial_no=serial_no)
            reb = zlib.compress(escape.json_encode(ret))
            self.write(ret)
            logging.info("/lgpay/lgpay/ end")
Exemplo n.º 4
0
 def post(self):
     logging.info("/cmpay/notify/ start")
     dom = parseString(self.request.body)  
     root = dom.firstChild 
     childs = root.childNodes
     for child in childs: 
         if child.nodeType == child.TEXT_NODE:
             pass
         else:
             if child.nodeName == 'contentId':
                 contentId = child.childNodes[0].data
             elif child.nodeName == 'consumeCode':
                 consumeCode = child.childNodes[0].data
             elif child.nodeName == 'cpid':
                 cpid = child.childNodes[0].data
             elif child.nodeName == 'hRet':
                 hRet = child.childNodes[0].data                   
             elif child.nodeName == 'cpparam':
                 print child.childNodes[0].data.encode("utf-8")
                 orderId, zoneid = child.childNodes[0].data.split('%2C')
             else:pass
     res = yield self.sql.runQuery("SELECT domain FROM core_zone WHERE zoneid=%s", (zoneid, ))
     if res:
         domain, = res[0] 
     url = "%s/cmpay/notify/" % domain
     params = dict(orderId=orderId, contentId=contentId, consumeCode=consumeCode, cpid=cpid, hRet=hRet)
     yield httpclient.fetch(httputil.url_concat(url, params))
     self.write('''<?xml version="1.0" encoding="UTF-8"?> <request><hRet>0</hRet><message>Successful</message> </request>''')
     logging.info("/cmpay/notify/ end")
Exemplo n.º 5
0
 def post(self):
     dom = parseString(self.request.body)  
     root = dom.firstChild 
     childs = root.childNodes
     for child in childs: 
         if child.nodeType == child.TEXT_NODE:
             pass
         else:
             if child.nodeName == 'contentId':
                 contentId = child.childNodes[0].data
             elif child.nodeName == 'consumeCode':
                 consumeCode = child.childNodes[0].data
             elif child.nodeName == 'cpid':
                 cpid = child.childNodes[0].data
             elif child.nodeName == 'hRet':
                 hRet = child.childNodes[0].data                   
             elif child.nodeName == 'cpparam':
                 print child.childNodes[0].data.encode("utf-8")
                 orderId, zoneid = child.childNodes[0].data.split('%2C')
             else:pass
     res = yield self.sql.runQuery("SELECT domain FROM core_zone WHERE zoneid=%s", (zoneid, ))
     if res:
         domain, = res[0] 
     url = "%s/cmpay/notify/" % domain
     params = dict(orderId=orderId, contentId=contentId, consumeCode=consumeCode, cpid=cpid, hRet=hRet)
     yield httpclient.fetch(httputil.url_concat(url, params))
     self.write('''<?xml version="1.0" encoding="UTF-8"?> <request><hRet>0</hRet><message>Successful</message> </request>''')
Exemplo n.º 6
0
    def get(self):
        try:
            cpOrderId = self.get_argument("cpOrderId")
            orderStatus = self.get_argument("orderStatus")
            payFee = self.get_argument("payFee")
            payTime = self.get_argument("payTime")
            signature = self.get_argument("signature")  
            cpUserInfo = self.get_argument("cpUserInfo")             
        except Exception:
            raise web.HTTPError(400, "Argument error")
        params = self.request.arguments.copy()
        params.pop('signature')
        for x, y in params.items():
            params[x] = y[0]
        params = yield self.format_params(params, False)
        m = hashlib.md5()   
        m.update(params) 
        _sign = m.hexdigest()  
        if signature != _sign:
            url = "%s/xmpay/notify/" % cpUserInfo
            params = dict(cpOrderId=cpOrderId, orderStatus=orderStatus, payFee=payFee, payTime=payTime)
            yield httpclient.fetch(httputil.url_concat(url, params))

            ret = dict(error_code=200)
        else:
            ret = dict(error_code=1525, errMsg=E.errmsg(E.ERR_SIGN))
        reb = zlib.compress(escape.json_encode(ret))
        self.write(ret)
Exemplo n.º 7
0
Arquivo: auth.py Projeto: powo/cyclone
 def _oauth_request_token_url(
     self, redirect_uri=None, client_id=None, client_secret=None, code=None, extra_params=None
 ):
     url = self._OAUTH_ACCESS_TOKEN_URL
     args = dict(redirect_uri=redirect_uri, code=code, client_id=client_id, client_secret=client_secret)
     if extra_params:
         args.update(extra_params)
     return url_concat(url, args)
Exemplo n.º 8
0
Arquivo: auth.py Projeto: powo/cyclone
    def authorize_redirect(self, redirect_uri=None, client_id=None, client_secret=None, extra_params=None):
        """Redirects the user to obtain OAuth authorization for this service.

        Some providers require that you register a Callback
        URL with your application. You should call this method to log the
        user in, and then call get_authenticated_user() in the handler
        you registered as your Callback URL to complete the authorization
        process.
        """
        args = {"redirect_uri": redirect_uri, "client_id": client_id}
        if extra_params:
            args.update(extra_params)
        self.redirect(url_concat(self._OAUTH_AUTHORIZE_URL, args))
Exemplo n.º 9
0
 def _oauth_request_token_url(self, redirect_uri=None, client_id=None,
                              client_secret=None, code=None,
                              extra_params=None):
     url = self._OAUTH_ACCESS_TOKEN_URL
     args = dict(
         redirect_uri=redirect_uri,
         code=code,
         client_id=client_id,
         client_secret=client_secret,
         )
     if extra_params:
         args.update(extra_params)
     return url_concat(url, args)
Exemplo n.º 10
0
    def post(self):
        try:
            signature = self.get_argument("sign")
            datastr = json.loads(unquote(self.get_argument("datastr")))
            extra1 = datastr["extra"].split("&")[1]
        except Exception:
            raise web.HTTPError(400, "Argument error")

        url = "%s/dangbei/notify/" % extra1
        params = dict(datastr=self.get_argument('datastr'), sign=signature)
        respose = yield httpclient.fetch(httputil.url_concat(url, params))
        if respose.code != 200:
            raise web.HTTPError(reponse.code)
        self.write("success")
Exemplo n.º 11
0
    def authorize_redirect(self,
                           redirect_uri=None,
                           client_id=None,
                           client_secret=None,
                           extra_params=None):
        """Redirects the user to obtain OAuth authorization for this service.

        Some providers require that you register a Callback
        URL with your application. You should call this method to log the
        user in, and then call get_authenticated_user() in the handler
        you registered as your Callback URL to complete the authorization
        process.
        """
        args = {"redirect_uri": redirect_uri, "client_id": client_id}
        if extra_params:
            args.update(extra_params)
        self.redirect(url_concat(self._OAUTH_AUTHORIZE_URL, args))
Exemplo n.º 12
0
 def get(self):
     try:
         serial_no = self.get_argument("serial_no")
         transaction_id = self.get_argument("transaction_id")
         result_code = self.get_argument("result_code")
         fee = self.get_argument("fee")           
     except Exception:
         raise web.HTTPError(400, "Argument error")
     res = yield self.sql.runQuery("SELECT domain FROM core_zone WHERE zoneid=%s", (serial_no[10:], ))
     if res:
         domain, = res[0] 
     if int(result_code) == 120:
         url = "%s/lgpay/notify/" % domain
         params = dict(serial_no=serial_no, transaction_id=transaction_id, fee=fee)
         yield httpclient.fetch(httputil.url_concat(url, params))
         ret = dict(serial_no=serial_no)
         reb = zlib.compress(escape.json_encode(ret))
         self.write(ret)    
Exemplo n.º 13
0
    def get(self):
        try:
            appKey = self.get_argument("appKey")
            params = self.get_argument("params")
            pxNumber = self.get_argument("pxNumber")
            price = self.get_argument("price")
            userName = self.get_argument("userName")
            currencyCode = self.get_argument("currencyCode")
            products = self.get_argument("products")
            sign = self.get_argument("sign")               
        except Exception:
            raise web.HTTPError(400, "Argument error")

        app_order_id, url, externalProductId = params.split(',')
        url = "%s/letvpay/notify/" % url
        params = dict(appKey=appKey, params=params, pxNumber=pxNumber, price=price, userName=userName, currencyCode=currencyCode,\
         products=products, sign=sign)
        yield httpclient.fetch(httputil.url_concat(url, params))
        self.write("SUCCESS")
Exemplo n.º 14
0
    def get(self):
        logging.info("/letvpay/notify/ start")
        try:
            appKey = self.get_argument("appKey")
            params = self.get_argument("params")
            pxNumber = self.get_argument("pxNumber")
            price = self.get_argument("price")
            userName = self.get_argument("userName")
            currencyCode = self.get_argument("currencyCode")
            products = self.get_argument("products")
            sign = self.get_argument("sign")               
        except Exception:
            raise web.HTTPError(400, "Argument error")

        app_order_id, url, externalProductId = params.split(',')
        url = "%s/letvpay/notify/" % url
        params = dict(appKey=appKey, params=params, pxNumber=pxNumber, price=price, userName=userName, currencyCode=currencyCode,\
         products=products, sign=sign)
        yield httpclient.fetch(httputil.url_concat(url, params))
        self.write("SUCCESS")
        logging.info("/letvpay/notify/ end")
Exemplo n.º 15
0
    def post(self):
        logging.info("/dangbei/notify/ start")
        params = self.request.arguments.copy()
        logging.info(params)
        try:
            signature = self.get_argument("sign")
            datastr = json.loads(unquote(self.get_argument("datastr")))
        except Exception:
            raise web.HTTPError(400, "Argument error")

        app_order_id = datastr["extra"].split("&")[0]
        hurl = datastr["extra"].split("&")[1]
        logging.info("app_order_id:"+app_order_id)
        logging.info("hurl:"+hurl)
        url = "%s/dangbei/notify/" % hurl
        # params = dict(datastr=self.get_argument('datastr'), sign=signature)
        params = dict(app_order_id=app_order_id, price='1.0', quantity=1, time=str(int(time.time())))
        respose = yield httpclient.fetch(httputil.url_concat(url, params))
        # if respose.code != 200:
        #     raise web.HTTPError(reponse.code)
        logging.info("/dangbei/notify/ url:"+url)
        self.write("success")
        logging.info("/dangbei/notify/ end")