Skip to content

Commit 106b843

Browse files
author
Aman Aalam
authored
Merge pull request #59 from trolley/repo-update
fix, feat: Repo update, tests update
2 parents 1d7425d + d3335f9 commit 106b843

File tree

5 files changed

+38
-9
lines changed

5 files changed

+38
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "trolley/core",
33
"type": "library",
44
"description": "Trolley PHP SDK",
5-
"homepage": "https://github.com/PaymentRails/php-sdk",
5+
"homepage": "https://github.com/Trolley/php-sdk",
66
"keywords": [
77
"PaymentRails",
88
"Trolley"

lib/Trolley/Batch.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ public static function find($batchId)
6868
/**
6969
* Create a batch
7070
*
71-
* @param mixed $params
71+
* @param mixed $batchDescription
7272
* @param mixed $payments
7373
* @return Batch
7474
*/
75-
public static function create($params, $payments = null)
75+
public static function create($batchDescription, $payments = null)
7676
{
77-
return Configuration::gateway()->batch()->create($params, $payments);
77+
return Configuration::gateway()->batch()->create($batchDescription, $payments);
7878
}
7979

8080
/**

lib/Trolley/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Version
1212
*/
1313
const MAJOR = 3;
1414
const MINOR = 0;
15-
const TINY = 0;
15+
const TINY = 1;
1616

1717
/**
1818
* @ignore

tests/integration/BatchTest.php

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private function deleteRecipient($recipientId) {
4343
$this->assertTrue($response);
4444
}
4545

46-
/* public function testErrors(){
46+
public function testErrors(){
4747

4848
//create inactive Recipient to send payment to
4949
$recipient = $this->createRecipient();
@@ -78,6 +78,23 @@ public function testAll_smokeTest()
7878
{
7979
$all = Trolley\Batch::all();
8080
$this->assertTrue($all->maximumCount() > 0);
81+
82+
$batch = Trolley\Batch::create([
83+
"sourceCurrency" => "USD",
84+
"description" => "Integration Test Create : PHP SDK",
85+
"tags" => ["PHPSDK"]
86+
]);
87+
88+
$searchResult = Trolley\Batch::search([
89+
"search" => "PHPSDK",
90+
"page" => 1,
91+
"pageSize" => 5
92+
]);
93+
94+
$this->assertEquals($searchResult->firstItem()->id, $batch->id);
95+
96+
$response = Trolley\Batch::delete($batch->id);
97+
$this->assertTrue($response);
8198
}
8299

83100
public function testBalances(){
@@ -151,7 +168,7 @@ public function testUpdate() {
151168
$response = Trolley\Batch::delete($batch->id);
152169

153170
$this->assertTrue($response);
154-
} */
171+
}
155172

156173
public function testCreateWithPayments()
157174
{
@@ -194,7 +211,7 @@ public function testCreateWithPayments()
194211
$this->deleteRecipient($recipientBeta->id);
195212
}
196213

197-
/* public function testPayments()
214+
public function testPayments()
198215
{
199216
$batch = Trolley\Batch::create([
200217
"sourceCurrency" => "USD",
@@ -220,6 +237,9 @@ public function testCreateWithPayments()
220237

221238
$this->assertTrue($response);
222239

240+
$response = Trolley\Batch::findPayment($batch->id, $payment->id);
241+
$this->assertEquals($response->id, $payment->id);
242+
223243
$response = Trolley\Batch::deletePayment($batch->id, $payment->id);
224244

225245
$this->assertTrue($response);
@@ -273,5 +293,5 @@ public function testProcessing()
273293

274294
$this->deleteRecipient($recipientAlpha->id);
275295
$this->deleteRecipient($recipientBeta->id);
276-
} */
296+
}
277297
}

tests/integration/RecipientTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ public function testLifecycle()
8080
$fetchResult = Trolley\Recipient::find($createResult->id);
8181
$this->assertEquals('Bob', $fetchResult->firstName);
8282

83+
$searchResult = Trolley\Recipient::search(
84+
[
85+
"name" => $createResult->firstName,
86+
"page" => 1,
87+
"pageSize" => 2
88+
]
89+
);
90+
$this->assertEquals($searchResult->firstItem()->firstName, $createResult->firstName);
91+
8392
$deleteResult = Trolley\Recipient::delete($createResult->id);
8493
$this->assertTrue($deleteResult);
8594

0 commit comments

Comments
 (0)