Browse Source

添加pay logger

lang 3 năm trước cách đây
mục cha
commit
57415d8572

+ 1 - 0
Ansjer/cn_config/config_formal.py

@@ -30,6 +30,7 @@ PAYPAL_CRD = {
     "client_secret": "EO8kRc8yioDk0i2Qq-QMcVFfwkmyMJorTvBSLDTnxDJJ_wb9VoM_0jkUY9iEng2Flp1ze8wQOGpH5nB2"
 }
 PAYPAL_WEB_HOOK_ID = '6TS30758D98835230'
+PAYPAL_WEB_HOOK_ID_TWO = '2BH56575UJ9324151'
 
 DETECT_PUSH_DOMAIN = 'http://push.zositechc.cn/'
 DETECT_PUSH_DOMAINS = 'https://push.zositechc.cn/'

+ 1 - 0
Ansjer/cn_config/config_test.py

@@ -37,6 +37,7 @@ PAYPAL_CRD = {
     "client_secret": "EO8kRc8yioDk0i2Qq-QMcVFfwkmyMJorTvBSLDTnxDJJ_wb9VoM_0jkUY9iEng2Flp1ze8wQOGpH5nB2"
 }
 PAYPAL_WEB_HOOK_ID = '6TS30758D98835230'
+PAYPAL_WEB_HOOK_ID_TWO = '2BH56575UJ9324151'
 # PAYPAL_CRD = {
 #     "mode": "sandbox",  # sandbox or live
 #     "client_id": "ATXTpWs8sajNYeU46jNs1yzpy4H_o3RRrGVIJ8Tscc312BjMx12cpRgCucfWX07a4G6GbK8hzElB04Pd",

+ 15 - 1
Ansjer/cn_config/formal_settings.py

@@ -233,6 +233,15 @@ LOGGING = {
             'formatter': 'standard',
             'encoding': 'utf-8',
         },
