-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Payment card / Subscription] Implement changing plan actions #43029
[Payment card / Subscription] Implement changing plan actions #43029
Conversation
f8623b5
to
783689c
Compare
@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Does this need C+ review? |
@mananjadhav not sure, @amyevans can you help here? 🙏 |
@mananjadhav why would you think it doesn't need C+? |
Because it was reviewed by two folks from the agency. |
@mananjadhav it's the standard procedure for the vast majority of our PRs, so if that's the question then yes, it does need a C+ review 😄 |
Yep, jump on it Manan! Your 👀 and ✅ are desired here.. 😄 |
I reviewed the code, testing it now. |
@JKobrynski @amyevans We're not throwing an error if the API fails. Also I am not sure what the offline behavior is. It says same behavior as Tests. plan-change.mov |
Offline behavior: pattern B - you should be able to switch between plan types offline optimistically but it will be greyed out at 50% opacity until back online. We need to display a RBR if the API returns an error |
Thanks for confirmation @JKobrynski Can you please fix this and ping once done? |
@JKobrynski Based on the message from Eugene, I think the RBR will be added in #42431. So I think we can do one final review by @Expensify/design before we can finish the checklist. |
The UI looks good to me, and I've one small change on the code. I'll work on the checklist anyway and pending completion based on the change. |
src/libs/API/types.ts
Outdated
@@ -443,6 +444,8 @@ type WriteCommandParameters = { | |||
[WRITE_COMMANDS.SEND_INVOICE]: Parameters.SendInvoiceParams; | |||
[WRITE_COMMANDS.PAY_INVOICE]: Parameters.PayInvoiceParams; | |||
[WRITE_COMMANDS.MARK_AS_CASH]: Parameters.MarkAsCashParams; | |||
|
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.
src/libs/actions/Subscription.ts
Outdated
onyxMethod: Onyx.METHOD.MERGE, | ||
key: ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION, | ||
value: { | ||
type, |
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.
We don't want to save the wrong type if it fails, it should restore to the existing value
@amyevans @mananjadhav PR updated! |
Thanks @JKobrynski. I’ll be able to review this in 1-2 hours |
Reviewer Checklist
Screenshots/VideosAndroid: mWeb Chromemweb-chrome-subscription-plan-change.moviOS: mWeb Safarimweb-safari-subscription-plan-change.movMacOS: Chrome / Safariweb-subscription-plan-change.movMacOS: Desktopdesktop-subscription-plan-change.mov |
@JKobrynski One last comment if you could replace the mobile web screenshots showing the stacked view. Rest all looks good. |
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.
1 last thing related to the failure case, otherwise good to go
src/libs/actions/Subscription.ts
Outdated
value: { | ||
pendingAction: null, | ||
}, |
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.
Sorry, just to expand on what I mentioned earlier - to restore to the existing value type
value upon failure, we need to set the existing value here. So you could either pass that into the function, or since there's only 2 options, do something like
type: type === CONST.SUBSCRIPTION.TYPE.ANNUAL ? CONST.SUBSCRIPTION.TYPE.PAYPERUSE : CONST.SUBSCRIPTION.TYPE.ANNUAL,
Current behavior if I force an error:
incorrect-failure-data.mov
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.
Ohh sorry I misread too! Thanks for clarifying.
@amyevans @mananjadhav PR updated 🫡 |
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION, | ||
value: { |
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.
@amyevans Should we set errors
key here?
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.
Nope those would get populated by the API response
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, however there's a conflict to resolve @JKobrynski
@amyevans conflict resolved! |
Looks like we want to wait for @dannymcclain's input in this thread so I'll hold on that before merging |
Just saw this—I agree with Shawn's suggested changes! |
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.
🚀
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.83-3 🚀
|
Details
To access this newly created component, paste the following link into the browser
https://dev.new.expensify.com:8082/settings/subscription
or add this effect to
InitialSettingsPage.tsx
Fixed Issues
$ #38622
PROPOSAL: N/A
Tests
Offline tests
Same as Tests section above, except the log out/in part
QA Steps
Same as Tests section above
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
It's disabled on native Android
Android: mWeb Chrome
chrome-compressed.webm
iOS: Native
It's disabled on native iOS
iOS: mWeb Safari
safari-compressed.mp4
MacOS: Chrome / Safari
web-compressed.mov
MacOS: Desktop
desktop-compressed.mov