Skip to content

Commit fe0b508

Browse files
committed
Initial Refactoring
1 parent 6c6cb88 commit fe0b508

6 files changed

Lines changed: 63 additions & 1 deletion

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matscode/paystack-php-sdk",
3-
"description": "This package is for communicating with PAYSTACK API",
3+
"description": "Paystack PHP SDK is for communicating with PAYSTACK API",
44
"type": "library",
55
"authors": [
66
{

src/Interfaces/PaymentProvider.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
4+
namespace Matscode\Paystack\Interfaces;
5+
6+
7+
interface PaymentProvider
8+
{
9+
public function __get($propertyName);
10+
}

src/Paystack.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
4+
namespace Matscode\Paystack;
5+
6+
use Matscode\Paystack\Interfaces\PaymentProvider;
7+
8+
class Paystack implements PaymentProvider
9+
{
10+
public function __construct(string $secretKey)
11+
{
12+
echo $secretKey;
13+
}
14+
15+
public function __get($propertyName)
16+
{
17+
// TODO: Implement __get() method and get the related resource
18+
echo 'this is property was tried to be access: ' . $propertyName;
19+
}
20+
}

src/ResourceRegistry.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
namespace Matscode\Paystack;
3+
4+
class ResourceRegistry {
5+
public static $registry = [
6+
'transaction' => \Matscode\Paystack\Transaction::class
7+
];
8+
}

src/Utility/HTTPClient.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
4+
namespace Matscode\Paystack\Utility;
5+
6+
7+
use GuzzleHttp\Client;
8+
9+
class HTTPClient
10+
{
11+
12+
private
13+
$client,
14+
$apiBaseUrl = 'https://api.paystack.co/', // with trailing slash
15+
$curl,
16+
$secretKey;
17+
18+
public function __construct()
19+
{
20+
$this->client = new Client([
21+
'base_uri' => $this->apiBaseUrl
22+
]);
23+
}
24+
}

0 commit comments

Comments
 (0)