+        'pay': {
+            'level': 'INFO',
+            'class': 'logging.handlers.TimedRotatingFileHandler',
+            'filename': BASE_DIR + '/static/log/pay/info.log',
+            'backupCount': 60,
+            'when': 'D',
+            'formatter': 'standard',
+            'encoding': 'utf-8',
+        },
     },
     'loggers': {
         'django': {
@@ -247,7 +256,12 @@ LOGGING = {
             'handlers': ['info'],
             'level':'INFO',
             'propagate': False
-        }
+        },
+        'pay': {
+            'handlers': ['pay'],
+            'level': 'INFO',
+            'propagate': False
+        },
         # 'django.db.backends': {
         #     'handlers': ['console'],
         #     'propagate': True,

+ 15 - 1
Ansjer/cn_config/test_settings.py

@@ -245,6 +245,15 @@ LOGGING = {
             'formatter': 'standard',
             'encoding': 'utf-8',
         },
+        'pay': {
+            'level': 'INFO',
+            'class': 'logging.handlers.TimedRotatingFileHandler',
+            'filename': BASE_DIR + '/static/log/pay/info.log',
+            'backupCount': 60,
+            'when': 'D',
+            'formatter': 'standard',
+            'encoding': 'utf-8',
+        },
     },
     'loggers': {
         'django': {
@@ -265,7 +274,12 @@ LOGGING = {
             'handlers': ['device_info'],
             'level':'INFO',
             'propagate': False
-        }
+        },
+        'pay': {
+            'handlers': ['pay'],
+            'level': 'INFO',
+            'propagate': False
+        },
         # 'django.db.backends': {
         #     'handlers': ['console'],
         #     'propagate': True,

+ 0 - 1
Ansjer/config.py

@@ -100,7 +100,6 @@ elif SERVER_TYPE == 'Ansjer.cn_config.formal_settings':
 elif SERVER_TYPE == 'Ansjer.cn_config.test_settings':
     from Ansjer.cn_config.config_test import *
 
-
 DEVICE_TYPE = {
     0: 'UNKOWN',
     1: 'DVR',

+ 2 - 0
Ansjer/eur_config/config_formal.py

@@ -30,6 +30,8 @@ PAYPAL_CRD = {
     "client_secret": "EO8kRc8yioDk0i2Qq-QMcVFfwkmyMJorTvBSLDTnxDJJ_wb9VoM_0jkUY9iEng2Flp1ze8wQOGpH5nB2"
 }
 PAYPAL_WEB_HOOK_ID = '6TS30758D98835230'
+PAYPAL_WEB_HOOK_ID_TWO = '2BH56575UJ9324151'
+
 
 DETECT_PUSH_DOMAIN = 'http://push.dvema.com/'
 DETECT_PUSH_DOMAINS = 'https://push.dvema.com/'

+ 15 - 1
Ansjer/eur_config/formal_settings.py

@@ -231,6 +231,15 @@ LOGGING = {
             'formatter': 'standard',
             'encoding': 'utf-8',
         },
+        'pay': {
+            'level': 'INFO',
+            'class': 'logging.handlers.TimedRotatingFileHandler',
+            'filename': BASE_DIR + '/static/log/pay/info.log',
+            'backupCount': 60,
+            'when': 'D',
+            'formatter': 'standard',
+            'encoding': 'utf-8',
+        },
     },
     'loggers': {
         'django': {
@@ -245,7 +254,12 @@ LOGGING = {
             'handlers': ['info'],
             'level':'INFO',
             'propagate': False
-        }
+        },
+        'pay': {
+            'handlers': ['pay'],
+            'level': 'INFO',
+            'propagate': False
+        },
         # 'django.db.backends': {
         #     'handlers': ['console'],
         #     'propagate': True,

+ 15 - 1
Ansjer/eur_config/test_settings.py

@@ -244,6 +244,15 @@ LOGGING = {
             'formatter': 'standard',
             'encoding': 'utf-8',
         },
+        'pay': {
+            'level': 'INFO',
+            'class': 'logging.handlers.TimedRotatingFileHandler',
+            'filename': BASE_DIR + '/static/log/pay/info.log',
+            'backupCount': 60,
+            'when': 'D',
+            'formatter': 'standard',
+            'encoding': 'utf-8',
+        },
     },
     'loggers': {
         'django': {
@@ -264,7 +273,12 @@ LOGGING = {
             'handlers': ['device_info'],
             'level':'INFO',
             'propagate': False
-        }
+        },
+        'pay': {
+            'handlers': ['pay'],
+            'level': 'INFO',
+            'propagate': False
+        },
         # 'django.db.backends': {
         #     'handlers': ['console'],
         #     'propagate': True,

+ 2 - 0
Ansjer/us_config/config_formal.py

@@ -25,6 +25,8 @@ PAYPAL_CRD = {
     "client_secret": "ENT-J08N3Fw0B0uAokg4RukljAwO9hFHPf8whE6-Dwd8oBWJO8AWMgpdTKpfB1pOy89t4bsFEzMWDowm"
 }
 PAYPAL_WEB_HOOK_ID = '3YH86681TH784461T'
+PAYPAL_WEB_HOOK_ID_TWO = '2BH56575UJ9324151'
+
 # PAYPAL_CRD = {
 #     "mode": "sandbox",  # sandbox or live
 #     "client_id": "AVLoQVq3xHZ6FrF4mxHwlCPgVBAw4Fw5RtMkuxmYd23SkUTIY643n2g3KdK-Al8wV05I28lza5uoQbAA",

+ 14 - 0
Ansjer/us_config/formal_settings.py

@@ -241,6 +241,15 @@ LOGGING = {
             'formatter': 'standard',
             'encoding': 'utf-8',
         },
+        'pay': {
+            'level': 'INFO',
+            'class': 'logging.handlers.TimedRotatingFileHandler',
+            'filename': BASE_DIR + '/static/log/pay/info.log',
+            'backupCount': 60,
+            'when': 'D',
+            'formatter': 'standard',
+            'encoding': 'utf-8',
+        },
     },
     'loggers': {
         'django': {
@@ -261,6 +270,11 @@ LOGGING = {
             'level':'INFO',
             'propagate': False
         },
+        'pay': {
+            'handlers': ['pay'],
+            'level':'INFO',
+            'propagate': False
+        },
         # 'django.db.backends': {
         #     'handlers': ['console'],
         #     'propagate': True,

+ 15 - 1
Ansjer/us_config/test_settings.py

@@ -244,6 +244,15 @@ LOGGING = {
             'formatter': 'standard',
             'encoding': 'utf-8',
         },
+        'pay': {
+            'level': 'INFO',
+            'class': 'logging.handlers.TimedRotatingFileHandler',
+            'filename': BASE_DIR + '/static/log/pay/info.log',
+            'backupCount': 60,
+            'when': 'D',
+            'formatter': 'standard',
+            'encoding': 'utf-8',
+        },
     },
     'loggers': {
         'django': {
@@ -264,7 +273,12 @@ LOGGING = {
             'handlers': ['device_info'],
             'level':'INFO',
             'propagate': False
-        }
+        },
+        'pay': {
+            'handlers': ['pay'],
+            'level': 'INFO',
+            'propagate': False
+        },
         # 'django.db.backends': {
         #     'handlers': ['console'],
         #     'propagate': True,

+ 5 - 5
Controller/PaymentCycle.py

@@ -1,4 +1,4 @@
-from Ansjer.config import PAYPAL_CRD,SERVER_DOMAIN,SERVER_DOMAIN_SSL,PAYPAL_WEB_HOOK_ID
+from Ansjer.config import PAYPAL_CRD,SERVER_DOMAIN,SERVER_DOMAIN_SSL,PAYPAL_WEB_HOOK_ID, PAYPAL_WEB_HOOK_ID_TWO
 from Model.models import PayCycleConfigModel,Order_Model, Store_Meal, UID_Bucket, PromotionRuleModel, Unused_Uid_Meal,Device_Info, CouponModel, Order_Model
 from Service.CommonService import CommonService
 from django.http import JsonResponse, HttpResponseRedirect, HttpResponse
@@ -148,7 +148,7 @@ class PaypalCycleNotify(View):
         lang = request_dict.get('lang', 'en')
         token = request_dict.get('token',None)
 
-        logger = logging.getLogger('info')
+        logger = logging.getLogger('pay')
         logger.info('---------进入paypay自动续费异步回调')
         logger.info(request_dict)
 
@@ -287,7 +287,7 @@ class PaypalCycleNotify(View):
 
 
     def do_paypal_webhook_notify(self, request_dict, request, response):
-        logger = logging.getLogger('info')
+        logger = logging.getLogger('pay')
         logger.info('---into---webhook_notify-------')
         logger.info('---request_dict-------')
         logger.info(request_dict)
@@ -473,7 +473,7 @@ class PaypalCycleNotify(View):
 
 
     def do_subscription_notify(self, request_dict, request, response):
-        logger = logging.getLogger('info')
+        logger = logging.getLogger('pay')
         logger.info('---into---do_subscription_notify-------')
         json_agreement_str = request.body.decode("utf-8")
         json_obj = json.loads(json_agreement_str)
@@ -513,7 +513,7 @@ class PaypalCycleNotify(View):
         if resource_type == 'sale' and paypal_body.get('state') == 'completed':
             paypalrestsdk.configure(PAYPAL_CRD)
             response = paypalrestsdk.WebhookEvent.verify(
-                transmission_id, transmission_time, PAYPAL_WEB_HOOK_ID, json_agreement_str, cert_url, transmission_sig, auth_algo)
+                transmission_id, transmission_time, PAYPAL_WEB_HOOK_ID_TWO, json_agreement_str, cert_url, transmission_sig, auth_algo)
             logger.info('-----------------------verify')
             logger.info(response)
             if response: