|
@@ -1453,36 +1453,36 @@ class CronComparedDataView(View):
|
|
if item['transaction_info']['transaction_event_code'] == 'T1107':
|
|
if item['transaction_info']['transaction_event_code'] == 'T1107':
|
|
trade_no = item['transaction_info']['paypal_reference_id']
|
|
trade_no = item['transaction_info']['paypal_reference_id']
|
|
order_qs = Order_Model.objects.filter(trade_no=trade_no, payType=1)
|
|
order_qs = Order_Model.objects.filter(trade_no=trade_no, payType=1)
|
|
- # if not order_qs.exists():
|
|
|
|
- # transaction_subject = item['transaction_info'].get('transaction_subject', '')
|
|
|
|
- # agreement_id = item['transaction_info'].get('paypal_reference_id', '')
|
|
|
|
- # pay_time = datetime.datetime.strptime(item['transaction_info']['transaction_initiation_date'],
|
|
|
|
- # "%Y-%m-%dT%H:%M:%S%z").timestamp()
|
|
|
|
- # order_dict = {
|
|
|
|
- # 'trade_no': trade_no,
|
|
|
|
- # 'agreement_id': agreement_id,
|
|
|
|
- # 'pay_time': pay_time,
|
|
|
|
- # 'username': item['payer_info']['email_address'],
|
|
|
|
- # 'price': item['transaction_info']['transaction_amount']['value'],
|
|
|
|
- # 'pay_type': 1,
|
|
|
|
- # 'upd_time': now_time,
|
|
|
|
- # 'status': 0,
|
|
|
|
- # 'meal_name': transaction_subject
|
|
|
|
- # }
|
|
|
|
- # if agreement_id:
|
|
|
|
- # order_dict['pay_type'] = 0
|
|
|
|
- # order_dict['meal_name'] = 'paypal_cycle'
|
|
|
|
- # order_dict['order_id'] = transaction_subject
|
|
|
|
- # params = {'trade_no': trade_no}
|
|
|
|
- # response = requests.get('https://www.zositeche.com/testApi/checkOrderExist', params=params)
|
|
|
|
- # if response.status_code != 200:
|
|
|
|
- # # 如果响应失败,记录在数据库
|
|
|
|
- # AbnormalOrder.objects.create(**order_dict)
|
|
|
|
- # continue
|
|
|
|
- # result = response.json()
|
|
|
|
- # if result['result_code'] != 0 or not result['result']['is_exist']:
|
|
|
|
- # # 如果响应结果为空,记录在数据库
|
|
|
|
- # AbnormalOrder.objects.create(**order_dict)
|
|
|
|
|
|
+ if not order_qs.exists():
|
|
|
|
+ transaction_subject = item['transaction_info'].get('transaction_subject', '')
|
|
|
|
+ agreement_id = item['transaction_info'].get('paypal_reference_id', '')
|
|
|
|
+ pay_time = datetime.datetime.strptime(item['transaction_info']['transaction_initiation_date'],
|
|
|
|
+ "%Y-%m-%dT%H:%M:%S%z").timestamp()
|
|
|
|
+ order_dict = {
|
|
|
|
+ 'trade_no': trade_no,
|
|
|
|
+ 'agreement_id': agreement_id,
|
|
|
|
+ 'pay_time': pay_time,
|
|
|
|
+ 'username': item['payer_info']['email_address'],
|
|
|
|
+ 'price': item['transaction_info']['transaction_amount']['value'],
|
|
|
|
+ 'pay_type': 1,
|
|
|
|
+ 'upd_time': now_time,
|
|
|
|
+ 'status': 0,
|
|
|
|
+ 'meal_name': transaction_subject
|
|
|
|
+ }
|
|
|
|
+ if agreement_id:
|
|
|
|
+ order_dict['pay_type'] = 0
|
|
|
|
+ order_dict['meal_name'] = 'paypal_cycle'
|
|
|
|
+ order_dict['order_id'] = transaction_subject
|
|
|
|
+ params = {'trade_no': trade_no}
|
|
|
|
+ response = requests.get('https://www.zositeche.com/testApi/checkOrderExist', params=params)
|
|
|
|
+ if response.status_code != 200:
|
|
|
|
+ # 如果响应失败,记录在数据库
|
|
|
|
+ AbnormalOrder.objects.create(**order_dict)
|
|
|
|
+ continue
|
|
|
|
+ result = response.json()
|
|
|
|
+ if result['result_code'] != 0 or not result['result']['is_exist']:
|
|
|
|
+ # 如果响应结果为空,记录在数据库
|
|
|
|
+ AbnormalOrder.objects.create(**order_dict)
|
|
total = round(total, 2)
|
|
total = round(total, 2)
|
|
daily_reconciliation = DailyReconciliation.objects.filter(time=timestamp)
|
|
daily_reconciliation = DailyReconciliation.objects.filter(time=timestamp)
|
|
if daily_reconciliation.exists():
|
|
if daily_reconciliation.exists():
|