浏览代码

palpay 支付问题3

chenshibin 4 年之前
父节点
当前提交
23ef6b4ad6
共有 2 个文件被更改,包括 8 次插入9 次删除
  1. 1 1
      Ansjer/config_formal.py
  2. 7 8
      Controller/CloudStorage.py

+ 1 - 1
Ansjer/config_formal.py

@@ -17,7 +17,7 @@ SERVER_DOMAIN = 'http://www.dvema.com/'
 DOMAIN_HOST = 'www.dvema.com'
 SERVER_HOST = 'localhost'
 PAYPAL_CRD = {
-    "mode": "sandbox",  # sandbox or live
+    "mode": "live",  # sandbox or live
     "client_id": "AdSRd6WBn-qLl9OiQHQuNYTDFSx0ZX0RUttqa58au8bPzoGYQUrt8bc6591RmH8_pEAIPijdvVYSVXyI",
     "client_secret": "ENT-J08N3Fw0B0uAokg4RukljAwO9hFHPf8whE6-Dwd8oBWJO8AWMgpdTKpfB1pOy89t4bsFEzMWDowm"
 }

+ 7 - 8
Controller/CloudStorage.py

@@ -906,8 +906,8 @@ class CloudStorageView(View):
             if not orderID:
                 red_url = "{SERVER_DOMAIN}web/paid2/fail.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
                 return HttpResponseRedirect(red_url)
-            else:
-                order_qs.update(status=10)
+            # else:
+            #     order_qs.update(status=9)
             paypalrestsdk.configure(PAYPAL_CRD)
             # ID of the payment. This ID is provided when creating payment.
             payment = paypalrestsdk.Payment.find(paymentId)
@@ -964,6 +964,7 @@ class CloudStorageView(View):
             red_url = "{SERVER_DOMAIN}web/paid2/success.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
             return HttpResponseRedirect(red_url)
         except Exception as e:
+            print(repr(e))
             if order_qs:
                 order_qs.update(status=10)
 
@@ -1094,10 +1095,10 @@ class CloudStorageView(View):
 
         orderID = CommonService.createOrderID()
         if pay_type == 1:
-            #call_sub_url = "{SERVER_DOMAIN}cloudstorage/dopaypalcallback?orderID={orderID}". \
-                #format(SERVER_DOMAIN=SERVER_DOMAIN, orderID=orderID)
-            call_sub_url = "http://binbin.uicp.vip/cloudstorage/dopaypalcallback?orderID={orderID}".format(
-                 SERVER_DOMAIN=SERVER_DOMAIN, orderID=orderID)
+            call_sub_url = "{SERVER_DOMAIN}cloudstorage/dopaypalcallback?orderID={orderID}". \
+                format(SERVER_DOMAIN=SERVER_DOMAIN, orderID=orderID)
+            #call_sub_url = "http://binbin.uicp.vip/cloudstorage/dopaypalcallback?orderID={orderID}".format(
+                 #SERVER_DOMAIN=SERVER_DOMAIN, orderID=orderID)
             call_clc_url = "{SERVER_DOMAIN}web/paid2/fail.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
             paypalrestsdk.configure(PAYPAL_CRD)
             payment = paypalrestsdk.Payment({
@@ -1105,8 +1106,6 @@ class CloudStorageView(View):
                 "payer": {"payment_method": "paypal"},
                 "redirect_urls": {"return_url": call_sub_url, "cancel_url": call_clc_url},
                 "transactions": [{
-                    "item_list": {"items": [
-                        {"name": "Cloud video", "sku": "1", "price": price, "currency": "USD", "quantity": 1}]},
                     "amount": {"total": price, "currency": currency},
                     "description": content}]})
             if payment.create():