|
|
-wxpay = WeChatPay(WECHAT['appID'], WECHAT['apiKey'], WECHAT['mchID'])
|
|
|
21
|
+WECHAT = settings.WECHAT
|
|
21
|
22
|
|
|
22
|
23
|
|
|
|
24
|
+@logit
|
|
23
|
25
|
@transaction.atomic
|
|
24
|
26
|
def wx_order_create_api(request):
|
|
25
|
27
|
"""
|
|
|
|
@@ -37,6 +39,11 @@ def wx_order_create_api(request):
|
|
37
|
39
|
# JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付,统一下单接口trade_type的传参可参考这里
|
|
38
|
40
|
trade_type = request.POST.get('trade_type', '')
|
|
39
|
41
|
|
|
|
42
|
+ # 根据 trade_type 获取 wechat 配置
|
|
|
43
|
+ wechat = WECHAT.get(trade_type, {})
|
|
|
44
|
+ # WeChatPay 初始化
|
|
|
45
|
+ wxpay = WeChatPay(wechat.get('appID'), wechat.get('apiKey'), wechat.get('mchID'))
|
|
|
46
|
+
|
|
40
|
47
|
# 生成订单
|
|
41
|
48
|
order = OrderInfo.objects.create(from_uid=from_uid, to_lid=to_lid, to_uid=to_uid, total_fee=total_fee)
|
|
42
|
49
|
|
|
|
|
@@ -74,6 +81,7 @@ def order_paid_success(order):
|
|
74
|
81
|
order.save()
|
|
75
|
82
|
|
|
76
|
83
|
|
|
|
84
|
+@logit
|
|
77
|
85
|
@transaction.atomic
|
|
78
|
86
|
def wx_notify_url_api(request):
|
|
79
|
87
|
"""
|
|
|
|
@@ -4,6 +4,7 @@ MySQL-python==1.2.5
|
|
4
|
4
|
TimeConvert==1.1.6
|
|
5
|
5
|
cryptography==1.2.1
|
|
6
|
6
|
django-curtail-uuid==1.0.0
|
|
|
7
|
+django-logit==1.0.0
|
|
7
|
8
|
django-multidomain==1.1.4
|
|
8
|
9
|
django-shortuuidfield==0.1.3
|
|
9
|
10
|
djangorestframework==3.3.1
|