Skip to content

Fix retrieval of upcoming Invoice line items#1087

Merged
matthewling-stripe merged 1 commit intomasterfrom
matthewling-fix-upcoming-invoice-line-items
Aug 27, 2020
Merged

Fix retrieval of upcoming Invoice line items#1087
matthewling-stripe merged 1 commit intomasterfrom
matthewling-fix-upcoming-invoice-line-items

Conversation

@matthewling-stripe
Copy link
Contributor

@matthewling-stripe matthewling-stripe commented Aug 26, 2020

Some endpoints receive the "root" object id as a query string parameter for example:

/v1/invoices/upcoming/lines?customer=cus_xxx if invoice.getLines().list(linesParams) is used.

If, in linesParams, further options are passed (limit: 5 for example), these are appended to the URI using a question mark and not an ampersand, resulting in in a URI of the form http://api.stripe.com/v1/invoices/upcoming/lines/?customer=cus_xxx?limit=5.

This PR attempts to fix this by first checking whether the incoming spec URL has an existing query string. If it does, it appends any further params, specified in the incoming params hash, otherwise appends a new query string starting with ampersand.

Some endpoints receive the "root" object id as a query string parameter for example

`/v1/invoices/upcoming/lines?customer=cus_xxx`

if `invoice.getLines().list(linesParams)` is used. If, in `linesParams`, further
options are passed (limit: 5 for example), these are incorrectly appended to
the URI using a question mark and not an ampersand, resulting in calls
for upcoming line items for a customer specified by a resource ID of cus_xxx?limit=5.
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

@matthewling-stripe matthewling-stripe merged commit ecddbd0 into master Aug 27, 2020
@remi-stripe remi-stripe deleted the matthewling-fix-upcoming-invoice-line-items branch August 27, 2020 16:56
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.

3 participants