Unverified Commit 83ac9c4e authored by Simon Esposito's avatar Simon Esposito Committed by GitHub
Browse files

Return Google sub original owner on validation. (#1036)

parent f0bd8b8e
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -395,13 +395,8 @@ func ValidateSubscriptionGoogle(ctx context.Context, logger *zap.Logger, db *sql
		storageSub.originalTransactionId = gResponse.LinkedPurchaseToken
	}

	suid := storageSub.userID.String()
	if storageSub.userID.IsNil() {
		suid = ""
	}

	validatedSub := &api.ValidatedSubscription{
		UserId:                suid,
		UserId:                userID.String(),
		ProductId:             storageSub.productId,
		OriginalTransactionId: storageSub.originalTransactionId,
		Store:                 storageSub.store,
@@ -421,6 +416,12 @@ func ValidateSubscriptionGoogle(ctx context.Context, logger *zap.Logger, db *sql
		return nil, err
	}

	suid := storageSub.userID.String()
	if storageSub.userID.IsNil() {
		suid = ""
	}

	validatedSub.UserId = suid
	validatedSub.CreateTime = timestamppb.New(storageSub.createTime)
	validatedSub.UpdateTime = timestamppb.New(storageSub.updateTime)
	validatedSub.ProviderResponse = storageSub.rawResponse