amazon-ynab-sync icon indicating copy to clipboard operation
amazon-ynab-sync copied to clipboard

add a split-transaction charge-centric mode

Open yanowitz opened this issue 5 years ago • 4 comments

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

yanowitz avatar Jan 10 '21 21:01 yanowitz

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.

starsprung avatar Jan 11 '21 06:01 starsprung

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:

  1. add a split-transaction creation mechanism to YNAB api (starting in ynab.ts)
  2. allow for grouping transactions by arbitrary keys (in amazon.ts)
  3. specify a group key via config
  4. wire all this up together

does that sound reasonable?

yanowitz avatar Jan 11 '21 13:01 yanowitz

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.

starsprung avatar Jan 12 '21 04:01 starsprung

I found this link which should address the "what items went into what credit card charge" issue: https://www.amazon.com/cpe/yourpayments/transactions

dlardo avatar Nov 01 '21 22:11 dlardo