Skip to content

Commit

Permalink
Merge pull request #94 from andela-sjames/develop
Browse files Browse the repository at this point in the history
Update docs and test
  • Loading branch information
andela-sjames authored Jul 24, 2024
2 parents 0be092e + 7257fef commit e841fdc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
12 changes: 8 additions & 4 deletions docs/transactions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Transactions
`https://paystack.com/docs/api/transaction/`


##### `Transaction.initialize(reference, amount, email, plan)` - Initialize a transaction.

Expand Down Expand Up @@ -77,16 +79,18 @@ 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
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*

Expand Down
5 changes: 4 additions & 1 deletion paystackapi/tests/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions paystackapi/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e841fdc

Please sign in to comment.