Skip to content
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

[Violations - Pending Receipts] Display the rter Violation with the Pending Pattern #40354

Conversation

smelaa
Copy link
Contributor

@smelaa smelaa commented Apr 17, 2024

Details

Fixed Issues

$#39533
PROPOSAL:

Tests

  1. Create at least 2 Money Request on a single chat. Money Requests should aggregate to a single report preview as below:
Screenshot 2024-04-29 at 14 56 15
  1. Create a single Money Request on a different chat. It should display as preview of single request and not aggregate like in point 1.

  2. Create a Money Request in a new workspace (so called One Expense Chat, for more context check Add One Transaction Report View #36934).

  3. Find transactionIDs of all created requests by using console.log to be able to mock the data.

  4. Mock the data in ReportActionList.tsx similarly to how it was done before this commit: 03fb6ee

  5. Check whether

Receipt pending match with credit card. Marks as cash to ignore and request payment.

text and icon is displayed in Money Request Preview and in headers. For reference check video -> MacOS: Chrome / Safari

  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

Same as tests

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
    • 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

For more context on how to navigate in the app to get to screens from screenshots check MacOS: Chrome section.

Android: Native Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20
Android: mWeb Chrome Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20
iOS: Native Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20
iOS: mWeb Safari Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20 Screenshot 2024-05-07 at 10 33 20
MacOS: Chrome / Safari
Screen.Recording.2024-05-07.at.10.31.16.mov
  1. Single MoneyRequest with RTER violation report

ReportPreview
Screenshot 2024-05-07 at 10 32 55

MoneyReportHeader
Screenshot 2024-05-07 at 10 33 20

  1. Report with multiple MoneyRequests - all with RTER violation

MoneyReportHeader & MoneyRequestAction (MoneyReportHeader only if all the transactions have RTER violation)
Screenshot 2024-05-07 at 10 33 41

MoneyRequestHeader
Screenshot 2024-05-07 at 10 33 51

  1. "One-Expense" Chat
Screenshot 2024-05-07 at 10 34 26 Screenshot 2024-05-07 at 10 37 52
MacOS: Desktop Screenshot 2024-05-07 at 11 31 32 Screenshot 2024-05-07 at 11 31 47 Screenshot 2024-05-07 at 11 32 01 Screenshot 2024-05-07 at 11 32 10 Screenshot 2024-05-07 at 11 32 25 Screenshot 2024-05-07 at 11 32 33

src/components/MoneyReportHeader.tsx Outdated Show resolved Hide resolved
src/components/MoneyReportHeader.tsx Outdated Show resolved Hide resolved
src/components/MoneyRequestHeader.tsx Outdated Show resolved Hide resolved
src/components/MoneyRequestHeader.tsx Outdated Show resolved Hide resolved
src/components/MoneyRequestHeader.tsx Outdated Show resolved Hide resolved
src/libs/TransactionUtils.ts Outdated Show resolved Hide resolved
src/libs/TransactionUtils.ts Outdated Show resolved Hide resolved
src/pages/home/report/ReportActionsList.tsx Outdated Show resolved Hide resolved
@smelaa smelaa requested a review from BrtqKr May 8, 2024 08:37
@smelaa smelaa requested a review from ishpaul777 May 15, 2024 11:47
@smelaa
Copy link
Contributor Author

smelaa commented May 15, 2024

@ishpaul777 the PR is ready for another round of feedback

@smelaa smelaa requested a review from ishpaul777 May 15, 2024 15:42
@ishpaul777
Copy link
Contributor

Something seems off with API, i am not able to sign in

@ishpaul777
Copy link
Contributor

@smelaa I see two statusbar for workspace expense

Screenshot 2024-05-15 at 9 49 26 PM

@smelaa
Copy link
Contributor Author

smelaa commented May 15, 2024

@ishpaul777 it should be fixed now. I don't know how often on real life data (if at all) both conditions to show next step banner and rter violation information are satisfied but I assumed rter violation has higher priority than next step. Therefore now if there is pending rter violation, next step banner is not shown.

@ishpaul777
Copy link
Contributor

I assumed rter violation has higher priority than next step. Therefore now if there is pending rter violation, next step banner is not shown.

@yuwenmemon Can you please confirm if the assumption is correct

@yuwenmemon
Copy link
Contributor

yuwenmemon commented May 15, 2024

I assumed rter violation has higher priority than next step. Therefore now if there is pending rter violation, next step banner is not shown.

@yuwenmemon Can you please confirm if the assumption is correct

Yep, that's correct! See https://docs.google.com/document/d/1zJqlTe_RajuBtfQYvbMx8PpXgA9CEnUGVyuqZihQ-ok/edit#heading=h.t853jrc7ig0n

@ishpaul777
Copy link
Contributor

ishpaul777 commented May 15, 2024

Looks good, checklist done, just one unresolved comment #40354 (comment)

@melvin-bot melvin-bot bot requested a review from grgia May 15, 2024 18:57
@yuwenmemon yuwenmemon merged commit 3967320 into Expensify:main May 15, 2024
16 of 18 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.

@Pujan92
Copy link
Contributor

Pujan92 commented May 16, 2024

@smelaa Seems this PR causes a crash sometimes after submitting the expense. I think we need to use optional chaining for accessing the transactionID.

const showRTERViolationMessage =
numberOfRequests === 1 && TransactionUtils.hasPendingUI(allTransactions[0], TransactionUtils.getTransactionViolations(allTransactions[0].transactionID, transactionViolations));

@ishpaul777
Copy link
Contributor

Hey @smelaa Are you available to create PR to fix above ^

@smelaa
Copy link
Contributor Author

smelaa commented May 21, 2024

@ishpaul777 I'm on it!

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/yuwenmemon in version: 1.4.75-0 🚀

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

@kbecciv
Copy link

kbecciv commented May 23, 2024

@smelaa @yuwenmemon @Pujan92 Can someone clarify the steps 4 and 5?

@ishpaul777
Copy link
Contributor

ishpaul777 commented May 24, 2024

  1. Create 3 Money Request on a single chat (1: 1). - (A, B, C)
  2. Create only 1 Money Request on a single chat (1: 1) - (D)
  3. Create a Money Request in a new workspace. - (E)
  4. copy all transaction id of above requests ^, click on any field to edit copy transaction id from url and note it down
Screenshot 2024-05-13 at 6 01 25 PM
  1. execute below code in web console:
// Transaction A
Onyx.merge(`transactions_(transaction id copied for A)`, {cardID: 1, merchant: 'Transaction A'});

Onyx.merge(`transactionViolations_(transaction id copied for A)`, [{type: 'test', name: 'rter', data: {pendingPattern: true}}]);

// Transaction B
Onyx.merge(`transactions_(transaction id copied for B)`, {cardID: 1, merchant: 'Transaction B'});

Onyx.merge(`transactionViolations_(transaction id copied for B)`, [{type: 'test', name: 'rter', data: {pendingPattern: true}}]);

// Transaction C
Onyx.merge(`transactions_(transaction id copied for C)`, {cardID: 1, merchant: 'Transaction C'});

Onyx.merge(`transactionViolations_(transaction id copied for C)`, [{type: 'test', name: 'rter', data: {pendingPattern: true}}]);

// Transaction D
Onyx.merge(`transactions_(transaction id copied for D)`, {cardID: 1, merchant: 'Transaction D'});

Onyx.merge(`transactionViolations_(transaction id copied for D)`, [{type: 'test', name: 'rter', data: {pendingPattern: true}}]);

// Transaction E
Onyx.merge(`transactions_(transaction id copied for E)`, {cardID: 1, merchant: 'Transaction E'});

Onyx.merge(`transactionViolations_(transaction id copied for E)`, [{type: 'test', name: 'rter', data: {pendingPattern: true}}]);
  1. Check whether

Receipt pending match with credit card. Marks as cash to ignore and request payment.

text and icon is displayed in Money Request Preview and in headers. For reference check video -> MacOS: Chrome / Safari

@ishpaul777
Copy link
Contributor

@kbecciv Above are steps to QA this PR.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.75-1 🚀

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants