Skip to content

Improve Google subscription lookup on notification #2329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sesposito
Copy link
Member

When a Google subscription notification contains a LinkedPurchaseToken field, lookup subscription OriginalTransactionId by that linked purchase token.

When a Google subscription notification contains a LinkedPurchaseToken
field, lookup subscription OriginalTransactionId by that linked
purchase token.
@sesposito sesposito requested review from zyro, ftkg and Copilot May 26, 2025 10:23
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Enhance Google subscription notification handling to use the LinkedPurchaseToken when available and improve context propagation throughout subscription and purchase operations.

  • Propagate r.Context() instead of context.Background() in various handlers for proper cancellation and deadlines.
  • Introduce logic to override the original purchase token with LinkedPurchaseToken when processing Google subscription notifications.
  • Update storageSub.originalTransactionId with the linked token before upserting.
Comments suppressed due to low confidence (1)

server/core_subscription.go:1111

  • Add tests covering the case where gResponse.LinkedPurchaseToken is non-empty to verify that the override of purchaseToken and subsequent subscription lookup works correctly.
if gResponse.LinkedPurchaseToken != "" {

Use propagate request context in notifications callback.
@sesposito sesposito force-pushed the spe/google-sub-notif-handling branch from 0c8efd6 to 76c1444 Compare May 26, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant