Apple in app fix (#1369)
* error log if issue with apple sub * use the right secret when polling apple sub
This commit is contained in:
parent
87047b3250
commit
2f769b38ad
|
@ -474,7 +474,7 @@ def verify_receipt(receipt_data, user, password) -> Optional[AppleSubscription]:
|
|||
# }
|
||||
|
||||
if data["status"] != 0:
|
||||
LOG.w(
|
||||
LOG.e(
|
||||
"verifyReceipt status !=0, probably invalid receipt. User %s, data %s",
|
||||
user,
|
||||
data,
|
||||
|
@ -521,9 +521,10 @@ def verify_receipt(receipt_data, user, password) -> Optional[AppleSubscription]:
|
|||
|
||||
if apple_sub:
|
||||
LOG.d(
|
||||
"Update AppleSubscription for user %s, expired at %s, plan %s",
|
||||
"Update AppleSubscription for user %s, expired at %s (%s), plan %s",
|
||||
user,
|
||||
expires_date,
|
||||
expires_date.humanize(),
|
||||
plan,
|
||||
)
|
||||
apple_sub.receipt_data = receipt_data
|
||||
|
|
8
cron.py
8
cron.py
|
@ -264,9 +264,15 @@ def poll_apple_subscription():
|
|||
"""Poll Apple API to update AppleSubscription"""
|
||||
# todo: only near the end of the subscription
|
||||
for apple_sub in AppleSubscription.all():
|
||||
if not apple_sub.product_id:
|
||||
LOG.d("Ignore %s", apple_sub)
|
||||
continue
|
||||
|
||||
user = apple_sub.user
|
||||
verify_receipt(apple_sub.receipt_data, user, APPLE_API_SECRET)
|
||||
if "io.simplelogin.macapp.subscription" in apple_sub.product_id:
|
||||
verify_receipt(apple_sub.receipt_data, user, MACAPP_APPLE_API_SECRET)
|
||||
else:
|
||||
verify_receipt(apple_sub.receipt_data, user, APPLE_API_SECRET)
|
||||
|
||||
LOG.d("Finish poll_apple_subscription")
|
||||
|
||||
|
|
Loading…
Reference in a new issue