|
@@ -444,28 +444,7 @@ class InAppPurchaseView(View):
|
|
|
|
|
|
elif str(decoded_payload.rawNotificationType) == "SUBSCRIBED":
|
|
|
# 处理订阅
|
|
|
- # 一种通知类型,与其子类型一起表示客户订阅了自动续订的套餐。如果子类型为
|
|
|
- # INITIAL_BUY(首次购买),则表示用户首次购买或通过家庭共享访问该订阅。如果子类型为
|
|
|
- decoded_transaction_information = verifier.verify_and_decode_signed_transaction(
|
|
|
- decoded_payload.data.signedTransactionInfo)
|
|
|
-
|
|
|
- # 之前订阅过不可重复订阅
|
|
|
- key_id = 'N42WMFCV6A'
|
|
|
- issuer_id = '69a6de8c-789b-47e3-e053-5b8c7c11a4d1'
|
|
|
- bundle_id = 'com.ansjer.zccloud'
|
|
|
- environment = ENV
|
|
|
- key_path = '{}/Ansjer/file/in_app_purchase/SubscriptionKey_N42WMFCV6A.p8'.format(BASE_DIR)
|
|
|
- with open(key_path, 'rb') as file:
|
|
|
- # 读取文件内容
|
|
|
- private_key = file.read()
|
|
|
-
|
|
|
- client = AppStoreServerAPIClient(private_key, key_id, issuer_id, bundle_id, environment)
|
|
|
- transaction_id = decoded_transaction_information.transactionId
|
|
|
- transaction_subscription = client.get_all_subscription_statuses(transaction_id)
|
|
|
- if transaction_subscription.data:
|
|
|
- for subscription in transaction_subscription.data[0].lastTransactions:
|
|
|
- if str(subscription.status) == "Status.ACTIVE":
|
|
|
- return HttpResponse(status=400)
|
|
|
+ pass
|
|
|
|
|
|
elif str(decoded_payload.rawNotificationType) == "EXPIRED":
|
|
|
# 一种通知类型,与其子类型一起表示订阅已过期。如果subtype为
|