|
@@ -64,6 +64,8 @@ class InAppPurchaseView(View):
|
|
uid = request_dict.get('uid', None)
|
|
uid = request_dict.get('uid', None)
|
|
lang = request_dict.get('lang', 'en')
|
|
lang = request_dict.get('lang', 'en')
|
|
channel = request_dict.get('channel', None)
|
|
channel = request_dict.get('channel', None)
|
|
|
|
+ logger = logging.getLogger('apple_pay')
|
|
|
|
+ logger.info(f"认证交易receipt:{receipt}")
|
|
|
|
|
|
if not all([receipt, uid, channel]):
|
|
if not all([receipt, uid, channel]):
|
|
return response.json(444)
|
|
return response.json(444)
|
|
@@ -140,8 +142,8 @@ class InAppPurchaseView(View):
|
|
transaction_subscription = client.get_all_subscription_statuses(transaction_id)
|
|
transaction_subscription = client.get_all_subscription_statuses(transaction_id)
|
|
if transaction_subscription.data:
|
|
if transaction_subscription.data:
|
|
for subscription in transaction_subscription.data[0].lastTransactions:
|
|
for subscription in transaction_subscription.data[0].lastTransactions:
|
|
- if int(subscription.status) != 2 or int(subscription.status) != 5:
|
|
|
|
- return response.json(10048)
|
|
|
|
|
|
+ if str(subscription.status) == "Status.ACTIVE":
|
|
|
|
+ return response.json(10048, f"订阅状态为 {subscription.status} ")
|
|
|
|
|
|
pay_type = PAY_TYPE_IN_APP_PURCHASE
|
|
pay_type = PAY_TYPE_IN_APP_PURCHASE
|
|
now_time = int(time.time())
|
|
now_time = int(time.time())
|
|
@@ -346,6 +348,10 @@ class InAppPurchaseView(View):
|
|
|
|
|
|
return HttpResponse(status=200)
|
|
return HttpResponse(status=200)
|
|
|
|
|
|
|
|
+ else:
|
|
|
|
+ logger.info('App Store服务器通知不是post请求')
|
|
|
|
+ return HttpResponse(status=400)
|
|
|
|
+
|
|
except Exception as e:
|
|
except Exception as e:
|
|
logger.info('App Store服务器通知异常:{}'.
|
|
logger.info('App Store服务器通知异常:{}'.
|
|
format('error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e))))
|
|
format('error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e))))
|