Fix turnover calculation logic #15

Open
opened 12 months ago by inga-lovinde · 0 comments
Owner

Incoming transactions can have their date field set to any date, and we'll save them like that; and when calculating turnover, we look at date value for existing transactions; but we ignore date value of the transaction under consideration and always compute turnover for the current month.

E.g. if on January 15th 2024, a transaction with date: '2023-12-01' and amount: 2000 arrives: we'll store it with December date.
Then, if a second transaction with date: '2023-12-01' arrives: we'll try to get turnover for the current month (January 2024), which will be zero, so we won't use "high turnover" rule.

This behavior is inconsistent: both transactions have the same date, and both arrived to our API on the same day, yet for turnover calculation purposes we use date field of the first transaction (and not the date when it arrived to our API), but the date of arrival to our API for the second transaction (and not its date field).

Incoming transactions can have their `date` field set to any date, and we'll save them like that; and when calculating turnover, we look at `date` value for existing transactions; but we ignore `date` value of the transaction under consideration and always compute turnover for the current month. E.g. if on January 15th 2024, a transaction with `date: '2023-12-01'` and `amount: 2000` arrives: we'll store it with December date. Then, if a second transaction with `date: '2023-12-01'` arrives: we'll try to get turnover for the current month (January 2024), which will be zero, so we won't use "high turnover" rule. This behavior is inconsistent: both transactions have the same `date`, and both arrived to our API on the same day, yet for turnover calculation purposes we use `date` field of the first transaction (and not the date when it arrived to our API), but the date of arrival to our API for the second transaction (and not its `date` field).
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: inga-lovinde/test-assignment-payments#15
Loading…
There is no content yet.