App icon indicating copy to clipboard operation
App copied to clipboard

Expensify Card - Policy ID is displayed under the card's name for member

Open IuliiaHerets opened this issue 1 year ago β€’ 4 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.30-9 Reproducible in staging?: Y Reproducible in production?: Y Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • Admin and member are in the same workspace.
  1. Go to staging.new.expensify.com
  2. [Admin] Go to workspace settings > Expensify Card.
  3. [Admin] Click Issue card.
  4. [Admin] Issue a card to the member.
  5. [Member] Go to Account settings > Wallet.

Expected Result:

Policy ID will not be displayed under the card's name for member.

Actual Result:

Policy ID is displayed under the card's name for member.

Workaround:

Unknown

Platforms:

  • [x] Android: Native
  • [x] Android: mWeb Chrome
  • [x] iOS: Native
  • [x] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/9367e3b2-56a1-4426-b733-8f8d7fe01369

View all open jobs on GitHub

IuliiaHerets avatar Sep 06 '24 20:09 IuliiaHerets

Triggered auto assignment to @RachCHopkins (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.

melvin-bot[bot] avatar Sep 06 '24 20:09 melvin-bot[bot]

@RachCHopkins FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

IuliiaHerets avatar Sep 06 '24 20:09 IuliiaHerets

Proposal

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

  • Policy ID is displayed under the card's name for member.

What is the root cause of that problem?

  • When displaying assigned card, we always display its domain name regardless the domain name contain the policyID or not:

https://github.com/Expensify/App/blob/a9dc59624ac6ad9896ef7c4fce46a18d696213bd/src/pages/settings/Wallet/PaymentMethodList.tsx#L248

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

  • We can use:
                        description: /policy([a-zA-Z0-9]+)\.exfy/.test(card.domainName) ? '' : card.domainName,

or

                        description: /policy([a-zA-Z0-9]+)\.exfy/.test(card.domainName) ? getDescriptionForPolicyDomain(card.domainName) : card.domainName,
  • In above, I introduce a new function getDescriptionForPolicyDomain which will return the policy name based on card domain:
    const getDescriptionForPolicyDomain = (domainName: string) => {
        const match = domainName.match(/policy([a-zA-Z0-9]+)\.exfy/);
        const policyID = match ? match[1] : null;
        const policy = getPolicy(policyID)
        return policy?.name // Can be improved later
    };

What alternative solutions did you explore? (Optional)

dominictb avatar Sep 07 '24 01:09 dominictb

Proposal

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

Policy ID is displayed under the card's name for member

What is the root cause of that problem?

The PolicyID is included in the domainName for Expensify Cards. As a result, when displaying the domain name, the PolicyID will also be shown.

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

Checking if this is the Expensify Card, we will customize the domain name to prevent the policyID from being displayed.

  • To identify an Expensify Card, we can use the isExpensifyCard function or create a new function to identify it using the domainName field

https://github.com/Expensify/App/blob/7ebfaa0daaa43a20083250e0f263964ed5b647b2/src/libs/CardUtils.ts#L40

  • We need to discuss with other stuffs which domain name to display in the subtitle of the Expensify Card, rather than showing the domain name from the backend. We will then update it to display the new subtitle.
1

What alternative solutions did you explore? (Optional)

cretadn22 avatar Sep 07 '24 18:09 cretadn22

What is the expectation here? If the card is issued from the workspace, I'd expect the workspace name, not just the domain name. I will check on this.

RachCHopkins avatar Sep 09 '24 07:09 RachCHopkins

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

melvin-bot[bot] avatar Sep 09 '24 08:09 melvin-bot[bot]

Current assignees @allgandalf and @DylanDylann are eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] avatar Sep 09 '24 08:09 melvin-bot[bot]

πŸ“£ @allgandalf πŸŽ‰ 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

melvin-bot[bot] avatar Sep 09 '24 08:09 melvin-bot[bot]

πŸ“£ @DylanDylann πŸŽ‰ 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

melvin-bot[bot] avatar Sep 09 '24 08:09 melvin-bot[bot]

πŸ“£ @dominictb πŸŽ‰ 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[bot] avatar Sep 09 '24 08:09 melvin-bot[bot]

@dominictb yes, let's show the policy name there if the domain is workspace feed. Your proposal makes sense, can you create a PR? What is your ETA? Thanks!

mountiny avatar Sep 09 '24 08:09 mountiny

With the automation borked, and this looking like it was on Prod a week ago, can you do the checklist please @DylanDylann?

The following checklist (instructions) will need to be completed before the issue can be closed:

  • [ ] [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR:
  • [ ] [@DylanDylann] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [ ] [@DylanDylann] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [ ] [@DylanDylann] Determine if we should create a regression test for this bug.
  • [ ] [@DylanDylann] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [ ] [@RachCHopkins] Link the GH issue for creating/updating the regression test once above steps have been agreed upon

RachCHopkins avatar Sep 24 '24 06:09 RachCHopkins

@RachCHopkins This feature is still behind beta, I don't think we need to checklist here

DylanDylann avatar Sep 24 '24 08:09 DylanDylann

I agree we will include tests in the test rail as we officially release this feature

mountiny avatar Sep 24 '24 14:09 mountiny

Is this ready for me to pay people? I think that's the part I'm not understanding.

RachCHopkins avatar Sep 25 '24 00:09 RachCHopkins

@RachCHopkins Yes. Let's pay $250 to @dominictb

cc @mountiny

DylanDylann avatar Sep 25 '24 01:09 DylanDylann

What about you @DylanDylann? Do you also need to be paid?

RachCHopkins avatar Sep 25 '24 06:09 RachCHopkins

No need payment to me. I will get paid on the project

DylanDylann avatar Sep 25 '24 06:09 DylanDylann

Sounds good to me

mountiny avatar Sep 25 '24 09:09 mountiny

Contributor has been paid, the contract has been completed, and the Upwork post has been closed.

RachCHopkins avatar Sep 26 '24 05:09 RachCHopkins