Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrote the Project for better support and possibilities. #71

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
19a9f6d
Added class and defined endpoints as constants
bosunski Dec 10, 2018
eac1992
Replaced Endpoints with constants
bosunski Dec 11, 2018
6da9b83
Replaced Endpoints with constants
bosunski Dec 11, 2018
789eaca
Updated endpoint code styling
bosunski Dec 12, 2018
53ac460
UPdated Paystack.php
bosunski Dec 14, 2018
01a520b
Begin work on request helper
bosunski Dec 16, 2018
cc03c51
Resolve dependency issues
bosunski Feb 18, 2019
757366b
Update packages and Test
bosunski Feb 18, 2019
7fafff3
Fix TEsts
bosunski Feb 18, 2019
a883a4c
Add Abstractmanager package
bosunski Feb 18, 2019
2e65439
Update paystac.php config to use connections
bosunski Feb 18, 2019
86cbe97
Add Tests for PaystackServiceProvider and Updated the Provider
bosunski Feb 18, 2019
4c4161e
Update Paystack manager
bosunski Feb 18, 2019
e43c95c
Update Test for PaystackManager
bosunski Feb 18, 2019
03a6e5f
Update Test for PaystackManager
bosunski Feb 18, 2019
472356a
Add a new Facade Accessor
bosunski Feb 18, 2019
eb298e4
Add a new Facade Accessor
bosunski Feb 18, 2019
0853d86
Add a new Facade Accessor
bosunski Feb 18, 2019
9521f82
Add a new Facade Accessor
bosunski Feb 18, 2019
11813ff
Fix Config Issue
bosunski Feb 18, 2019
d8136bd
Update paystack.php
bosunski Feb 18, 2019
d8ec725
Update composer.json
bosunski Feb 18, 2019
4cbc37c
Update Manager to search legacy methods
bosunski Feb 18, 2019
5757086
Refactored Paystack Class
bosunski Feb 19, 2019
10414a6
Refactored Paystack Class 😍
bosunski Feb 19, 2019
09ddf90
Update Facades
bosunski Feb 19, 2019
431149e
Add Tests for Facade
bosunski Feb 19, 2019
1cbcc7b
Update Doc blocks
bosunski Feb 19, 2019
a140fa3
Update Doc blocks
bosunski Feb 19, 2019
1978c3a
Update Travis config
bosunski Feb 20, 2019
66264ab
Update README.md
bosunski Feb 20, 2019
dcbba4b
Update README.md
bosunski Feb 23, 2019
5b784d4
Update composer.json
bosunski Mar 14, 2019
9dac80f
Update composer.json
bosunski Mar 14, 2019
10b8f7c
Update composer.json
bosunski Apr 18, 2019
7caefdc
Add Event listener
bosunski Apr 18, 2019
b46e480
Add Event listener
bosunski Apr 19, 2019
abcec55
Change paystack.php to config/paystack.php
bosunski May 4, 2019
0e70320
Update Factory to use the Container
bosunski May 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm

matrix:
Expand Down
47 changes: 41 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## Installation

