def zhifubao_pay(request): """ 修改函数名 by: 范俊伟 at:2015-03-04 修改支付宝接口 by: 范俊伟 at:2015-03-06 逻辑修改 by: 范俊伟 at:2015-03-07 :param request: :return: """ order_id = request.REQUEST.get('order_id') pay_type = request.REQUEST.get('pay_type') try: order = Order.objects.get(id=order_id) except Order.DoesNotExist: return HttpResponse('id错误') payOrder = order.create_pay_order(pay_type) out_trade_no = payOrder.flag subject = payOrder.order.product.name total_fee = format_money(payOrder.real_price) request_token = get_auth(subject, out_trade_no, total_fee) url = create_direct_phone_pay(request_token) # 去支付页面 return HttpResponseRedirect(url)
def money(value): """ 格式化资金的模板filter by: 范俊伟 at:2015-03-07 千分位控制 by: 范俊伟 at:2015-03-20 :param value: :return: """ return format_money(value, True)
def zhifubao_pay_pc(request): """ pc支付宝跳转接口 by: 范俊伟 at:2015-03-04 :param request: :return: """ order_id = request.REQUEST.get('order_id') pay_type = request.REQUEST.get('pay_type') try: order = Order.objects.get(id=order_id) except Order.DoesNotExist: return HttpResponse('id错误') payOrder = order.create_pay_order(pay_type) out_trade_no = payOrder.flag subject = payOrder.order.product.name total_fee = format_money(payOrder.real_price) url = create_direct_pay_by_user(out_trade_no, subject, total_fee) # 去支付页面 return HttpResponseRedirect(url)