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

[$250] Add posted date to Expensify Card transactions #52358

Open
JmillsExpensify opened this issue Nov 12, 2024 · 15 comments
Open

[$250] Add posted date to Expensify Card transactions #52358

JmillsExpensify opened this issue Nov 12, 2024 · 15 comments
Assignees
Labels
Daily KSv2 External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item.

Comments

@JmillsExpensify
Copy link

JmillsExpensify commented Nov 12, 2024

Problem: Credit card transactions are unique because it's possible to buy something one day, but then the transaction isn't processed by the issuing bank until a couple of days later. Both dates are important, because the receipt will always have the transaction date, yet the accountant (and accounting system) need the posted date.

Solution: Let's add the posted date to all Expensify Card transactions. What this means in practice is that:

  • The transaction date will continue to show.
  • We'll add a "dot separator" pattern for Date label (just like Amount; see example below).
  • This will take the form Date * Posted %postedDate%.

I've annotated the mockup below so that this is hopefully all clear.
image (37)

Other notes for emphasis:

  • The transaction date and the posted date only apply to Expensify Card transactions, so please make sure that's addressed in your proposal.
  • If there is no posted date yet, then * Posted %postedDate% will not show.
Issue OwnerCurrent Issue Owner: @ikevin127
@JmillsExpensify JmillsExpensify added External Added to denote the issue can be worked on by a contributor Daily KSv2 NewFeature Something to build that is a new item. labels Nov 12, 2024
@JmillsExpensify JmillsExpensify self-assigned this Nov 12, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 12, 2024
Copy link

melvin-bot bot commented Nov 12, 2024

Current assignee @JmillsExpensify is eligible for the NewFeature assigner, not assigning anyone new.

Copy link

melvin-bot bot commented Nov 12, 2024

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 Daily KSv2 labels Nov 12, 2024
Copy link

melvin-bot bot commented Nov 12, 2024

⚠️ It looks like this issue is labelled as a New Feature but not tied to any GitHub Project. Keep in mind that all new features should be tied to GitHub Projects in order to properly track external CAP software time ⚠️

Copy link

melvin-bot bot commented Nov 12, 2024

Triggered auto assignment to Design team member for new feature review - @dubielzyk-expensify (NewFeature)

@JmillsExpensify JmillsExpensify changed the title Add posted date to Expensify Card transactions [$250] Add posted date to Expensify Card transactions Nov 12, 2024
Copy link

melvin-bot bot commented Nov 12, 2024

⚠️ Could not update price automatically because there is no linked Upwork Job ID. The BZ team member will need to update the price manually in Upwork.

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 12, 2024

Edited by proposal-police: This proposal was edited at 2024-11-12 09:01:16 UTC.

Proposal

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

Add posted date to Expensify Card transactions

What is the root cause of that problem?

New feature

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

  1. Create a variable for date description as we did for amountDescription here
let dateDescription = translate('common.date')
  1. When the transaction is the card transaction, get the posted date from transaction data, if it exists add posted data to the dateDescription
if (postedDate) {
    dateDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.posted')} ${postedDate}`
}

  1. Update the description prop here to dateDescription variable
description={dateDescription} 

description={translate('common.date')}

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Daily KSv2 label Nov 12, 2024
@mkzie2
Copy link
Contributor

mkzie2 commented Nov 12, 2024

Updated proposal.

  • Add code change

@mountiny mountiny self-assigned this Nov 12, 2024
@ikevin127

This comment was marked as outdated.

@ikevin127
Copy link
Contributor

@mkzie2's proposal makes sense to me. The solution follows the Amount field's model for adding additional data which is what we're looking for based on the issue's emphasis notes. Other details can be worked on during the PR phase. The solution result would look like this:

Spoiler Screenshot 2024-11-12 at 15 28 56

🎀👀🎀 C+ reviewed

@mountiny Is the BE part for this NewFeature completed ? I wasn't able to find any variable like / related to postedDate in the FE transaction types - therefore we might have to wait for BE to return the variable before moving on with the FE implementation for this issue.

Copy link

melvin-bot bot commented Nov 12, 2024

Current assignee @mountiny is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@mountiny
Copy link
Contributor

Thanks! no the be is not completed. I fell for the trap from @JmillsExpensify called External issue.

I will have to whip up a PR for this

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 12, 2024
@ikevin127
Copy link
Contributor

Another thing I noticed when reviewing is that we have this check:

/**
* Determine whether a transaction is made with a card (Expensify or Company Card).
*/
function isCardTransaction(transaction: OnyxEntry<Transaction>): boolean {
return !!transaction?.managedCard;
}

based on which we will show the Posted YYYY-MM-DD label if postedDate exists (based on proposed solution):
if (isCardTransaction) {
if (formattedOriginalAmount) {
amountDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.original')} ${formattedOriginalAmount}`;
}
if (isCancelled) {
amountDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.canceled')}`;
}
} else {

but because of the !!transaction?.managedCard check which determines isCardTransaction, if managedCard (boolean) is false or doesn't exist in the transaction object -> isCardTransaction will be false -> label won't show.

@mountiny Is managedCard always populated and true on card transactions ? I wanted to bring up with you to ensure that we're tight here from the BE side, otherwise we could have a potential regression post-merge.

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 13, 2024

@mountiny Please let me know once the backend PR is done and let me know what data in a transaction that I can use to get the postedDate

@mountiny
Copy link
Contributor

@mkzie2 will let you know

@mountiny
Copy link
Contributor

@ikevin127 I assume managedCard is for all card transactions give the logic you showed but I will check once I will work on the PR

@garrettmknight garrettmknight moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Daily KSv2 External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item.
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

5 participants