|
@@ -881,6 +881,8 @@ class CloudStorageView(View):
|
|
|
order_qs.update(status=1, updTime=nowTime, uid_bucket_id=uid_bucket_id)
|
|
|
red_url = "{SERVER_DOMAIN}cloudstorage/payOK".format(SERVER_DOMAIN=SERVER_DOMAIN)
|
|
|
return HttpResponseRedirect(red_url)
|
|
|
+ else:
|
|
|
+ order_qs.update(status=10)
|
|
|
return response.json(0, signature)
|
|
|
except Exception as e:
|
|
|
if order_qs:
|
|
@@ -894,9 +896,13 @@ class CloudStorageView(View):
|
|
|
orderID = request_dict.get('orderID', None)
|
|
|
|
|
|
try:
|
|
|
- if not paymentId or not PayerID or not orderID:
|
|
|
+ order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
|
|
|
+
|
|
|
+ if not orderID:
|
|
|
red_url = "{SERVER_DOMAIN}cloudstorage/payError".format(SERVER_DOMAIN=SERVER_DOMAIN)
|
|
|
return HttpResponseRedirect(red_url)
|
|
|
+ else:
|
|
|
+ order_qs.update(status=10)
|
|
|
paypalrestsdk.configure(PAYPAL_CRD)
|
|
|
# ID of the payment. This ID is provided when creating payment.
|
|
|
payment = paypalrestsdk.Payment.find(paymentId)
|
|
@@ -906,7 +912,7 @@ class CloudStorageView(View):
|
|
|
red_url = "{SERVER_DOMAIN}cloudstorage/payError".format(SERVER_DOMAIN=SERVER_DOMAIN)
|
|
|
return HttpResponseRedirect(red_url)
|
|
|
print("Payment execute successfully")
|
|
|
- order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
|
|
|
+
|
|
|
nowTime = int(time.time())
|
|
|
order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts", "userID__userID",
|
|
|
"userID__username")
|
|
@@ -969,7 +975,7 @@ class CloudStorageView(View):
|
|
|
|
|
|
trade_status = data['result_code'] # 业务结果 SUCCESS/FAIL
|
|
|
out_trade_no = data['out_trade_no'] # 商户订单号
|
|
|
- order_qs = None
|
|
|
+ order_qs = Order_Model.objects.filter(orderID=out_trade_no, status=0)
|
|
|
if trade_status == "SUCCESS":
|
|
|
logger.info('微信回调返回值 进来了。')
|
|
|
check_sign = pay.get_notifypay(data)
|
|
@@ -979,8 +985,6 @@ class CloudStorageView(View):
|
|
|
orderID = out_trade_no
|
|
|
print("进来了,微信支付成功回调")
|
|
|
|
|
|
-
|
|
|
- order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
|
|
|
nowTime = int(time.time())
|
|
|
order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts",
|
|
|
"userID__userID", "userID__username")
|
|
@@ -1023,7 +1027,11 @@ class CloudStorageView(View):
|
|
|
dvq.update(**dvq_set_update_dict)
|
|
|
order_qs.update(status=1, updTime=nowTime, uid_bucket_id=uid_bucket_id)
|
|
|
return HttpResponse(pay.xml_to_dict({'return_code': 'SUCCESS', 'return_msg': 'OK'}))
|
|
|
+
|
|
|
+ else:
|
|
|
+ order_qs.update(status=10)
|
|
|
return HttpResponse(pay.xml_to_dict({'return_code': 'FAIL', 'return_msg': '参数格式校验错误'}))
|
|
|
+
|
|
|
except Exception as e:
|
|
|
if order_qs:
|
|
|
order_qs.update(status=10)
|