Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix autopagination for Service #942

Merged
merged 4 commits into from
May 28, 2020
Merged

fix autopagination for Service #942

merged 4 commits into from
May 28, 2020

Conversation

pepin-stripe
Copy link
Contributor

@pepin-stripe pepin-stripe commented May 26, 2020

Should fix #939.

Briefly, autoPagingIterator expects the filters property on Stripe\Collection to be set from $params.

This was happening before in \ApiOperations\All::all https://github.com/stripe/stripe-php/blob/master/lib/ApiOperations/All.php#L33, but isn't done in
BaseStripeClient#request

https://github.com/stripe/stripe-php/blob/master/lib/BaseStripeClient.php#L129-L140.

This PR introduces BaseStripeClient#requestCollection (and AbstractService#requestCollection, to call it), which simply calls #request and then ->setFilters($params), and then we updated the "SubscriptionService" to use it.

ptal @ob-stripe to see if this seems right (feel free to bikeshed on naming)

I prefer adding a separate #requestCollection method rather than adding the call conditionally to #request -- since ->all should always return a \Stripe\Collection, it seems better that it call a method guaranteed to return the narrower \Stripe\Collection rather than the broader \Stripe\Object

@richardm-stripe richardm-stripe changed the title [wip] started AbstractService::RequestCollection [wip] fix autopagination for Service May 26, 2020
Copy link
Contributor

@ob-stripe ob-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, that looks like the proper fix. Thanks @pepin-stripe!

@ob-stripe ob-stripe assigned pepin-stripe and unassigned ob-stripe May 26, 2020
@pepin-stripe
Copy link
Contributor Author

ptal @richardm-stripe

@richardm-stripe
Copy link
Contributor

Ok, will add codegen for this and release tomorrow.

@richardm-stripe
Copy link
Contributor

codegenned,
ptal @ob-stripe again

@richardm-stripe richardm-stripe changed the title [wip] fix autopagination for Service fix autopagination for Service May 27, 2020
Copy link
Contributor

@ob-stripe ob-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] StripeClient subscriptions & autoPagingIterator - missing parameters
3 participants