コード例 #1
0
ファイル: tests.py プロジェクト: brat002/ebscab
    def test_check(self):
        c = Client()
        acc = Account()
        acc.username='******'
        acc.password='******'
        acc.fullname='foouser'
        acc.created = datetime.datetime.now()
        acc.contract = '010001'
        acc.save()
        c.login(username= '******', password= '******')
        TransactionType.objects.create(name=u'Единая касса', internal_name = 'payments.w1ru')
        response = c.post(reverse('getpaid-new-payment'), {"summ": "10.00", "backend": "payments.w1ru"})
        from getpaid.models import Payment
        
        payment = Payment.objects.filter().order_by('-id')[0]

        print response.content
        
        d = {"WMI_MERCHANT_ID": PaymentProcessor.get_backend_setting('MERCHANT_ID',''), 
                           "WMI_PAYMENT_AMOUNT": '10.00',
                          "WMI_CURRENCY_ID": '643',
                          "WMI_TO_USER_ID": '123456789012',
                          "WMI_PAYMENT_NO": payment.id,
                          "WMI_ORDER_ID": '12345',
                          "WMI_DESCRIPTION": 'descr',
                          "WMI_SUCCESS_URL": 'http://ya.ru',
                          "WMI_FAIL_URL": 'http://ya.ru',
                          "WMI_EXPIRED_DATE": '2012-01-01T00:00:00',
                          "WMI_CREATE_DATE": '2012-01-01T00:00:00',
                          "WMI_UPDATE_DATE": '2012-01-01T00:00:00',
                          "WMI_ORDER_STATE": 'Accepted',
                          }
        d['WMI_SIGNATURE'] = PaymentProcessor.compute_sig(d)
        response = c.post(reverse('getpaid-w1ru-postback'), d)
        print response.content
コード例 #2
0
    def test_check(self):
        c = Client()
        acc = Account()
        acc.username = '******'
        acc.password = '******'
        acc.fullname = 'foouser'
        acc.created = datetime.datetime.now()
        acc.contract = '010001'
        acc.save()
        c.login(username='******', password='******')
        TransactionType.objects.create(name=u'Единая касса',
                                       internal_name='payments.w1ru')
        response = c.post(reverse('getpaid-new-payment'), {
            "summ": "10.00",
            "backend": "payments.w1ru"
        })
        from getpaid.models import Payment

        payment = Payment.objects.filter().order_by('-id')[0]

        print response.content

        d = {
            "WMI_MERCHANT_ID":
            PaymentProcessor.get_backend_setting('MERCHANT_ID', ''),
            "WMI_PAYMENT_AMOUNT":
            '10.00',
            "WMI_CURRENCY_ID":
            '643',
            "WMI_TO_USER_ID":
            '123456789012',
            "WMI_PAYMENT_NO":
            payment.id,
            "WMI_ORDER_ID":
            '12345',
            "WMI_DESCRIPTION":
            'descr',
            "WMI_SUCCESS_URL":
            'http://ya.ru',
            "WMI_FAIL_URL":
            'http://ya.ru',
            "WMI_EXPIRED_DATE":
            '2012-01-01T00:00:00',
            "WMI_CREATE_DATE":
            '2012-01-01T00:00:00',
            "WMI_UPDATE_DATE":
            '2012-01-01T00:00:00',
            "WMI_ORDER_STATE":
            'Accepted',
        }
        d['WMI_SIGNATURE'] = PaymentProcessor.compute_sig(d)
        response = c.post(reverse('getpaid-w1ru-postback'), d)
        print response.content
コード例 #3
0
    def handle(self, *args, **options):

        a = Payment.objects.filter(status='in_progress', created_on__gte=datetime.datetime.now()-datetime.timedelta(hours=PaymentProcessor.get_backend_setting('LIFETIME')))
        pattern='<bill txn-id="%s"/>'
        p=''
        for x in a:
            p+=pattern % x.id
            
        xml=PaymentProcessor.make_request(params['get_invoices_status'] % {
                                                                        "TERMINAL_PASSWORD": PaymentProcessor.get_backend_setting('TERMINAL_PASSWORD'),
                                                                        "TERMINAL_ID":  PaymentProcessor.get_backend_setting('TERMINAL_ID'),
                                                                        "BILLS": p
                                                                           })
        print xml
        o=xml2obj(xml)
        if status_code(o)[0]!=0: return 
        for x in a:
            if not o.bills_list:continue
            for item in o.bills_list.bill:
                p_code, p_status = payment_code(item)
                if p_code==60 and int(item.id)==x.id:
                    x.on_success(amount=x.amount)
                    x.save()
                    continue
            if p_code>100:
                x.deleted=True
                x.save()
コード例 #4
0
ファイル: views.py プロジェクト: brat002/ebscab
    def post(self, request, *args, **kwargs):


        try:
                status = PaymentProcessor.postback(request)

                
        except KeyError:
            logger.warning('Got malformed POST request: %s' % str(request.POST))
            return HttpResponse('MALFORMED')

        return HttpResponse(status)