[PHP](https://php.net) 5.4+ or [HHVM](http://hhvm.com) 3.3+, and [Composer](https://getcomposer.org) are required.
[PHP](https://php.net) 7.1+ or [HHVM](http://hhvm.com) 3.3+, and [Composer](https://getcomposer.org) are required.

To get the latest version of Laravel Paystack, simply require it

Expand Down Expand Up @@ -57,32 +57,61 @@ A configuration-file named `paystack.php` with some sensible defaults will be pl
```php
<?php

return [
declare(strict_types=1);

/*
* This file is part of the Laravel Paystack package.
*
* (c) Prosper Otemuyiwa <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

return [
/**
* Public Key From Paystack Dashboard
*
*/
'publicKey' => getenv('PAYSTACK_PUBLIC_KEY'),
'publicKey' => $publicKey = env('PAYSTACK_PUBLIC_KEY', 'publicKey'),

/**
* Secret Key From Paystack Dashboard
*
*/
'secretKey' => getenv('PAYSTACK_SECRET_KEY'),
'secretKey' => $secretKey = env('PAYSTACK_SECRET_KEY', 'secretKey'),

/**
* Paystack Payment URL
*
*/
'paymentUrl' => getenv('PAYSTACK_PAYMENT_URL'),
'paymentUrl' => $paymentUrl = env('PAYSTACK_PAYMENT_URL'),

/**
* Optional email address of the merchant
*
*/
'merchantEmail' => getenv('MERCHANT_EMAIL'),
'merchantEmail' => $merchantEmail = env('MERCHANT_EMAIL'),

'default' => 'test',

/**
* Here you can specify different Paystack connection.
*/
'connections' => [
'test' => [
'publicKey' => $publicKey,
'secretKey' => $secretKey,
'paymentUrl' => $paymentUrl,
'cache' => false,
],
'live' => [
'publicKey' => $publicKey,
'secretKey' => $secretKey,
'paymentUrl' => $paymentUrl,
'cache' => false,
],
],
];
```

Expand Down Expand Up @@ -193,6 +222,12 @@ class PaymentController extends Controller

Let me explain the fluent methods this package provides a bit here.
```php
/**
* To use the Multi connection Feature you need to prefix your call like this otherwise
* the default connection will be used as specified in the paystack.php config file.
*/
Paystack::connection('live')->getAuthorizationUrl()->redirectNow();

/**
* This fluent method does all the dirty work of sending a POST request with the form data
* to Paystack Api, then it gets the authorization Url and redirects the user to Paystack
Expand Down
23 changes: 14 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@
"email": "[email protected]"
}
],
"minimum-stability": "stable",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^5.4.0|^7.0",
"illuminate/support": "5.*",
"guzzlehttp/guzzle": "5.*|6.*"
"php": "^7.1.3",
"illuminate/support": "^5.7",
"xeviant/paystack": "dev-master",
"graham-campbell/cache-plugin": "^1.1",
"graham-campbell/manager": "^4.2"
},
"require-dev": {
"phpunit/phpunit" : "4.*",
"scrutinizer/ocular": "~1.1",
"satooshi/php-coveralls": "^0.7.0",
"mockery/mockery": ">=0.7.2"
},
"mockery/mockery": "^1.2",
"phpunit/phpunit": "^7.0",
"orchestra/testbench": "3.7.*",
"graham-campbell/testbench": "^5.2",
"php-http/guzzle6-adapter": "^2.0",
"madewithlove/illuminate-psr-cache-bridge": "^1.0"
},
"autoload": {
"psr-4": {
"Unicodeveloper\\Paystack\\": "src/"
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
Expand Down
30 changes: 25 additions & 5 deletions resources/config/paystack.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Laravel Paystack package.
*
Expand All @@ -10,29 +12,47 @@
*/

return [

/**
* Public Key From Paystack Dashboard
*
*/
'publicKey' => getenv('PAYSTACK_PUBLIC_KEY'),
'publicKey' => $publicKey = env('PAYSTACK_PUBLIC_KEY', 'publicKey'),

/**
* Secret Key From Paystack Dashboard
*
*/
'secretKey' => getenv('PAYSTACK_SECRET_KEY'),
'secretKey' => $secretKey = env('PAYSTACK_SECRET_KEY', 'secretKey'),

/**
* Paystack Payment URL
*
*/
'paymentUrl' => getenv('PAYSTACK_PAYMENT_URL'),
'paymentUrl' => $paymentUrl = env('PAYSTACK_PAYMENT_URL'),

/**
* Optional email address of the merchant
*
*/
'merchantEmail' => getenv('MERCHANT_EMAIL'),
'merchantEmail' => $merchantEmail = env('MERCHANT_EMAIL'),

'default' => 'test',

/**
* Here you can specify different Paystack connection.
*/
'connections' => [
'test' => [
'publicKey' => $publicKey,
'secretKey' => $secretKey,
'paymentUrl' => $paymentUrl,
'cache' => false,
],
'live' => [
'publicKey' => $publicKey,
'secretKey' => $secretKey,
'paymentUrl' => $paymentUrl,
'cache' => false,
],
],
];
35 changes: 35 additions & 0 deletions src/Endpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Unicodeveloper\Paystack;


class Endpoint
{
const INIT_TRANSACTION = "/transaction/initialize";
const VERIFY_TRANSACTION = "/transaction/verify/";
const EXPORT_TRANSACTION = "/transaction/export";
const TRANSACTIONS = "/transaction";
const PLANS = "/plan";
const CREATE_PLAN = "/plan";
const FETCH_PLAN = "/plan/";
const UPDATE_PLAN = "/plan/";
const CUSTOMERS = "/customer";
const CREATE_CUSTOMER = "/customer";
const FETCH_CUSTOMER = "/customer/";
const UPDATE_CUSTOMER = "/customer/";
const GET_ALL_SUBSCRIPTIONS = "/subscription";
const CREATE_SUBSCRIPTION = "/subscription";
const GET_CUSTOMER_SUBSCRIPTION = "/subscription?customer=";
const GET_PLAN_SUBSCRIPTION = "/subscription?plan=";
const ENABLE_SUBSCRIPTION = "/subscription/enable";
const DISABLE_SUBSCRIPTION = "/subscription/disable";
const FETCH_SUBSCRIPTION = "/subscription/";
const CREATE_PAGE = "/page";
const GET_ALL_PAGES = "/page";
const FETCH_PAGE = "/page/";
const UPDATE_PAGE = "/page/";
const CREATE_SUB_ACCOUNT = "/subaccount";
const FETCH_SUB_ACCOUNT = "/subaccount/";
const LIST_SUB_ACCOUNT = "/subaccount/?perPage=";
const UPDATE_SUB_ACCOUNT = "/subaccount/?perPage=";
}
16 changes: 16 additions & 0 deletions src/Event/EventHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Unicodeveloper\Paystack\Event;

use League\Event\EventInterface;
use Xeviant\Paystack\Event\EventPayload;

class EventHandler
{
public function handle(EventInterface $event, EventPayload $payload): void
{
app('events')->dispatch($event->getName(), $payload);
}
}
4 changes: 3 additions & 1 deletion src/Facades/Paystack.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Laravel Paystack package.
*
Expand All @@ -21,6 +23,6 @@ class Paystack extends Facade
*/
protected static function getFacadeAccessor()
{
return 'laravel-paystack';
return 'paystack';
}
}
28 changes: 28 additions & 0 deletions src/Facades/PaystackV1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Laravel Paystack package.
*
* (c) Prosper Otemuyiwa <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Unicodeveloper\Paystack\Facades;

use Illuminate\Support\Facades\Facade;

class PaystackV1 extends Facade
{
/**
* Get the registered name of the component
* @return string
*/
protected static function getFacadeAccessor()
{
return 'laravel-paystack';
}
}
12 changes: 12 additions & 0 deletions src/Helpers/HelpsRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Unicodeveloper\Paystack\Helpers;

trait HelpsRequest {
public function addRequestData(array $args)
{
foreach ($args as $key => $data) {
request()->request->add([$key => $data]);
}
}
}
Loading