add a split-transaction charge-centric mode
(I'm happy to do this work, I just wanted to open an issue first to make sure it was friendly to the project).
All my Amazon spend is on a single credit card. What I want to do is have a transaction for the credit card charge, not the individual order items. The transaction can have a split for every transaction associated with the charge (right now, if there's a charge with three items and a coupon, we get 4 transactions. in this mode, you have one transaction with four splits sub-transactions.
I think the schema of the two files (Items and Orders & Shipments) allows for this, though I need to check various edge cases.
Hi @yanowitz,
I'm not certain, but it might be tricky to know which items belong to each credit card charge? A single order can be split in unpredictable ways.
yeah, I fear you are correct. i don't need it to always be right (I don't think we can get anything that is, absent a report that presents the data exactly as we want it) though -- just mostly right would be a huge time saver. I suppose I could also do a shipping-centric view (roll up by tracking id) -- that's likely to match the cc charge. I guess the changes are:
- add a split-transaction creation mechanism to YNAB api (starting in
ynab.ts) - allow for grouping transactions by arbitrary keys (in
amazon.ts) - specify a group key via config
- wire all this up together
does that sound reasonable?
I think that would work most of the time since both items and orders & shipments reports have tracking numbers, but there are some edge cases where it wouldn't work, so there'd need to be some fallback behavior. In particular:
- Digital items
- Physical items which only have the name of the carrier in the tracking field (with no parenthesized tracking ID). Pretty common for overseas shipments
- Physical items which have a name and a parenthesized value, but the parenthesized value isn't really a tracking number and just says something like "No tracking number". This is pretty rare, I've only see it a few times and I think it's a result of Marketplace sellers using the platform incorrectly.
I found this link which should address the "what items went into what credit card charge" issue: https://www.amazon.com/cpe/yourpayments/transactions