-
Notifications
You must be signed in to change notification settings - Fork 3k
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] Integrate “Your plan” section with backend data and related screens #43128
[Payment card / Subscription] Integrate “Your plan” section with backend data and related screens #43128
Conversation
import usePreferredCurrency from './usePreferredCurrency'; | ||
import useSubscriptionPlan from './useSubscriptionPlan'; | ||
|
||
const SUBSCRIPTION_PRICES = { |
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.
Is it better to move it to CONST.ts?
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.
Its values are based on CONST
, so it's impossible to put it in that object, and I also can't see any other const
being exported from that file, only types
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.
@JKobrynski Hmm, I was thinking if we should code subscription prices in CONST.ts too - then it'll be easier for the team to maintain them, like team members from business team
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 agree this is not ideal but I'm also not seeing a better way to handle it so I think it is what it is
@eh2077 PR updated |
Reviewer Checklist
Screenshots/VideosAndroid: Native0-android.mp4Android: mWeb Chrome0-mobile-chrome.mp4iOS: Native0-ios.mp4iOS: mWeb Safari0-mobile-safari.mp4MacOS: Chrome / Safari0-web.mp4MacOS: Desktop0-desktop.mp4 |
@JKobrynski The control plan is missing |
@eh2077 PR updated, I added the missing benefit |
@JKobrynski For collect plan, do we need to include the benefit - |
@eh2077 I'm not sure, it changed over time and it's difficult to say what is the final version, I think we need someone to clarify this. |
@JKobrynski Android App crashed when opening the subscription page. I tried following methods
0-android-crash-when-open-subscription-page.mp4 |
|
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.
Code looks good! I'm working on preparing recordings for native Apps
return NumberFormatUtils.format(BaseLocaleListener.getPreferredLocale(), convertedAmount, { | ||
style: 'currency', | ||
currency, | ||
|
||
// There will be no decimals displayed (e.g. $9) | ||
minimumFractionDigits: 0, |
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.
Just out of curiosity, does adding this line fix the crash on Android? If so, why?
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.
Yes, it does fix it! Hard to say why, it just doesn't work without it, the app crashes and doesn't show any useful crash details, even when using adb logcat
with filters
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.
Tested well! Checklist is completed.
src/hooks/usePreferredCurrency.ts
Outdated
/** | ||
* Get user's preferred currency in the following order: | ||
* | ||
* 1. Default card currency |
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. Default card currency | |
* 1. Payment card currency |
src/hooks/usePreferredCurrency.ts
Outdated
const [session] = useOnyx(ONYXKEYS.SESSION); | ||
const [fundList] = useOnyx(ONYXKEYS.FUND_LIST); | ||
|
||
const defaultCardCurrency = useMemo(() => Object.values(fundList ?? {}).find((card) => card.isDefault)?.accountData?.currency, [fundList]); |
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.
const defaultCardCurrency = useMemo(() => Object.values(fundList ?? {}).find((card) => card.isDefault)?.accountData?.currency, [fundList]); | |
const paymentCardCurrency = useMemo(() => Object.values(fundList ?? {}).find((card) => card.accountData?.additionalData?.isBillingCard)?.accountData?.currency, [fundList]); |
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.
The defaultCard is for P2P wallet, we want to identify the payment card (backend data will match my suggestion after #43136 is completed)
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.
Got it, so basically we have to wait for #43136 to be closed so we can merge this?
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.
No I don't think we need to wait for it to finish/deploy, we can make the update here ahead of time and merge since we know what the shape will be
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.
Updated!
import usePreferredCurrency from './usePreferredCurrency'; | ||
import useSubscriptionPlan from './useSubscriptionPlan'; | ||
|
||
const SUBSCRIPTION_PRICES = { |
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 agree this is not ideal but I'm also not seeing a better way to handle it so I think it is what it is
✋ 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 staging by https://github.com/amyevans in version: 1.4.82-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.82-4 🚀
|
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
$ #38621
PROPOSAL: N/A
Tests
Offline tests
Same as Tests section above
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop