hotgluexyz / tap-chargebee

Singer.io tap for extracting data from the Chargebee API
https://www.singer.io/
GNU Affero General Public License v3.0
0 stars 6 forks source link

Incorrect version of invoice recorded in `invoices` table. #13

Open benw-at-birdie opened 2 years ago

benw-at-birdie commented 2 years ago

Hello 👋 . First of all thank you for making a chargebee connector which is compatible with meltano. So much easier to implement!

Unfortunately I've run into an issue where the version of an invoice downloaded by the tap is out of date. The downloaded version is flagged as deleted whereas the latest version is not. This is causing a small discrepancy in our financial reporting but worries me that there are more examples which I'm not aware of.

The good news is that the latest version of the invoices is recorded in the events stream. The following query returns all the versions including the latest...

select 
    content:invoice:id::text as invoice_id, 
    content:invoice:deleted::boolean as deleted,
    content:invoice:updated_at::text as updated_at,
    content:invoice:resource_version::text as resource_version

from analytics.chargebee.events where content:invoice:id::text = 'A100'
order by updated_at;
image

But querying the invoices table returns an earlier version (row 2 in the table above)...

select 
    id as invoice_id,  
    deleted,
    updated_at,
    resource_version

from analytics.chargebee.invoices
where id = 'A100';
image

I initially assummed this was a problem with the incremental load for the invoices table but running a --full-refresh using meltano didn't work and even creating a new destination schema and setting a new job id --job_id=chargebee-to-snowflake-test also returned the out of date invoice data :-(.

Interestingly running a load using the original https://github.com/singer-io/tap-chargebee/ tap downloads the correct version. Also querying the chargebee api directly using curl https://birdie-care.chargebee.com/api/v1/invoices/A100 -u .. returns the latest version of the invoice.

Many thanks in advance for your help with this. Please let me know if there's any additional info I can provide to help debug.

p.s. we're using V2 of the chargebee product catalogue.

benw-at-birdie commented 1 year ago

HI @sehnem @hsyyid is this ☝️ an issue you've come across at all?