kfrancis / chargify-dot-net

MIT License
20 stars 49 forks source link

Production Import Messes with GetSubscriptionList #80

Closed EdLichtman closed 4 years ago

EdLichtman commented 5 years ago

Because Chargify Returns Subscriptions from newest to oldest by default, we run into an off-by one error while importing all subscriptions. Here's a scaled down example of what happens, with 3 subscriptions:

I have 3 subscribers, Jesse, Lesley and Charley.

I get 3 subscriptions per page.

Because Subscriptions is not 0, I need to Get next page. Hunter signs up in the middle of this process.

Had Hunter not signed up, we would have reached our 0 goal on next page, but now our next page consists of Jesse

This needs to be resolved by ordering by created_at ascending, that way the last page will always consist of the newest.

I have a fix pending in my development branch fork. I'll reach out when it's ready

EdLichtman commented 5 years ago

@kfrancis Fix is in my development branch pull request. Ready for review. I've also started implementing a different system of making requests so that we can more easily create JSON requests using anonymous objects. If we start to transition some of the other methods over I think we can write a lot less code to get the job done

kfrancis commented 5 years ago

I'll check that out as well, thanks @EdLichtman

EdLichtman commented 5 years ago

Hey @kfrancis I hope everything's going alright, do you have any questions about my pull request? Is it too much going on in a single pull request? are you needing me to try and minimize the code changed or anything? Really trying to get these bug fixes into the next version as soon as possible.

kfrancis commented 4 years ago

@EdLichtman Sorry for the delay, that should be in.