Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@puneetlath Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
This comment has been minimized.
This comment has been minimized.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
…ng-bills # Conflicts: # src/components/ReportActionItem/MoneyRequestReportPreview/PayActionButton.tsx
…sic payment options
…, and restore the state when canceling fails
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
🚧 cead22 has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
🚧 trjExpensify has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
🦜 Polyglot Parrot! 🦜Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues: The diff is too large to include in this comment (138KB), so I've created a gist for you: 📋 View the translation diff here 📋 Note You can apply these changes to your branch by copying the patch to your clipboard, then running |
|
🚧 cead22 has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
mananjadhav
left a comment
There was a problem hiding this comment.
Left review comments.
| function isExpenseReport(reportOrID: OnyxInputOrEntry<Report> | string): boolean { | ||
| const report = typeof reportOrID === 'string' ? (getReport(reportOrID, deprecatedAllReports) ?? null) : reportOrID; | ||
| return report?.type === CONST.REPORT.TYPE.EXPENSE; | ||
| return report?.type === CONST.REPORT.TYPE.EXPENSE || report?.type === CONST.REPORT.TYPE.BILL; |
There was a problem hiding this comment.
**question: ** isExpenseReport is now true for bills, and the More menu has no bill exception except Reject, so a submitted bill can show Retract, Add expense, Delete, and Change approver, and a Closed bill can show Reopen.
| * An ACH payment debits the payer's account in USD, so only open USD accounts that allow debits can pay. The | ||
| * Expensify Card settlement account only settles card spend. | ||
| */ | ||
| function payableBankAccountsSelector(bankAccounts: OnyxEntry<BankAccountList>): BankAccountList { |
There was a problem hiding this comment.
question: payableBankAccountsSelector does not require accountData.type === BUSINESS, unlike getBusinessBankAccountOptions, so a personal USD account with allowDebit is offered for ACH and the policy withdrawal account is not listed first.
|
|
||
| if (isBillReport(moneyRequestReport) || isInvoiceReport) { | ||
| return ( | ||
| <BillPaymentButton |
There was a problem hiding this comment.
Every invoice is sent through BillPaymentButton (same switch in PayActionButton.tsx:173 and PayActionCell.tsx:227), so a normal invoice room no longer calls PayInvoice and loses wallet and personal-bank payment. The PR text says received invoices should use ReimburseReport / MarkReimbursed — is dropping PayInvoice for those rooms intended?
| <ActionableItemButtons layout="horizontal"> | ||
| <Button | ||
| variant={CONST.BUTTON_VARIANT.SUCCESS} | ||
| onPress={() => openPersonalBankAccountSetupView({exitReportID: targetReport?.reportID, isUserValidated})} |
There was a problem hiding this comment.
On the invoice, this button still calls openPersonalBankAccountSetupView, which adds a personal deposit account, while the new queued-payment copy no longer says "personal."
| const isWaitingOnSenderBankAccount = moneyRequestReport?.nextStep?.messageKey === CONST.NEXT_STEP.MESSAGE_KEY.WAITING_FOR_SUBMITTER_ACCOUNT; | ||
| const isInvoiceReport = isInvoiceReportUtil(moneyRequestReport); | ||
| const shouldShowNextStep = isGroupPolicy(policy) && !isInvoiceReport && !shouldShowStatusBar; | ||
| const shouldShowNextStep = (isInvoiceReport ? isWaitingOnSenderBankAccount : isGroupPolicy(policy)) && !shouldShowStatusBar; |
There was a problem hiding this comment.
A bill's next step still requires isGroupPolicy(policy), so a viewer who has the report next step but no policy record sees the policy name in the header and no "approve the bill" message.
| statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED, | ||
| }; | ||
|
|
||
| it('moves a bill from approval to payment only after final approval', () => { |
There was a problem hiding this comment.
moves a bill from approval to payment, includes received standalone invoices, and keeps business invoices visible, plus BillPayAttentionTest.ts:50, have no Given / When / Then comments. tests/README.md requires those on every test.
| expect(startApprovedAnimation).toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it('does not start the approved animation for a bill', async () => { |
There was a problem hiding this comment.
approveMoneyRequest is mocked and the bill has no chatReportID. The test cannot see a failed approval merge into report_undefined, or a partial approve that skips the hold-report split because there is no chat.
| mockFetch?.resume?.(); | ||
| }); | ||
|
|
||
| it('sends a cancellation request for a bill without a chat report', async () => { |
There was a problem hiding this comment.
Cancel is covered for an admin on someone else's bill. It never checks Mark as paid by the owner when that owner is not the reimburser, an admin, or a payments admin, which is the case where Cancel disappears.
|
|
||
| it('calls payInvoice with the chatReport supplied as a prop (the flat `type:invoice columns:...` transaction row now resolves and passes it)', async () => { | ||
| // Given an invoice report row whose invoice chat is resolved and passed down as a prop | ||
| it('offers the bill payment flow for an invoice with a parent room', () => { |
There was a problem hiding this comment.
Both the invoice-with-a-room case and the no-room case expect BillPaymentButton and assert payInvoice is not called. That freezes the removal of PayInvoice, wallet, and personal-bank pay for every invoice. There is no bill row in this file.
| expect(result).toEqual(linkedCreateAction.childReportID); | ||
| }); | ||
|
|
||
| it('should return the childReportID for a bill with one expense', () => { |
There was a problem hiding this comment.
The one-expense test stops at the thread id. Nothing asserts that an approver or admin can edit category, tag, or billable on that bill expense.
|
@cead22 Quick bump on the comments. |
|
https://github.com/Expensify/Auth/pull/26177 is on prod, so I think the hold from the title can be removed unless it's outdated. |
|
@cead22 Is this PR not needed anymore? |
|
Correct. I forgot you reviewed it so let me know what I need to do to compensate you for it |

Explanation of Change
This PR lets users open, approve and pay existing bills in New Expensify. Bills come from Expensify Classic or from invoices that vendors email to a domain's bill pay address. Before this PR, New Expensify showed bills as an unsupported report type.
RejectExpenseReportreturns "400 Bills are not supported". Approvers send a bill back with Unapprove instead.BillPaymentButtonpays bills and received invoices. The button shows the amount, for example Pay $125.00. The menu lists each of the payer's business bank accounts with the bank's logo and last four digits, like the Pay menu on expense reports. Bills are paid withPayMoneyRequest, by ACH from the chosen account or with Mark as paid. This needs Auth #26177. Received invoices still pay by ACH withReimburseReportand are marked as paid withMarkReimbursed. When the payer has no business bank account, the menu offers Pay with business account, which starts adding one. These work without a parent chat, because bills have none. ACH payments are only in USD, so bills in other currencies only offer Mark as paid. Auth'sReport::getBillPayFiltertreats every invoice the user receives without a linked bill as Bill Pay, so received invoices use the same button.BillPayUtilsholds the shared rules for who can approve and pay a bill. Pay shows on approved bills when payments are enabled on the policy. As in Classic, the bill's receiver, the policy's reimburser, and the policy's admins and payments admins can pay.PayMoneyRequestadds an IOU PAY action to the bill, and the app shows it right away. Invoices get no IOU PAY action, either whenReimburseReportandMarkReimbursedpay them or when their linked bill is paid, so invoices show their payment action instead.isAwaitingActionFromCurrentUsersays it waits on the vendor, and names the payer when the vendor's App has no name for them. These parts need Auth PRs stacked on [TS migration] Migrate 'shouldDelayFocus' lib to TypeScript #26177: the waiting message on the invoice needs Auth #26218, the vendor's name on the bill needs Auth #26219, and the green dot needs Auth #26220. Without them, App shows no message, "Hidden" or no green dot, and nothing breaks.policyNamewhen App has no policy record.Notes for the code review:
useBillPayCountsanduseCanCreateBillcome in later PRs of this stack.actions/BillPay.tsexportspayBillas its default export, because it is the only export. The Create bill PR addscreateBilland switches to named exports.BillPaymentButtoninterface and its prop comment unchanged. The button uses the currentButtonWithDropdownMenuinterface to match expense report payments. Refactoring that interface falls outside this header fix.Fixed Issues
For https://github.com/Expensify/Expensify/issues/684654
PROPOSAL:
Reported in:
Tests
receiver.com@expensify.cash. That creates a submitted bill for the domain./r/<billReportID>.Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari