App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2024-12-07] [$250] Add posted date to Expensify Card transactions

Open JmillsExpensify opened this issue 1 year ago • 34 comments

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. 385205287-be8d697c-5bef-4333-b179-e69d8455f517

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: @JmillsExpensify

JmillsExpensify avatar Nov 12 '24 08:11 JmillsExpensify

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

melvin-bot[bot] avatar Nov 12 '24 08:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 12 '24 08:11 melvin-bot[bot]

:warning: 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 :warning:

melvin-bot[bot] avatar Nov 12 '24 08:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 12 '24 08:11 melvin-bot[bot]

⚠️ 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.

melvin-bot[bot] avatar Nov 12 '24 08:11 melvin-bot[bot]

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}`
}

https://github.com/Expensify/App/blob/e3632a9877542727230814ffc9fdd78bd087ecbd/src/components/ReportActionItem/MoneyRequestView.tsx#L235

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

https://github.com/Expensify/App/blob/e3632a9877542727230814ffc9fdd78bd087ecbd/src/components/ReportActionItem/MoneyRequestView.tsx#L593

What alternative solutions did you explore? (Optional)

mkzie2 avatar Nov 12 '24 08:11 mkzie2

Updated proposal.

  • Add code change

mkzie2 avatar Nov 12 '24 09:11 mkzie2

♻️ Reviewing proposal.

ikevin127 avatar Nov 12 '24 19:11 ikevin127

@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.

ikevin127 avatar Nov 12 '24 23:11 ikevin127

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

melvin-bot[bot] avatar Nov 12 '24 23:11 melvin-bot[bot]

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

mountiny avatar Nov 12 '24 23:11 mountiny

Another thing I noticed when reviewing is that we have this check: https://github.com/Expensify/App/blob/7256ad6eef046be3345e0b260252f6ec47fc4203/src/libs/TransactionUtils/index.ts#L637-L642 based on which we will show the Posted YYYY-MM-DD label if postedDate exists (based on proposed solution): https://github.com/Expensify/App/blob/7256ad6eef046be3345e0b260252f6ec47fc4203/src/components/ReportActionItem/MoneyRequestView.tsx#L235-L242 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.

ikevin127 avatar Nov 13 '24 02:11 ikevin127

@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

mkzie2 avatar Nov 13 '24 09:11 mkzie2

@mkzie2 will let you know

mountiny avatar Nov 14 '24 00:11 mountiny

@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

mountiny avatar Nov 14 '24 00:11 mountiny

@JmillsExpensify, @mountiny, @ikevin127, @dubielzyk-expensify, @mkzie2 Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Nov 18 '24 09:11 melvin-bot[bot]

the be is not completed

ikevin127 avatar Nov 18 '24 10:11 ikevin127

No update

mountiny avatar Nov 18 '24 15:11 mountiny

In the queue

JmillsExpensify avatar Nov 20 '24 17:11 JmillsExpensify

Made myself an owner as I was missing it my k2

mountiny avatar Nov 21 '24 17:11 mountiny

@ikevin127 @mkzie2 the BE is up and it should be deployed on Monday.

The property in transaction will be posted and its a string with format YYYYMMDD so we will have to format it to what we need. This is how it is saved in the DB so I prefer not to change it to avoid confusion and just process it in the App. Types need to be updated too obviously

mountiny avatar Nov 22 '24 00:11 mountiny

@mkzie2 @ikevin127 what is your eta on the pr? You can start working on it assuming the data is in posted field of a transaction. You cannot test card transactions nonetheless so you can go ahead

mountiny avatar Nov 23 '24 00:11 mountiny

Then @mkzie2 can move forward with opening the PR and use posted as the variable and I'll start reviewing as soon as it's ready for review.

ikevin127 avatar Nov 23 '24 00:11 ikevin127

Will raise the PR today.

mkzie2 avatar Nov 25 '24 05:11 mkzie2

@mountiny Can you give me an example of posted with YYYYMMDD format?

mkzie2 avatar Nov 25 '24 10:11 mkzie2

@ikevin127 Create a draft here. cc @mountiny.

mkzie2 avatar Nov 25 '24 10:11 mkzie2

posted: "20241125"

mountiny avatar Nov 25 '24 19:11 mountiny

posted: "20241125"

@mkzie2 Given the format detailed above, I think if this part of the PR works with the given date format, then we're good to go and you can open the PR making sure to add testing steps and when it comes to the screenshots/videos section see if you can simulate a card transaction locally using Onyx. You can follow this Slack thread for details on how to simulate a card transaction locally for testing purposes.

ikevin127 avatar Nov 25 '24 20:11 ikevin127

Thanks will complete the PR today.

mkzie2 avatar Nov 26 '24 04:11 mkzie2

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] avatar Nov 30 '24 13:11 melvin-bot[bot]