-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Include parent resource in pagination calls
Use the next and previous `_links` in the pagination logic. Previously, pagination calls to a nested resource were incorrectly scoped. For, example: payments = customer.payments(limit: 2) payments.next The first line correctly retrieves: /v2/customers/cst_8wmqcHMN4U/payments?from=tr_3&limit=2 The second line incorrectly called: /v2/payments?from=tr_3&limit=2 (customer scope omitted) Resolves #144
- Loading branch information
1 parent
31a47aa
commit 506d52e
Showing
5 changed files
with
160 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"resource": "customer", | ||
"id": "cst_8wmqcHMN4U", | ||
"mode": "test", | ||
"name": "Customer A", | ||
"email": "[email protected]", | ||
"locale": "nl_NL", | ||
"metadata": null, | ||
"createdAt": "2018-04-06T13:23:21.0Z", | ||
"_links": { | ||
"self": { | ||
"href": "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U", | ||
"type": "application/hal+json" | ||
}, | ||
"dashboard": { | ||
"href": "https://www.mollie.com/dashboard/org_123456789/customers/cst_8wmqcHMN4U", | ||
"type": "text/html" | ||
}, | ||
"mandates": { | ||
"href": "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/mandates", | ||
"type": "application/hal+json" | ||
}, | ||
"subscriptions": { | ||
"href": "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/subscriptions", | ||
"type": "application/hal+json" | ||
}, | ||
"payments": { | ||
"href": "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments", | ||
"type": "application/hal+json" | ||
}, | ||
"documentation": { | ||
"href": "https://docs.mollie.com/reference/v2/customers-api/get-customer", | ||
"type": "text/html" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"count": 2, | ||
"_embedded": { | ||
"payments": [ | ||
{ | ||
"resource": "payment", | ||
"id":"tr_3" | ||
}, | ||
{ | ||
"resource": "payment", | ||
"id":"tr_4" | ||
} | ||
] | ||
}, | ||
"_links": { | ||
"documentation": { | ||
"href": "https://docs.mollie.com/reference/v2/customers-api/list-customer-payments", | ||
"type": "text/html" | ||
}, | ||
"self": { | ||
"href": "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?from=tr_3&limit=2", | ||
"type": "application/hal+json" | ||
}, | ||
"previous": { | ||
"href": "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?from=tr_1&limit=2", | ||
"type": "application/hal+json" | ||
}, | ||
"next": null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"count": 2, | ||
"_embedded": { | ||
"payments": [ | ||
{ | ||
"resource": "payment", | ||
"id":"tr_1" | ||
}, | ||
{ | ||
"resource": "payment", | ||
"id":"tr_2" | ||
} | ||
] | ||
}, | ||
"_links": { | ||
"documentation": { | ||
"href": "https://docs.mollie.com/reference/v2/customers-api/list-customer-payments", | ||
"type": "text/html" | ||
}, | ||
"self": { | ||
"href": "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?limit=2", | ||
"type": "application/hal+json" | ||
}, | ||
"previous": null, | ||
"next": { | ||
"href": "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?from=tr_3&limit=2", | ||
"type": "application/hal+json" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters