From 2727cb65b6a4ca3a12fd89d8e140d0b3fac2399d Mon Sep 17 00:00:00 2001 From: samuelvarejames Date: Wed, 24 Jul 2024 23:24:01 +0200 Subject: [PATCH 1/2] Update docs and test --- docs/transactions.md | 10 +++++++--- paystackapi/tests/test_transaction.py | 5 ++++- paystackapi/transaction.py | 6 ++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/transactions.md b/docs/transactions.md index 15ac1da..5d62d45 100644 --- a/docs/transactions.md +++ b/docs/transactions.md @@ -1,4 +1,6 @@ ## Transactions +`https://paystack.com/docs/api/transaction/` + ##### `Transaction.initialize(reference, amount, email, plan)` - Initialize a transaction. @@ -81,12 +83,14 @@ JSON data from paystack API. ```python from paystackapi.transaction import Transaction -response = Transaction.list() +response = Transaction.list(perPage=3,page=1) ``` -*Arguments* +*Arguments* -No argument required. +- `customer`: Specify an ID for the customer whose transactions you want to retrieve (optional) +- `status`: Filter transactions by status ('failed', 'success', 'abandoned') (optional) +- ... *Returns* diff --git a/paystackapi/tests/test_transaction.py b/paystackapi/tests/test_transaction.py index 031c86e..64c9912 100644 --- a/paystackapi/tests/test_transaction.py +++ b/paystackapi/tests/test_transaction.py @@ -77,7 +77,10 @@ def test_list(self): status=201, ) - response = Transaction.list() + response = Transaction.list( + perPage=3, + page=1 + ) self.assertTrue(response['status']) @httpretty.activate diff --git a/paystackapi/transaction.py b/paystackapi/transaction.py index a757df8..4d837fc 100644 --- a/paystackapi/transaction.py +++ b/paystackapi/transaction.py @@ -77,10 +77,12 @@ def list(cls, **kwargs): Args: No argument required. optional: - customer_id: When used as a param, returns the transactions related to the customer - customer_email: When used as a param, does not return transactions related to the customer + customer: When used as a param, returns the transactions related to the customer + status: Filter transactions by status ('failed', 'success', 'abandoned') perPage: Specify how many records you want to retrieve per page. If not specify we use a default value of 50. (Integer) + page: Specify exactly what page you want to retrieve. + If not specify we use a default value of 1. (Integer) Returns: Json data from paystack API. From 7257fefa64183f02e195e46b7e93f852d53a1057 Mon Sep 17 00:00:00 2001 From: samuelvarejames Date: Wed, 24 Jul 2024 23:26:36 +0200 Subject: [PATCH 2/2] Update README.md --- docs/transactions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/transactions.md b/docs/transactions.md index 5d62d45..64b43ff 100644 --- a/docs/transactions.md +++ b/docs/transactions.md @@ -79,7 +79,7 @@ response = Transaction.get(transaction_id=23) JSON data from paystack API. -##### `Transaction.list()` - List transactions. +##### `Transaction.list(**kwargs)` - List transactions. ```python from paystackapi.transaction import Transaction