Пример #1
0
 def get_response(self, status):
     status_dict = {'SIG ERR': [u'Signature failure'],
                     'CUR ERR': [u'Bad currency'],
                     'CRC ERR': [u'Order id is not found'],
                     'REJECT': [u'Payment rejected', 'rejected'],
                     'OK': ['']}
     return PaymentProcessor.send_response(self.script_name, *status_dict.get(status, ['']))
Пример #2
0
    def post(self, request, *args, **kwargs):
        try:
            xml = request.POST['pg_xml']
        except KeyError:
            logger.warning('Got malformed POST request: %s' % str(request.POST))
            return HttpResponse('MALFORMED')

        status = PaymentProcessor.online(xml, self.script_name)
        logger.debug('Online response: %s, %s', status, xml)
        return HttpResponse(self.get_response(status))