-
Notifications
You must be signed in to change notification settings - Fork 14
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
Prevent Guardian Ad-Lite purchase by users who have either of adFree
or allowRejectAll
benefits already
#6675
Conversation
Size Change: +402 B (+0.02%) Total Size: 2.37 MB ℹ️ View Unchanged
|
for { | ||
benefits <- userBenefitsApiService | ||
.getUserBenefits(userDetails.userDetails.identityId) | ||
.leftMap(_ => ServerError("Something went wrong calling the user benefits API")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's an issue with calling the user benefits API the purchase will be blocked and we'll show a generic error message to the user.
userDetails: UserDetails, | ||
isSignedIn: Boolean, | ||
) | ||
|
||
private def createSubscription(implicit | ||
settings: AllSettings, | ||
request: CreateRequest, | ||
): EitherT[Future, CreateSubscriptionError, CreateSubscriptionResponse] = { | ||
|
||
val maybeLoggedInUserDetails = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this now be "maybeUserDetails" since the signed in status can vary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had this same thought and decided to leave it as is because in the case of this val
it's still either:
None
or- The details of a user who is signed in.
I.e. maybeLoggedInUserDetails
won't ever contain information about a user who isn't signed in. Though like you say it's true that the Option
type UserDetailsWithSignedInStatus
can represent this state. What do you reckon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, right. That's quite subtle but seems fine to leave as is
Does this work for test users? We're going to need to query the code version of user-benefits api I think. |
adFree
benefit alreadyadFree
or rejectTracking
benefits already
2bd1b98
to
1f5716c
Compare
The previous approach wasn't working correctly.
This required moving to a service provider approach, where the service returned depends on whether the current user is a test user.
1f5716c
to
0be1361
Compare
|
This was left over after the migration to touchpoint envs so we could support test users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
adFree
or rejectTracking
benefits alreadyadFree
or allowRejectAll
benefits already
Seen on PROD (merged by @tjmw 10 minutes and 58 seconds ago)
Sentry Release: support-client-side, support |
What are you doing in this PR?
If a non signed-in user already has the
adFree
orallowRejectAll
benefit, they shouldn't be able to purchase Guardian Ad-Lite. We're assuming that a signed-in user withadFree
orallowRejectAll
wouldn't make it to the checkout as there's no user journey for this.Trello Card
Why are you doing this?
It doesn't make sense to buy Guardian Ad-Lite if you get ad free reading or can already reject tracking.
How to test
I've tested locally and in CODE. When a signed out user already has the ad-free or reject-tracking benefit, an error is shown:
A user without these benefits is able to purchase successfully.
How can we measure success?
Have we considered potential risks?
Accessibility test checklist
Screenshots