Skip to content

[Due for payment 2025-04-28] Update Company Cards page to potentially show domain feeds #59837

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

Closed
puneetlath opened this issue Apr 8, 2025 · 47 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 NewFeature Something to build that is a new item. Reviewing Has a PR in review

Comments

@puneetlath
Copy link
Contributor

puneetlath commented Apr 8, 2025

Part of the Cross compatible Corporate Cards project

Main issue: https://github.com/Expensify/Expensify/issues/467915
Doc section: https://docs.google.com/document/d/1KHrQgvdZWvCwUkptjjW_oqnl0umyVNiPe7KIHCD1pBA/edit?tab=t.0#heading=h.hn90zqqqm7w9

Feature Description

Let's update the Third Party Company Cards page of the workspace editor to display domain feeds as described in the doc here.

To do this we will need to:

  1. Support showing domain third party card feeds when the current workspace is set as the primary policy for the feed. We will know this is the case if the Expensify Card settings in Onyx have the current workspace set as the preferredPolicy like below on the domain_member nvp data.
  2. We should show only the domain feed if there is no workspace feed set up
  3. We should show the feed selector, if there is a workspace feed and some amount of domain feeds. Or if there are multiple domain feeds
  4. Everything else should work just like it currently does

Onyx shape:

{
	"onyxData": [
		{
			"key": "sharedNVP_private_domain_member_19527211",
			"onyxMethod": "set",
			"value": {
				"settings": {
					"discover.com": {
						"asrEnabled": false,
						"forceReimbursable": "force_no",
						"liabilityType": "corporate",
						"preferredPolicy": "8548D13C46AEFD4B",
						"reportTitleFormat": "",
						"shouldApplyCashbackToBill": true,
						"statementPeriodEndDay": 1,
						"uploadLayoutSettings": []
					}
				}
			}
		}
	]
}

Manual Test Steps

  1. Create an account that is an admin on domainA and policyB
  2. Add an third party domain feed to domainA and set policyB as the preferred policy
  3. Open policyB in NewDot and go to the Company Cards page
  4. Make sure the feed shows up and you can assign cards, edit the settings, etc
  5. Create a new domainC same account as admin on the domain
  6. Add an third party domain feed to domainC and set policyB as the preferred policy
  7. Open policyB in NewDot and go to the Company Cards page
  8. Make sure both feeds shows up and you can assign cards, edit the settings, etc
  9. Add a workspace third party feed to policyB
  10. Open policyB in NewDot and go to the Company Cards page
  11. Make sure all three feeds shows up and you can assign cards, edit the settings, etc

Automated Tests

tbd

Issue OwnerCurrent Issue Owner: @maddylewis
@puneetlath puneetlath added NewFeature Something to build that is a new item. Weekly KSv2 labels Apr 8, 2025
Copy link

melvin-bot bot commented Apr 8, 2025

