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

[HOLD for payment 2024-07-23][$250] We're requiring merchants when sending an invoice, when we shouldn't be. #44126

Closed
danielrvidal opened this issue Jun 20, 2024 · 20 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@danielrvidal
Copy link
Contributor

danielrvidal commented Jun 20, 2024

If you go to Send Invoice, and then input a user, we're requiring a merchant name. We should not be requiring the merchant. This is reproducable on all platforms for me.

image

cc @davidcardoza @cristipaval

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010f4b3b019ed717d4
  • Upwork Job ID: 1804299691171409677
  • Last Price Increase: 2024-06-28
  • Automatic offers:
    • rayane-djouah | Reviewer | 102954435
    • bernhardoj | Contributor | 102954436
Issue OwnerCurrent Issue Owner: @miljakljajic
@bernhardoj
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Merchant is required for invoice request even though it shouldn't.

What is the root cause of that problem?

This happens after this PR where we change it so the merchant is required when creating or editing the invoice.

const isMerchantRequired = (isPolicyExpenseChat || isTypeInvoice) && (!isScanRequest || isEditingSplitBill) && shouldShowMerchant;

const isMerchantRequired = ReportUtils.isReportInGroupPolicy(report) || isTypeInvoice || transaction?.participants?.some((participant) => !!participant.isPolicyExpenseChat);

Previously, the invoice was only required in edit invoice detail, but the PR above makes it consistent so creating an invoice also requires a merchant.

What changes do you think we should make in order to solve the problem?

Because we do not want to make it required, we need to "revert" that PR. We will remove the invoice type condition from both of these codes

const isMerchantRequired = (isPolicyExpenseChat || isTypeInvoice) && (!isScanRequest || isEditingSplitBill) && shouldShowMerchant;

const isMerchantRequired = ReportUtils.isReportInGroupPolicy(report) || isTypeInvoice || transaction?.participants?.some((participant) => !!participant.isPolicyExpenseChat);

isPolicyExpenseChat is false for invoice, however, ReportUtils.isReportInGroupPolicy is true even for invoice because it's part of a policy.

To fix it, we have 2 options:

  1. Replace isReportInGroupPolicy with isExpenseRequest. This condition is stricter by checking whether the request is an expense request or not which is true for workspace expense requests, but not for invoice or IOU request.

  2. Add !ReportUtils.isInvoiceRequest(report) && condition so it only could be true if it's not an invoice request.

const isMerchantRequired = !ReportUtils.isInvoiceRequest(report) && (ReportUtils.isReportInGroupPolicy(report) || transaction?.participants?.some((participant) => !!participant.isPolicyExpenseChat));

isInvoiceRequest will be a new function that is similar to isExpenseRequest

function isInvoiceRequest(report: OnyxInputOrEntry<Report>): boolean {
    if (isThread(report)) {
        const parentReportAction = ReportActionsUtils.getParentReportAction(report);
        const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`];
        return isInvoiceReport(parentReport) && !isEmptyObject(parentReportAction) && ReportActionsUtils.isTransactionThread(parentReportAction);
    }
    return false;
}

@melvin-bot melvin-bot bot added the Daily KSv2 label Jun 21, 2024
@davidcardoza
Copy link
Contributor

Damn, it looks like the other PR linked was created to make it so that a merchant name is required on invoices. Unfortunately the invoicing project team didn't catch it because it never passed through the project Slack channel or the project board.

That proposal looks good @bernhardoj

@davidcardoza davidcardoza added External Added to denote the issue can be worked on by a contributor Bug Something is broken. Auto assigns a BugZero manager. labels Jun 21, 2024
Copy link

melvin-bot bot commented Jun 21, 2024

Job added to Upwork: https://www.upwork.com/jobs/~010f4b3b019ed717d4

@melvin-bot melvin-bot bot changed the title We're requiring merchants when sending an invoice, when we shouldn't be. [$250] We're requiring merchants when sending an invoice, when we shouldn't be. Jun 21, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 21, 2024
Copy link

melvin-bot bot commented Jun 21, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-djouah (External)

Copy link

melvin-bot bot commented Jun 21, 2024

Triggered auto assignment to @miljakljajic (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@rayane-djouah
Copy link
Contributor

@bernhardoj's proposal looks good to me

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jun 23, 2024

Triggered auto assignment to @techievivek, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Jun 27, 2024

@miljakljajic, @techievivek, @rayane-djouah Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Jun 27, 2024
@rayane-djouah
Copy link
Contributor

@techievivek - Friendly bump ^^

@melvin-bot melvin-bot bot removed the Overdue label Jun 27, 2024
Copy link

melvin-bot bot commented Jun 28, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@davidcardoza
Copy link
Contributor

No update on this, until @techievivek comes back

Copy link

melvin-bot bot commented Jul 1, 2024

@miljakljajic, @techievivek, @rayane-djouah Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Jul 1, 2024
@rayane-djouah
Copy link
Contributor

@miljakljajic - Can we assign another CME as @techievivek is OOO?

@melvin-bot melvin-bot bot removed the Overdue label Jul 1, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 2, 2024
Copy link

melvin-bot bot commented Jul 2, 2024

📣 @rayane-djouah 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jul 2, 2024

📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jul 2, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @rayane-djouah

@miljakljajic
Copy link
Contributor

What will the payment date for this one be?

@bernhardoj
Copy link
Contributor

It's deployed to prod 3 days ago, so it should be 23 July

@cristipaval cristipaval added Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review labels Jul 19, 2024
@cristipaval cristipaval changed the title [$250] We're requiring merchants when sending an invoice, when we shouldn't be. [HOLD for payment 2024-07-23][$250] We're requiring merchants when sending an invoice, when we shouldn't be. Jul 19, 2024
@cristipaval
Copy link
Contributor

Not overdue

@melvin-bot melvin-bot bot removed the Overdue label Jul 19, 2024
@miljakljajic
Copy link
Contributor

Both contributors paid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: Done
Development

No branches or pull requests

7 participants