[HOLD for payment 2022-02-08] [HOLD for payment 2022-01-25] Add the Transfer Balance Page
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
This is a new E.cash initiative. See expected result.
Expected Result:

-
Create a new file
/PaymentPages/TransferBalancePage.js -
Add a route for the transfer balance page:
ROUTES.SETTINGS_TRANSFER_BALANCE = "settings/payments/transfer-balance" -
Add a "Transfer Balance" button to
PaymentsPage.jsthat links to the new transfer page- Icon:
- We will need to add the transfer icon to the assets/images folder, and then export it in
src/components/Icon/Expensicons.js. - We will then import it in PaymentsPage.js and pass that icon as a param
- We will need to add the transfer icon to the assets/images folder, and then export it in
- OnPress:
- Navigate to the transfer balance page
- PrimaryText: “Transfer Balance”
- shouldShowRightArrow: True
- The button will only be shown if there is a balance above $0
- Icon:
-
Add the
<currentBalance>component to the top -
Add 2
<menuItem>components for instant/slow transfer- Instant:
- Icon: LightningBolt (new)
- PrimaryText: Instant
- SecondaryText: 1.5% fee ($0.25 minimum)
- onPress: () => this.setState({transferType: Instant})
- ACH:
- Icon: Bank
- PrimaryText: 1-3 Business Days
- SecondaryText: No Fee
- onPress: () =. this.setState({transferType: ACH})
- When the state changes, the item that was clicked will show a different border and icon color
- Instant:
-
Create the "Which Account" section
- This should be a
<MenuItem> - For an example of the rendering take a look at
PaymentMethodList.js - The initial account should be the account defined in the onyx prop
USER_WALLET.linkedBankAccount - The onPress for the MenuItem will navigate to
ChooseTransferAccountPage
- This should be a
-
Create a new page
ChooseTransferAccountPage.js(screenshot 3)- The route for this page will be
ROUTES.SETTINGS_PAYMENTS_CHOOSE_TRANSFER_ACCOUNT = “settings/payments/choose-transfer-Account” - The page will display a
<PaymentMethodList>- When a method is selected, we will route back to
TransferBalancePagewith the account type and ID - The selected method should be displayed in the choose account section
- When a method is selected, we will route back to
- The route for this page will be
-
Create the "Transfer" button
- This should be a
<PressableOpacity> - The
onPressshould:- Call PaymentMethods.TransferWalletBalance() (described below)
- Display a
<FullScreenLoadingIndicator> - When the API command is complete
- Hide the loading indicator
- Display a success modal (The far right screenshot) that on submit will reroute to PaymentsPage.js
- This will be created by using the default react native
component, similar to confirmModal.js
- This should be a
-
Create a new method in
PaymentMethods.jscalledTransferWalletBalance()- This should call a new method in
API.jscalledTransferWalletBalance()- This will call the API command
TransferWalletBalance(no parameters necessary)
- This will call the API command
- Once the API call comes back positive this method should set
USER_WALLET.balance = 0in Onyx
- This should call a new method in
Progress
Per this comment we are breaking this down to smaller pieces.
-
[x] Do a simple PR to scaffold out some of the little changes first and add all the assets, consts, pages, etc (PR)
- Add consts
- Add Routes
- Add blank pages for the new routes we are adding
- Translations
- API.js change
- Move payment methods list building logic into PaymentUtils without modifying the original logic and use in PaymentMethodList.
-
[x] Create the TransferBalancePage and have the account select feature disabled for now - we can test with just the default account and see that transfers can be initiated, errors handled, etc. (PR)
-
[x] Create a new component that wraps AddPaymentMethodMenu (without modifying this component too much) and call it “AddBalanceTransferAccountButton”
-
[x] Create a version of the PaymentMethodList that is selectable. It should not duplicate the logic, but wrap PaymentMethodList.
-
[x] Build out the ChooseTransferBalanceAccount page and hook it up to TransferBalancePage so we can select an account.
Platform:
All platforms
Version Number: N/A Logs: N/A Notes/Photos/Videos: Please ask any questions in this issue. Expensify/Expensify Issue URL: https://github.com/Expensify/Expensify/issues/169395
Triggered auto assignment to @davidcardoza (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.
If you're coming from our Upwork posting (https://www.upwork.com/jobs/~01081fb3ff015abc6c), a heads up that we will prioritizing contributors that we have been actively working with. Thank you!
Triggered auto assignment to @tgolen (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
I've submitted the proposal on Upwork. Please do check
Proposal
- We have to wait until https://github.com/Expensify/Expensify.cash/pull/3890 is merged for some necessary functionality.
- I will create a new page /PaymentPages/TransferBalancePage.js and its routes to ROUTES.js
ROUTES.SETTINGS_TRANSFER_BALANCE = "settings/payments/transfer-balance" - on the Payments page, I will add the "Transfer Balance" menuItem as specified above. Which navigates to the new New
TransferBalancePagepage. - Borrow src/components/CurrentWalletBalance.js and use it to show the wallet balance.
- Show 2
MenuItemcomponents for instant/slow transfer mode. The selected mode will be highlighted using the border color as shown in the Mockups. - Create the "Which Account" section which will show the selected Account via
ONYSKEYS.USER_WALLET.linkedBankAccount - Clicking this menu item will navigate to another page for selecting the bank account.
- I will create a new page
ChooseTransferAccountPage.jsaccesible atROUTES.SETTINGS_PAYMENTS_CHOOSE_TRANSFER_ACCOUNT = “settings/payments/choose-transfer-Account” - The page will display a
. When a method is selected, we will navigate back to TransferBalancePage with the account type and ID params. Now we will update the selected Account based on the param passed in the which account section. - I will use the
Buttoncomponent to create the Transfer button. - Transfer button will call the API method
TransferWalletBalance()defined in the PaymentMethods action file. - I will create the
TransferWalletBalanceaction which calls the API with theTransferWalletBalancecommand. - After success, we show the
ConfirmModalwith the changed copy shown in the Mockups and setUSER_WALLET.balance = 0in Onyx. - On Confirming we close the modal and take the user back to the LHN.
- I will show a growl on the failure of the API call.
Question:
- Do we have to show the loader on the full page? But I think as per the pattern we are following app-wide, We should show the loader on the button.
- Do we need to show the growl on the failure of API call.
Thanks @parasharrajat I think your proposal is sound and we'd love to have you work on this since it's a bit more of an advanced project.
Do we have to show the loader on the full page?
I agree with you that showing the loader on the button would be best for now.
Do we need to show the growl on the failure of API call.
It's probably not totally necessary, but also easy to do, and nice to at least have an indication, so let's go ahead and add it.
One thing that wasn't really covered in this issue or the proposal is if there is any consideration that needs to be made for offline mode. Can the API requests just be queued and let the user know they are currently offline and it will be completed once they are back online? Not sure how exactly we want to handle that. cc @stitesExpensify @JmillsExpensify
if there is any consideration that needs to be made for offline mode. Can the API requests just be queued
@tgolen This topic requires some planning? We have already discussed this for IOU Request Screens. But there was no conclusion. There seems to be an issue on hold for that and @Julesssss knows better about that.
We should adopt a consistent plan for this. Either we architect these screens that support offline or we show a message and block access to it. And same should be followed across features like this.
Yeah, we are trying to get better at making the "offline consideration" part of our original planning and design process to get better at this as we move forward. If we can at least do something basic for now, I think that would be good, then once we have a more holistic UX for offline mode, we can come back and improve this.
Sure. Please let me know How do you want me to set it up. I think queueing this request won't be that hard but we may need to consider syncing the data when online to reflect actual state.
Yeah, I know we have a mechanism for queuing the requests, but I'm not sure about having the UI reflect the state when it comes back online. @marcaaron do you have any ideas or thoughts on how we approach this in other areas?
if there is any consideration that needs to be made for offline mode. Can the API requests just be queued and let the user know they are currently offline and it will be completed once they are back online? Not sure how exactly we want to handle that
If the situation we are trying to handle while we are offline is the act of transferring the balance I think a couple of options would be:
- Detect that we are offline (easy) and block the interaction (plus tell the user to wait until they are online and try again)
- Detect we are offline and say the transfer was queued and will initiate the next time they are active.
I don't think there is anything we'd need to do specifically to make 2 happen. Once the user returns online the API request to transfer the balance should be made.
I think queueing this request won't be that hard but we may need to consider syncing the data when online to reflect actual state.
What data specifically are we trying to sync? I would presume that if the API request has a completion handler attached to it that updates data in Onyx (e.g. balance, etc) then it should execute when the API request finishes. It doesn't matter if that happens right away or when we move from offline to online and a queued request completes.
Thanks, @marcaaron. Do we have to persist with that request? in that case the handler will be lost. And, Do we have to block a second request if one is in the queue?
Do we have to persist with that request? in that case the handler will be lost.
Curious to hear more opinions on this, but it sounds out of scope for this issue and/or something that would have to be discussed more. The current network layer only supports this for requests that trigger Pusher event responses. So, we could handle it similar to report comments and send the response for any persisted request back to the user via Pusher instead of handling the direct response (but that requires an internal change).
And, Do we have to block a second request if one is in the queue?
I think ideally yes, although in the case of a balance transfer probably a duplicate request would just fail since we'd already have a transfer initiated, but I don't know the specifics behind how that is working in the BE (but doesn't seem like it would be a blocker).
Perhaps in the future we will have easily "persisted requests" that are totally serializable (with generic front end handlers) and de-dupable. But I think we have not really had a reason to do it so far and I'm not sure this is the best time either?
Sounds good. I will just queue the request for a retry and block further requests until the first one is completed.
block further requests until the first one is completed
To clarify, I am not suggesting we do this. I don't think we need to worry about de-duplication or persistence right now. But would like to hear what @stitesExpensify thinks since he might know more about how this is working in the back end.
I don't think we need to block further requests, it should be fine to do it multiple times
Requesting icons and High-resolution images for mockups. Thanks.
Hey @parasharrajat - which assets do you need? I think we will be using a separate task to get all of the bank logos, cc @stitesExpensify
I think we just need the lightning bolt icon? And maybe the checkbox? I'm not sure if that's native, @parasharrajat might know better
@shawnborton yeah. Lightening blot sign and Bank icon. Also Please share the mockup in HD.