-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a new iterator-only handler for result lists.
Since the full list of results is unknown, and results that already have been iterated might no longer be available, methods such as `__len__()` and `__getitem__()` as found in `ObjectList` are no longer available. `__getitem__()` (e.g `result_list['tr_1234']`) replacement: use `Resource.get(resource_id)`. `__len__()` (e.g. `len(result_list)`) replacement: exhaust the iterator and count the results. TODO: - More tests - Reversed() iterator, hoe does it work? - Add logic to return an ResultListIterator where now an ObjectList is hardcoded - Empty list results?
- Loading branch information
Tom Hendrikx
committed
Nov 25, 2022
1 parent
68aba38
commit 975c50f
Showing
8 changed files
with
269 additions
and
16 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
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
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
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,130 @@ | ||
{ | ||
"_embedded": { | ||
"payments": [ | ||
{ | ||
"resource": "payment", | ||
"id": "tr_gHTfdq4xAB", | ||
"mode": "test", | ||
"createdAt": "2018-07-19T09:49:46+00:00", | ||
"amount": { | ||
"value": "50.00", | ||
"currency": "EUR" | ||
}, | ||
"description": "My first iDEAL API payment", | ||
"method": "ideal", | ||
"metadata": { | ||
"order_id": 1531993786 | ||
}, | ||
"status": "open", | ||
"isCancelable": false, | ||
"expiresAt": "2018-07-19T10:05:16+00:00", | ||
"profileId": "pfl_gh5wrNQ6fx", | ||
"sequenceType": "oneoff", | ||
"redirectUrl": "https://webshop.example.org/order/1531993786", | ||
"webhookUrl": "https://webshop.example.org/payments/webhook/", | ||
"settlementAmount": { | ||
"value": "50.00", | ||
"currency": "EUR" | ||
}, | ||
"_links": { | ||
"self": { | ||
"href": "https://api.mollie.com/v2/payments/tr_gM5hTq4x4J", | ||
"type": "application/hal+json" | ||
}, | ||
"checkout": { | ||
"href": "https://www.mollie.com/paymentscreen/testmode/?method=ideal&token=spyye1", | ||
"type": "text/html" | ||
} | ||
} | ||
}, | ||
{ | ||
"resource": "payment", | ||
"id": "tr_9uhYN1zuCD", | ||
"mode": "test", | ||
"createdAt": "2018-07-19T09:49:35+00:00", | ||
"amount": { | ||
"value": "10.00", | ||
"currency": "GBP" | ||
}, | ||
"description": "My first iDEAL API payment", | ||
"method": "ideal", | ||
"metadata": { | ||
"order_id": 1531993773 | ||
}, | ||
"status": "open", | ||
"isCancelable": false, | ||
"expiresAt": "2018-07-19T10:05:05+00:00", | ||
"profileId": "pfl_gh5wrNQ6fx", | ||
"sequenceType": "oneoff", | ||
"redirectUrl": "https://webshop.example.org/order/1531993773", | ||
"webhookUrl": "https://webshop.example.org/payments/webhook/", | ||
"settlementAmount": { | ||
"value": "50.00", | ||
"currency": "EUR" | ||
}, | ||
"_links": { | ||
"self": { | ||
"href": "https://api.mollie.com/v2/payments/tr_7UhSN1zuXS", | ||
"type": "application/hal+json" | ||
}, | ||
"checkout": { | ||
"href": "https://www.mollie.com/paymentscreen/testmode/?method=ideal&token=xyrvjf", | ||
"type": "text/html" | ||
} | ||
} | ||
}, | ||
{ | ||
"resource": "payment", | ||
"id": "tr_47HgTDE9EF", | ||
"mode": "test", | ||
"createdAt": "2018-07-19T09:49:37+00:00", | ||
"amount": { | ||
"value": "100.00", | ||
"currency": "EUR" | ||
}, | ||
"description": "My first iDEAL API payment", | ||
"method": "ideal", | ||
"metadata": { | ||
"order_id": 1531993778 | ||
}, | ||
"status": "open", | ||
"isCancelable": false, | ||
"expiresAt": "2018-07-19T10:05:08+00:00", | ||
"profileId": "pfl_gh5wrNQ6rt", | ||
"sequenceType": "oneoff", | ||
"redirectUrl": "https://webshop.example.org/order/1531993778", | ||
"webhookUrl": "https://webshop.example.org/payments/webhook/", | ||
"settlementAmount": { | ||
"value": "50.00", | ||
"currency": "EUR" | ||
}, | ||
"_links": { | ||
"self": { | ||
"href": "https://api.mollie.com/v2/payments/tr_45xyzDE9v9", | ||
"type": "application/hal+json" | ||
}, | ||
"checkout": { | ||
"href": "https://www.mollie.com/paymentscreen/testmode/?method=ideal&token=xasfjf", | ||
"type": "text/html" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"count": 3, | ||
"_links": { | ||
"documentation": { | ||
"href": "https://docs.mollie.com/reference/v2/payments-api/list-payments", | ||
"type": "text/html" | ||
}, | ||
"self": { | ||
"href": "https://api.mollie.com/v2/payments?limit=50", | ||
"type": "application/hal+json" | ||
}, | ||
"previous": null, | ||
"next": { | ||
"href": "https://api.mollie.com/v2/payments?from=tr_gM5hTq4x4J&limit=3", | ||
"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