-
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
Add ChooseTransferAccountPage and allow selecting accounts for wallet transfer #7200
Add ChooseTransferAccountPage and allow selecting accounts for wallet transfer #7200
Conversation
I didn't do these steps
I used MenuItem directly as there was no need to add Popover and disabled the add Payment method button from the paymentMethodList via a prop. There was no new logic needed for the SelectablePaymentMethodList so I used passed the props to filter the list and show the checkboxes. I don't see any other way of creating a component from |
cc: @marcaaron |
Updated. |
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.
Testing went pretty well, it's looking good! One bug I found was that when you click add debit card, it always sends you to the add bank account page
Updated @stitesExpensify @marcaaron . |
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 pretty good to me. I found 2 more bugs while testing though.
- If you have 2 accounts and go to the transfer page, then click the ACH button, neither account is selected even though one was selected on the main page
- If you have a debit card set as your default, it is not shown on the main transfer page
How can I set the default Payment Method? @stitesExpensify |
The
You can substitute the |
Ok. Fixed both issues.
Updated. cc: @stitesExpensify |
I'm still running into some issues while testing. Debit cards seem to work, but if I make a bank account my default the selected account won't change 2022-01-18_18-06-34.mp4 |
Interesting issue. I can't think of the reason why this is happening but I have two accounts now and I will try to test it. |
Finally, fixed. Thanks for catching these issues. I was doing the wrong matching to get the SelectedAccount. It was picking the Defaultaccount if that comes before in the position the selected account in the payment method Array. Took me some time to figure it out. Lesson learned: Always criticize your own code. Ready for review @marcaaron @stitesExpensify |
This is ready @marcaaron @stitesExpensify . Sorry for the ping. |
No worries, but there are guidelines here about when it is appropriate to ping if you need a reminder. |
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.
Approving since the code is acceptable. Left some non blocking comments and ideas for improvements that can potentially be addressed in follow ups.
: account.fundID, | ||
); | ||
Navigation.navigate(ROUTES.SETTINGS_PAYMENTS_TRANSFER_BALANCE); | ||
}; |
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.
NAB, this method isn't using props
so we are redeclaring it on every render. Not that this will make a huge difference performance-wise, but it feels like this is not the correct scope to declare it.
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.
Yeah, I agree but I didn't see any example of such a functional component. Where should I move this. Outside the component in the same file?
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.
Yeah outside the component in the same file would work. Also maybe a good sign that it should be an action instead of a component method.
? account.bankAccountID | ||
: account.fundID, | ||
); | ||
Navigation.navigate(ROUTES.SETTINGS_PAYMENTS_TRANSFER_BALANCE); |
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 we are going back can we just do Navigation.goBack()
?
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.
Whatever we do maybe it should be consistent because we are using Navigation.goBack()
here
onBackButtonPress={() => Navigation.goBack()} |
shouldShowSelectedState | ||
filterType={props.walletTransfer.filterPaymentMethodType} | ||
selectedMethodID={props.walletTransfer.selectedAccountID} | ||
shouldShowAddPaymentMethodButton={false} |
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.
NAB, but it would be better to eventually find the case where we DO want to show an add payment method button and show one next to the list instead of inside of it. Now we have this list that must specify "no thanks, I don't need this". And in this case we just shows a very similar button below which could be confusing.
Maybe a good follow up issue to create and have someone fix up.
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.
Yeah, I was thinking th same but then it would unnecessary refactor for this PR so I left it as it is.
PaymentMethods.saveWalletTransferAccountTypeAndID( | ||
selectedAccount.accountType, | ||
selectedAccount.methodID, | ||
); |
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.
NAB, the more I look at this the more wrong it seems. We are saving data that can be derived from looking at other data and just sort of seems like stuff this component shouldn't be responsible for.
Maybe it says "when I am first loaded then set the most likely default payment method", but I don't think it would be this component's responsibility to filter everything.
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.
Yeah that is true. Let me see if I can clean this up bit.
PaymentMethods.saveWalletTransferMethodType(filterPaymentMethodType); | ||
Navigation.navigate(ROUTES.SETTINGS_PAYMENTS_CHOOSE_TRANSFER_ACCOUNT); | ||
} | ||
|
||
render() { | ||
const selectedAccount = this.getSelectedPaymentMethodAccount(); |
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.
NAB, feels like we are unnecessarily filtering through all the payment methods to derive this and giving a lot of responsibility to this component.
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.
e.g. if we are initializing the payment method type in walletTransfer. accountType
and it is based on the value in getSelectedPaymentMethodAccount()
then we should be able to just look in walletTransfer
? Or no?
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.
When we come back from Choose Transfer Account screen. This helps in picking the selected method. Either we should do that in componentDidUpdate or 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.
Yeah I'm not sure that's easy to see or why that would be the case. It maybe works, but the whole interaction between the different sets of data and why we are filtering them on every render is confusing.
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, and it tests well! Nice job 😄
✋ 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 @stitesExpensify in version: 1.1.32-1 🚀
|
🚀 Deployed to production by @roryabraham in version: 1.1.33-3 🚀
|
Details
Fixed Issues
$ #3922
Tests | QA Steps
Open Payments page.
Click TransferBalance Link.
Confirm that the transfer button is disabled if the following conditions are true.
i. Transfer Amount is less than $ 0.30.
ii. Which Account is not selected.
Click instant Mode.
It should take you to the new page where you will select an account. This page should show you Debit cards only and Add Debit Card Button.
Clicking
+ Add Debit Card
Button opens a new page to add Debit Card.From the Select Account page, click on the any debit card.
You should be taken to the old page where you can see the selected debit card as
Which account?
If your balance is > Fee then
Transfer
Button should be active and it should show the transfer amount - fee.Click 1-3 Business Days Mode.
It should take you to the new page where you will select an account. This page should show you Bank Accounts only and Add bank account Button.
Clicking
+ Add bank Account
Button opens a new page to add bank Account.From the Select Account page, click on any bank account.
You should be taken to the old page where you can see the selected bank account card as
Which account?
If your balance is > Fee then
Transfer
Button should be active and it should show the transfer amount - fee.If your balance is > Fee and which account is set.
i. Click Transfer button.
ii. Now you should be taken to the Payments Page and a confirm modal should be shown.
Tested On
Screenshots
Web | Desktop
output_file.mp4
Mobile Web
iOS
Android