singer-io / tap-chargify

GNU Affero General Public License v3.0
2 stars 16 forks source link

About Invoices #29

Open cirotix opened 3 years ago

cirotix commented 3 years ago

I see from the git history (and from the forks of this project) that there is some confusion about the Invoices stream.

from streams.py

class Invoices(Stream):
    name = "invoices"
    replication_method = "INCREMENTAL"
    # replication_key = "updated_at"
    replication_key = "due_date"
    # API endpoint filters only on `due_date`.

We can see that the replication key has due_date and had been updated_at. There was a back and forth on this line in the commits. The fact is there are actually two very different Invoice objects in Chargify:

Legacy Invoices have a updated_at property Relationship Invoices have a due_date property Both of them have a completely different structure and are unrelated. The most confusing part is that they have the same endpoint in Chargify API: /invoices/ You'll get one or the other depending on the instance you have.

I will open a PR to fix this issue. Unfortunately, I only have instances with Legacy Invoices so I can only test this. But I will provide a scafolder for the new Relationship Invoices.