Ejemplo n.º 1
0
def ali_return_url(request):
    '''
    description:alipay 同步通知
    params:
    return:
    '''
    if alipay.ali_notify_verify(request.GET):
        tn = request.GET.get('out_trade_no')
        trade_status = request.GET.get('trade_status')
        if trade_status == 'TRADE_SUCCESS':
            bills = Bills.objects.get(bill=tn)
            bills.trade_status = trade_status
            bills.bill_status = 'down'
            bills.save()
            where = bills.where
            if where == 'cart':
                pay_detail_return(bills)
                conf = pay_cart_return(bills)
                return render(request, 'payment/down.html', conf)
            elif where == 'detail':
                goods = pay_detail_return(bills)
                return HttpResponseRedirect('/shop/goods-detail?goods_id=%s' %
                                            goods.id)
        else:
            return HttpResponse('pay fail')
    return HttpResponse('verify fail')
Ejemplo n.º 2
0
def ali_return_url(request):
    '''
    description:alipay 同步通知
    params:
    return:
    '''
    if alipay.ali_notify_verify(request.GET):
        tn = request.GET.get('out_trade_no')
        trade_status = request.GET.get('trade_status')
        if trade_status == 'TRADE_SUCCESS':
            bills = Bills.objects.get(bill=tn)
            bills.trade_status = trade_status
            bills.bill_status = 'down'
            bills.save()
            where = bills.where
            if where == 'cart':
                pay_detail_return(bills)
                conf = pay_cart_return(bills)
                return render(request, 'payment/down.html', conf)
            elif where == 'detail':
                goods = pay_detail_return(bills)
                return HttpResponseRedirect('/shop/goods-detail?goods_id=%s'%goods.id)
        else:
            return HttpResponse('pay fail')
    return HttpResponse('verify fail')
Ejemplo n.º 3
0
def ali_notify_url(request):
    '''
    description:alipay异步通知
    params:
    return:
    '''
    if request.method == 'POST':
        if alipay.ali_notify_verify(request.POST):
            tn = request.POST.get('out_trade_no')
            trade_status = request.POST.get('trade_status')
            if trade_status == 'WAIT_SELLER_SEND_GOODS':
                bills = Bills.objects.get(bill=tn)
                bills.trade_status = trade_status
                bills.bill_status = 'down'
                bills.save()
                where = bills.where
                if where == 'cart':
                    conf = pay_cart_return(bills)
                elif where == 'detail':
                    goods = pay_detail_return(bills)
                return HttpResponse('success')
            else:
                return HttpResponse('success')
    return HttpResponse('fail')
Ejemplo n.º 4
0
def ali_notify_url(request):
    '''
    description:alipay异步通知
    params:
    return:
    '''
    if request.method == 'POST':
        if alipay.ali_notify_verify(request.POST):
            tn = request.POST.get('out_trade_no')
            trade_status = request.POST.get('trade_status')
            if trade_status == 'WAIT_SELLER_SEND_GOODS':
                bills = Bills.objects.get(bill=tn)
                bills.trade_status = trade_status
                bills.bill_status = 'down'
                bills.save()
                where = bills.where
                if where == 'cart':
                    conf = pay_cart_return(bills)
                elif where == 'detail':
                    goods = pay_detail_return(bills)
                return HttpResponse('success')
            else:
                return HttpResponse('success')
    return HttpResponse('fail')