Skip to content

Commit 2d0bebb

Browse files
committed
Add filter example
1 parent 3f38b43 commit 2d0bebb

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ $transactions->refund($transaction_id, $args);
8080
$all_transactions = $transactions->find($merchant_id,$args);
8181
$some_transactions = $transactions->before($merchant_id,$before);
8282
$some_transactions = $transactions->after($merchant_id,$before);
83+
84+
// explicit args
85+
$limit = 10;
86+
$after = '5b8e839d7cc76f04ecd3f733';
87+
$before = '5b98deef882cf804f6108700';
88+
$api_transactions = $transactions->find($merchant_id, array(
89+
'limit' => $limit,
90+
'after' => $after,
91+
'before' => $before,
92+
'filter' => array(
93+
'successful' => true
94+
)
95+
));
8396
```
8497

8598
## Pagination

changelog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## Paylike client (PHP)
88

9+
10+
## 1.0.3 - 2018-09-20
11+
### Changed
12+
- Readme and test update to include specific examples of the filter argument
13+
914
## 1.0.2 - 2018-09-12
1015
### Changed
1116
- Transactions and Merchants now support find and return a filter

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "paylike/php-api",
33
"description": "PHP SDK to communicate with the Paylike HTTP api",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"license": "MIT",
66
"authors": [
77
{

tests/TransactionsTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,4 +246,24 @@ public function testGetAllTransactionsCursorAfter()
246246

247247
$this->assertGreaterThan(0, count($api_transactions), 'number of transactions');
248248
}
249+
250+
/**
251+
* @throws \Exception
252+
*/
253+
public function testGetAllTransactionsFilter()
254+
{
255+
$merchant_id = $this->merchant_id;
256+
$api_transactions = $this->transactions->find($merchant_id, array(
257+
'filter' => array(
258+
'test' => true
259+
),
260+
));
261+
$ids = array();
262+
foreach ($api_transactions as $transaction) {
263+
// the transaction array grows as needed
264+
$ids[] = $transaction['id'];
265+
}
266+
267+
$this->assertGreaterThan(0, count($api_transactions), 'number of transactions');
268+
}
249269
}

0 commit comments

Comments
 (0)