Triggered auto assignment to @maddylewis (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

@DylanDylann
Copy link
Contributor

@puneetlath could I take over this task as C+ reviewer? I already worked on the workspace feed and company feed before

@puneetlath
Copy link
Contributor Author

Sure, sounds good.

@VickyStash
Copy link
Contributor

Hi, I'm Viktoryia from Callstack - expert contributor group - and I would like to work on this issue.

@VickyStash
Copy link
Contributor

UPD:
Working in progress on this one. I'm waiting for the BE to be deployed (it should be today) so I can test updates over the real data to make sure everything works as expected.

@VickyStash
Copy link
Contributor

UPD:
Today I needed to switch on some deploy blockers.
Also, it looks like the OpenPolicyCompanyCardsPage API updates isn't live yet ⌛

@VickyStash
Copy link
Contributor

Right now even without any changes on the FE side, I can see the Amex feed added to the domain in the OldDot in the NewDot.

Image

Though I have some problems with cards display testing because of the issue I've reported here: https://callstack-hq.slack.com/archives/C07NMDKEFMH/p1744297195629639?thread_ts=1743507271.676259&cid=C07NMDKEFMH

Overall, it feels like it should work as is. Just a couple of questions from my side to confirm:

  1. Does the selector look as expected to you? For example, it says Direct feed, is it expected?
  2. Can someone with several domain third-party bank cards in the OD check how the ND app handles its display right now (Company cards section)? Specifically, how different bank cards are displayed. I mean I see that Amex displays okay as a feed, but it would be great to check Chase, Wells Fargo, etc.
  3. Right now, the Company Cards menu item displays in the workspace menu only if the Company Cards feature is on. I guess there can be the case when users have domain cards, but they didn't turn on this feature toggle, so they won't see the Company Cards page. Should we do anything about it?

Image

cc @puneetlath @mountiny

@mountiny
Copy link
Contributor

For example, it says Direct feed, is it expected?

Yeah that is all same between workspace and domain feed

Specifically, how different bank cards are displayed. I mean I see that Amex displays okay as a feed, but it would be great to check Chase, Wells Fargo, etc.

Maybe we can ask Joe to test that on the adhoc?

I guess there can be the case when users have domain cards, but they didn't turn on this feature toggle, so they won't see the Company Cards page. Should we do anything about it?

Puneet has a backend PR that should solve this concern ✅

@VickyStash
Copy link
Contributor

Maybe we can ask Joe to test that on the ad-hoc?

I think Joe can try to test it even on the staging/prod.

Hey @joekaufmanexpensify, could you please try to test the next flow:

  1. In the OldDot have a domain with different third party cards imported (Chase, Wells Fargo, Amex). It should be associated with the current primary policy.
  2. Open NewDot (https://new.expensify.com/) with the same account. Go to the primary policy.
  3. Turn on the Company cards feature for the policy if it wasn't turned on before.
  4. Take a look at how domain feeds/cards added in the OD are displayed in the Company cards section inside ND.

@joekaufmanexpensify
Copy link
Contributor

I don't see them in the Company cards section of the default policy of the account in NewDot after adding the card feed in domains in OldDot.

2025-04-11_17-27-46.mp4

@joekaufmanexpensify
Copy link
Contributor

LMK if I can help test further!

@VickyStash
Copy link
Contributor

LMK if I can help test further!

Could you please add me as an admin to that Joeyjellydonuts's workspace 2?

@VickyStash
Copy link
Contributor

Okay, thanks to Joe I have access to his workspace, and that's what I have:

  1. OpenPolicyCompanyCardsPage returns two sharedNVP_private_domain_member_ keys. As I understand I'll need to aggregate its values based on preferredPolicy field to show necessary feeds on the Company cards page. So it looks like expected.
Onyx data
[
  {
    "key": "sharedNVP_private_domain_member_19475968",
    "onyxMethod": "set",
    "value": {
      "settings": {
        "companyCardNicknames": {
          "oauth.americanexpressfdx.com 1001": ""
        },
        "companyCards": {
          "Expensify Card": {
            "asrEnabled": false,
            "centralTravelBilling": false,
            "expensifyCardIntegrationPolicyID": null,
            "expensifyCardIntegrationWithdrawalID": null,
            "expensifyCardMonthlySettlementDate": 0,
            "expensifyCardSettlementBankAccount": {
              "bankAccountID": 7317920,
              "maskedNumber": "111122XXXXXX1111",
              "ownerEmail": "[email protected]",
              "state": "OPEN"
            },
            "expensifyCardSettlementFrequency": "daily",
            "expensifyCardUseContinuousReconciliation": true,
            "expensifyCardisIsMonthlySettlementAllowed": false,
            "forceReimbursable": "force_no",
            "liabilityType": "corporate",
            "policyWithdrawalIDMap": [],
            "preferredPolicy": "0A7819E7DC0A12B2",
            "reportTitleFormat": "",
            "shouldApplyCashbackToBill": true,
            "statementPeriodEndDay": 1,
            "uploadLayoutSettings": []
          },
          "oauth.americanexpressfdx.com 1001": {
            "asrEnabled": false,
            "credentials": "v12:...",
            "forceReimbursable": "force_no",
            "liabilityType": "corporate",
            "preferredPolicy": "",
            "reportTitleFormat": "",
            "shouldApplyCashbackToBill": true,
            "statementPeriodEndDay": 1,
            "uploadLayoutSettings": []
          },
          "oauth.wellsfargo.com": {
            "asrEnabled": false,
            "credentials": "v12:...",
            "forceReimbursable": "force_no",
            "liabilityType": "corporate",
            "preferredPolicy": "125C04B76DCDE859",
            "reportTitleFormat": "",
            "shouldApplyCashbackToBill": true,
            "statementPeriodEndDay": 1,
            "uploadLayoutSettings": []
          }
        },
        "oAuthAccountDetails": {
          "oauth.wellsfargo.com": {
            "accountList": [
              "BILT WORLD ELITE MASTERCARD 2602"
            ],
            "credentials": "4L...",
            "expiration": 1744407656
          }
        }
      }
    }
  },
  {
    "key": "sharedNVP_private_domain_member_19583530",
    "onyxMethod": "set",
    "value": {
      "settings": {
        "companyCards": {
          "oauth.americanexpressfdx.com 1001": {
            "asrEnabled": false,
            "forceReimbursable": "force_no",
            "liabilityType": "corporate",
            "preferredPolicy": "125C04B76DCDE859",
            "reportTitleFormat": "",
            "shouldApplyCashbackToBill": true,
            "statementPeriodEndDay": 1,
            "uploadLayoutSettings": []
          }
        },
        "oAuthAccountDetails": {
          "oauth.americanexpressfdx.com 1001": {
            "accountList": [
              "Business Green Rewards Card - 1001",
              "Business Gold Card - 1006"
            ],
            "credentials": "kL...",
            "expiration": 1744645054
          }
        }
      }
    }
  }
]
  1. BUT OpenPolicyCompanyCardsFeed returns empty object, though there is a wells fargo card assigned.

Image

Image

The params I pass: {policyID: '125C04B76DCDE859', feed: 'oauth.wellsfargo.com'}

@puneetlath @mountiny Do I miss anything or is it something BE related?

@puneetlath
Copy link
Contributor Author

Ah interesting. Ok I'll look into that OpenPolicyCompanyCardsFeed. I likely need to update it.

@puneetlath
Copy link
Contributor Author

@VickyStash do you have a WIP PR that I can test this with? I'd like to see the payload for the OpenPolicyCompanyCardsFeed API request in the case of the domain feed.

@VickyStash
Copy link
Contributor

@puneetlath I've just opened the Draft one: #60261

Using it, you can switch between feeds, and check the OpenPolicyCompanyCardsFeed results.

Monosnap.screencast.2025-04-15.11-59-27.mp4

Let me know if that's what you need!

@puneetlath
Copy link
Contributor Author

Thanks @VickyStash. Please go ahead with your PR while I update that command. I don’t want to block you and it’d be ideal to make progress on the parts we can.

@VickyStash
Copy link
Contributor

One more thing I have noticed is that the feed name update made in the ND has no effect in the OD.

Image

Maybe it's cause the update is saved under sharedNVP_private_domain_member_ key related to workspaceAccountID.
Is it expected?

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Weekly KSv2 labels Apr 16, 2025
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Apr 22, 2025
@shubham1206agra
Copy link
Contributor

Screen.Recording.2025-04-23.at.9.26.27.AM.mov

@VickyStash, I am not able to see the cards that are present in the feed. Can you please help me with this?

@VickyStash
Copy link
Contributor

@shubham1206agra If it's a domain feed, it's a known issue, see this and this comments.
The fix should be implemented on the BE side.

cc @puneetlath any updates on this?

@shubham1206agra
Copy link
Contributor

@VickyStash It's not domain feed.

@VickyStash
Copy link
Contributor

@shubham1206agra Could you please provide the return result of the OpenPolicyCompanyCardsFeed API call?

@shubham1206agra
Copy link
Contributor

@VickyStash See

{
    "onyxData": [
        {
            "key": "sharedNVP_private_domain_member_18992745",
            "onyxMethod": "set",
            "value": {
                "settings": {
                    "companyCards": {
                        "vcf1": {
                            "credentials": "",
                            "pending": false
                        },
                        "vcf2": {
                            "pending": false
                        }
                    }
                }
            }
        },
        {
            "key": "cards_18992745_vcf2",
            "onyxMethod": "set",
            "value": {
                "cardList": {
                    "480801XXXXXX3304": "v12:74E3CA3C4C0FA02FDCF7521EC7E305E1"
                }
            }
        }
    ],
    "jsonCode": 200,
    "requestID": "934e416bdff78ad6-SJC"
}

@VickyStash
Copy link
Contributor

@shubham1206agra As I can see from the data you have two Visa commercial feeds. But only in one of them you have cards to assign. Have you tried to switch to another feed (vcf2). I believe you were on the vcf1

@shubham1206agra
Copy link
Contributor

@VickyStash I was on vcf2 when tried to assign cards.

@VickyStash
Copy link
Contributor

I've just tested it on the main by locally putting the data you provided to the Onyx, and it worked for me for vcf2.
Could you please check one more time and let me know?

@shubham1206agra
Copy link
Contributor

@VickyStash Still not working

@VickyStash
Copy link
Contributor

I've tried with several members and it's still not reproduced for me 😞

Monosnap.screencast.2025-04-23.17-24-34.mp4

What if you re-login, is it the same?
What if you revert this PR locally? Is it fixed?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 28, 2025
Copy link

melvin-bot bot commented Apr 28, 2025

Payment Summary

Upwork Job

  • Contributor: @VickyStash is from an agency-contributor and not due payment
  • Contributor: @koko57 is from an agency-contributor and not due payment
  • Reviewer: @DylanDylann owed $250 via NewDot

BugZero Checklist (@maddylewis)

  • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@flaviadefaria flaviadefaria moved this to Second Cohort - HIGH in [#whatsnext] #migrate Apr 28, 2025
@maddylewis
Copy link
Contributor

@VickyStash - is this still outstanding? #59837 (comment)

lmk if this is good to close out as completed or not!

@VickyStash
Copy link
Contributor

@VickyStash - is this still outstanding? #59837 (comment)

I wasn't able to reproduce it, @shubham1206agra is it still an issue for you? Though I'm not sure if it's related to the functionality implemented in this issue.

The only thing that is left is updating OpenPolicyCompanyCardsFeed call to return domain cards, but there is a separate issue for that: #60978

@shubham1206agra
Copy link
Contributor

@VickyStash Yes, this is still an issue for me.

@VickyStash
Copy link
Contributor

What if you re-login, is it the same?
What if you revert this PR locally? Is it fixed?

@shubham1206agra Have you tried what I mentioned above?

@shubham1206agra
Copy link
Contributor

@VickyStash I wasn't able to revert the PR since straight revert was not possible.

@VickyStash
Copy link
Contributor

@shubham1206agra Maybe you can share your onyx state so that I can take a look on my end?

@VickyStash
Copy link
Contributor

I've checked @shubham1206agra onyx state and it looks like the expected behaviour after implementation of this PR.

@puneetlath
Copy link
Contributor Author

I think we can close this out now, right @maddylewis?

Copy link

melvin-bot bot commented May 6, 2025

@VickyStash Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@puneetlath
Copy link
Contributor Author

@maddylewis bump. Can we close this?

Copy link

melvin-bot bot commented May 8, 2025

@maddylewis Eep! 4 days overdue now. Issues have feelings too...

@puneetlath
Copy link
Contributor Author

Looks like @maddylewis is OOO. I'm going to go ahead and close this out, but if that's wrong feel free to let me know and I'll reopen.

@github-project-automation github-project-automation bot moved this from Second Cohort - HIGH to Done in [#whatsnext] #migrate May 8, 2025
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 Daily KSv2 NewFeature Something to build that is a new item. Reviewing Has a PR in review
Projects
Development

No branches or pull requests

8 participants