Skip to content

Commit a0a0f8a

Browse files
chore(paystack): Rename PaystackFacade to Paystack
1 parent 5241bb6 commit a0a0f8a

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"require": {
1414
"php": ">=5.5.9",
1515
"illuminate/support": "5.2.*",
16-
"guzzlehttp/guzzle": "~5.0"
16+
"guzzlehttp/guzzle": "~5.0",
17+
"ramsey/uuid": "3.1.*"
1718
},
1819
"require-dev": {
1920
"phpunit/phpunit" : "4.*",

src/Facades/Paystack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Support\Facades\Facade;
66

7-
class PaystackFacade extends Facade {
7+
class Paystack extends Facade {
88
/**
99
* Get the registered name of the component.
1010
*

src/Paystack.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Unicodeveloper\Paystack;
44

55
use GuzzleHttp\Client;
6+
use Ramsey\Uuid\Uuid;
7+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
68

79
class Paystack {
810

@@ -208,6 +210,30 @@ public function getAccessCode()
208210
*/
209211
public function genTranxRef()
210212
{
213+
try {
211214

215+
// Generate a version 1 (time-based) UUID object
216+
$uuid1 = Uuid::uuid1();
217+
echo $uuid1->toString() . "\n"; // i.e. e4eaaaf2-d142-11e1-b3e4-080027620cdd
218+
219+
// // Generate a version 3 (name-based and hashed with MD5) UUID object
220+
// $uuid3 = Uuid::uuid3(Uuid::NAMESPACE_DNS, 'php.net');
221+
// echo $uuid3->toString() . "\n"; // i.e. 11a38b9a-b3da-360f-9353-a5a725514269
222+
223+
// // Generate a version 4 (random) UUID object
224+
// $uuid4 = Uuid::uuid4();
225+
// echo $uuid4->toString() . "\n"; // i.e. 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a
226+
227+
// // Generate a version 5 (name-based and hashed with SHA1) UUID object
228+
// $uuid5 = Uuid::uuid5(Uuid::NAMESPACE_DNS, 'php.net');
229+
// echo $uuid5->toString() . "\n"; // i.e. c4a760a8-dbcf-5254-a0d9-6a4474bd1b62
230+
231+
} catch (UnsatisfiedDependencyException $e) {
232+
233+
// Some dependency was not met. Either the method cannot be called on a
234+
// 32-bit system, or it can, but it relies on Moontoast\Math to be present.
235+
echo 'Caught exception: ' . $e->getMessage() . "\n";
236+
237+
}
212238
}
213239
}

tests/PaystackTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Unicodeveloper\Paystack\Test;
44

55
use PHPUnit_Framework_TestCase;
6+
use Unicodeveloper\Paystack\Paystack;
67

78
class PaystackTest extends PHPUnit_Framework_TestCase
89
{
@@ -13,4 +14,10 @@ public function testTrueIsTrue()
1314
{
1415
$this->assertTrue(true);
1516
}
17+
18+
public function testTranxRef()
19+
{
20+
$paystack = new Paystack();
21+
echo $paystack->genTranxRef();
22+
}
1623
}

0 commit comments

Comments
 (0)