Browse Source

修复取消paypal周期扣款错误

lang 3 năm trước cách đây
mục cha
commit
9772eb3811
1 tập tin đã thay đổi với 13 bổ sung15 xóa
  1. 13 15
      Controller/TestApi.py

+ 13 - 15
Controller/TestApi.py

@@ -145,11 +145,19 @@ class testView(View):
             return 123
 
     def findPaypalOrder(self,request_dict, response):
-        from Object.ETkObject import ETkObject
-        etkObj = ETkObject(etk='')
-        etk = etkObj.encrypt('RBF474J66TLAGHW9111A')
-        exit(etk)
-        return HttpResponse(PAYPAL_WEB_HOOK_ID)
+        from paypalrestsdk import Order, ResourceNotFound
+        PAYPAL_CRD = {
+            "mode": "sandbox",  # sandbox or live
+            "client_id": "AVLoQVq3xHZ6FrF4mxHwlCPgVBAw4Fw5RtMkuxmYd23SkUTIY643n2g3KdK-Al8wV05I28lza5uoQbAA",
+            "client_secret": "EO8kRc8yioDk0i2Qq-QMcVFfwkmyMJorTvBSLDTnxDJJ_wb9VoM_0jkUY9iEng2Flp1ze8wQOGpH5nB2"
+        }
+        paypalrestsdk.configure(PAYPAL_CRD)
+        billing_agreement = paypalrestsdk.BillingAgreement.find('I-7P8BCCKE45HY')
+        # json_str = json.dumps(billing_agreement, default=lambda o: o.__dict__)
+        # return HttpResponse(json_str)
+        print(repr(billing_agreement))
+        return HttpResponse(repr(billing_agreement))
+        return response.json(json.dumps(list(payment)))
         logger = logging.getLogger('info')
         logger.info('------记录aws bucket init时间')
         logger.info(int(time.time()))
@@ -163,16 +171,6 @@ class testView(View):
         conn = session.client('s3')
         logger.info(int(time.time()))
         exit()
-        from paypalrestsdk import Order, ResourceNotFound
-        PAYPAL_CRD = {
-            "mode": "live",  # sandbox or live
-            "client_id": "AdSRd6WBn-qLl9OiQHQuNYTDFSx0ZX0RUttqa58au8bPzoGYQUrt8bc6591RmH8_pEAIPijdvVYSVXyI",
-            "client_secret": "ENT-J08N3Fw0B0uAokg4RukljAwO9hFHPf8whE6-Dwd8oBWJO8AWMgpdTKpfB1pOy89t4bsFEzMWDowm"
-        }
-        paypalrestsdk.configure(PAYPAL_CRD)
-        payment = paypalrestsdk.Payment.find("PAYID-MH6GPFI1MC56533NJ166761M")
-        exit(payment)
-        return response.json(json.dumps(list(payment)))
         # related_resources = payment['transactions'][0]['related_resources']
         # if not related_resources:
         #     return response.json(805)