示例#1
0
    def online(pos_id, session_id, ts, sig):
        params = {
            u'pos_id': pos_id,
            u'session_id': session_id,
            u'ts': ts,
            u'sig': sig
        }

        key2 = six.text_type(PaymentProcessor.get_backend_setting('key2'))
        if sig != PaymentProcessor.compute_sig(params, PaymentProcessor._ONLINE_SIG_FIELDS, key2):
            logger.warning('Got message with wrong sig, %s' % str(params))
            return u'SIG ERR'

        try:
            params['pos_id'] = int(params['pos_id'])
        except ValueError:
            return u'POS_ID ERR'
        if params['pos_id'] != int(PaymentProcessor.get_backend_setting('pos_id')):
            return u'POS_ID ERR'

        try:
            payment_id, session = session_id.split(':')
        except ValueError:
            logger.warning(
                'Got message with wrong session_id, %s' % str(params))
            return u'SESSION_ID ERR'

        get_payment_status_task.delay(payment_id, session_id)
        return u'OK'
示例#2
0
    def online(pos_id, session_id, ts, sig):
        params = {
            u'pos_id': pos_id,
            u'session_id': session_id,
            u'ts': ts,
            u'sig': sig
        }

        key2 = six.text_type(PaymentProcessor.get_backend_setting('key2'))
        if sig != PaymentProcessor.compute_sig(
                params, PaymentProcessor._ONLINE_SIG_FIELDS, key2):
            logger.warning('Got message with wrong sig, %s' % str(params))
            return u'SIG ERR'

        try:
            params['pos_id'] = int(params['pos_id'])
        except ValueError:
            return u'POS_ID ERR'
        if params['pos_id'] != int(
                PaymentProcessor.get_backend_setting('pos_id')):
            return u'POS_ID ERR'

        try:
            payment_id, session = session_id.split(':')
        except ValueError:
            logger.warning('Got message with wrong session_id, %s' %
                           str(params))
            return u'SESSION_ID ERR'

        get_payment_status_task.delay(payment_id, session_id)
        return u'OK'
示例#3
0
    def online(pos_id, session_id, ts, sig):
        params = {'pos_id': pos_id, 'session_id': session_id, 'ts': ts, 'sig': sig}

        key2 = PaymentProcessor.get_backend_setting('key2')
        if sig != PaymentProcessor.compute_sig(params, PaymentProcessor._ONLINE_SIG_FIELDS, key2):
            logger.warning('Got message with wrong sig, %s' % str(params))
            return 'SIG ERR'

        try:
            params['pos_id'] = int(params['pos_id'])
            if params['pos_id'] != int(PaymentProcessor.get_backend_setting('pos_id')):
                raise ValueError
        except ValueError:
            logger.warning('Got message with wrong pos_id, %s' % str(params))
            return 'POS_ID ERR'

        try:
            payment_id, session = session_id.split(':')
        except ValueError:
            logger.warning('Got message with wrong session_id, %s' % str(params))
            return 'SESSION_ID ERR'

        get_payment_status_task.delay(payment_id, session_id)
        logger.info('get_payment_status_task.delay(%r, %r)' % (payment_id, session_id))
        return 'OK'