Skip to content

Update Payment flow on clicking Pay #50640

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

Merged

Conversation

rezkiy37
Copy link
Contributor

@rezkiy37 rezkiy37 commented Oct 11, 2024

Details

The PR introduces new ways for the user to pay invoices.

Fixed Issues

$ #45171
PROPOSAL: N/A

Tests

Preconditions:

  1. The policy's primary currency must be USD only.
  2. Use only real bank accounts to pay invoices successfully.
Sender
  1. Send an invoice.
Payer
  1. Open the newly received invoice.
  2. Click on the pay button.
  3. Select pay as an individual or business.
  4. Verify there are new options: bank accounts and cards (if they have been added before), "Add bank account", "Add debit or credit card" (individual) or "Add corporate card" (business).
  5. Click on the add bank button.
  6. Verify that the app has redirected you to Plaid.
  7. Go back.
  8. Click on the "Add debit or credit card" (individual) or "Add corporate card" (business) button.
  9. Verify the "Hmm... it's not here" page has been shown because it is disabled temporarily. However, the URL in the browser is pay/new/add-debit-card.
  10. Click on a bank account or card to pay.
  11. Verify it has been paid successfully.
Sender
  1. Verify that the invoice has been paid.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests (payer only).

QA Steps

Same as Tests. This needs real bank accounts and payments. Ping @cristipaval, he's more than willing to pay 0.1 USD to test and ship this feature 😄

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android.mp4
Android: mWeb Chrome
Android.Chrome.mp4
iOS: Native
IOS.mp4
iOS: mWeb Safari
IOS.Safari.mp4
MacOS: Chrome / Safari
Chrome.mp4
MacOS: Desktop
Desktop.mp4

@cristipaval cristipaval self-requested a review November 18, 2024 23:04
@cristipaval
Copy link
Contributor

cristipaval commented Nov 18, 2024

Hey @rezkiy37, could you please update this PR with the main so I can start testing the backend changes locally? 🙏

@rezkiy37
Copy link
Contributor Author

@cristipaval, done 🙂

…ortHeader and ReportPreview components. Update IOU.ts to align with new parameter structure for improved readability and maintainability.
@rezkiy37
Copy link
Contributor Author

Strange bug When I press Add bank account button I redirect to invoices screen that is not related with the current invoice

But this bug is reproduced only on one account

Here is my onyx data

onyx-state (1).txt

2025-03-16.21.51.39.mov

@ZhenjaHorbach I don't see the bug on the video because:

  1. You have made a B2B (policy to policy) invoice room.
  2. The screen is related to the current invoice because "Test 17" is a receiver policy and the app redirects you there. You can manage bank accounts in policy settings.
Screenshot

Screenshot 2025-03-17 at 15 19 12

@rezkiy37
Copy link
Contributor Author

And we have some visual bugs when we open modal with payment methods But I think it's most likely related to dev build

2025-03-17.08.46.32.mov
@cristipaval Could you please trigger adhoc builds to recheck it ?

It is unrelated to the PR because this blinking issue was known before and associated with the SettlementButton dropdown.

@rezkiy37 rezkiy37 requested a review from ZhenjaHorbach March 17, 2025 14:23
@ZhenjaHorbach
Copy link
Contributor

@ZhenjaHorbach I don't see the bug on the video because:

Oh
Got it
In that case it's good that it's not a bug 😅

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Mar 17, 2025

Strange
No adhoc builds have appeared in 2 hours

Copy link
Contributor

🚧 @cristipaval has triggered a test app build. You can view the workflow run here.

@cristipaval
Copy link
Contributor

Oh, my bad; I should have done one more manual step to trigger the workflows. Just did it, sorry. It may take around 1 hour.

Copy link
Contributor

🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪

Android 🤖 iOS 🍎
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/50640/index.html ❌ FAILED ❌
Android The QR code can't be generated, because the iOS build failed
Android Hybrid 🤖🔄 iOS Hybrid 🍎🔄
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/50640-hybrid/index.html https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/50640-hybrid/index.html
Android Hybrid iOS Hybrid
Desktop 💻 Web 🕸️
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/50640/NewExpensify.dmg https://50640.pr-testing.expensify.com
Desktop Web

👀 View the workflow run that generated this build 👀

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Mar 17, 2025

Crap
In adhoc visual bugs are also reproduced

I understand that this is a issue with implementation of the modal
But technically this bug is due to new elements in the modal list

But I think we can fix it in a separate issue
Since it doesn't affect the functionality

@cristipaval

What do you think ?

2025-03-17.23.30.15.mov

@rezkiy37
Copy link
Contributor Author

But I think we can fix it in a separate issue
Since it doesn't affect the functionality

I definitely agree with it and I can take it into work.

@rezkiy37
Copy link
Contributor Author

I've synced it up.

@ZhenjaHorbach
Copy link
Contributor

I've synced it up.
Thanks !

@cristipaval
Waiting for your decision !

@cristipaval
Copy link
Contributor

But I think we can fix it in a separate issue Since it doesn't affect the functionality

yeah this is a very minor visual issue, it's fine to fix it in a follow-up to not keep extending the scope of this PR

@ZhenjaHorbach
Copy link
Contributor

Nice
Thanks !

In that case I have no more questions
LGTM !

Copy link
Contributor

@cristipaval cristipaval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Thank you @rezkiy37 for pushing this for a long time.

I tested and can confirm that the payments work with real bank accounts.

@cristipaval cristipaval merged commit e6ed375 into Expensify:main Mar 19, 2025
17 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@rezkiy37
Copy link
Contributor Author

rezkiy37 commented Mar 19, 2025

Crap In adhoc visual bugs are also reproduced

I understand that this is a issue with implementation of the modal But technically this bug is due to new elements in the modal list

But I think we can fix it in a separate issue Since it doesn't affect the functionality

@cristipaval

What do you think ?

2025-03-17.23.30.15.mov

I've created a follow-up issue - #58705.

cc @cristipaval @ZhenjaHorbach

@ZhenjaHorbach
Copy link
Contributor

I've created a follow-up issue - #58705.

cc @cristipaval @ZhenjaHorbach

Nice
Thanks !
If needed I can be reviewer here

Copy link
Contributor

🚀 Deployed to staging by https://github.com/cristipaval in version: 9.1.16-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

@cristipaval
Copy link
Contributor

QA passed in staging

Screen.Recording.2025-03-21.at.10.53.40.mov

Copy link
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.1.16-4 🚀

platform result
🤖 android 🤖 true ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 failure ❌

text: formattedPaymentMethod?.title ?? '',
description: formattedPaymentMethod?.description ?? '',
icon: formattedPaymentMethod?.icon,
onSelected: () => onPress(CONST.IOU.PAYMENT_TYPE.EXPENSIFY, payAsBusiness, formattedPaymentMethod.methodID, formattedPaymentMethod.accountType),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to pass iconStyles, iconHeight, and iconWidth here, otherwise the bank icons are too small. More details: #60579 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
InternalQA This pull request required internal QA Ready To Build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants