File tree Expand file tree Collapse file tree 9 files changed +277
-0
lines changed Expand file tree Collapse file tree 9 files changed +277
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ \. idea /
3+ composer.lock
4+ vendor /
Original file line number Diff line number Diff line change 1+ language : php
2+ php :
3+ - 7.1
4+ - 7.2
5+ - 7.3
6+
7+ sudo : false
8+
9+ cache :
10+ directories :
11+ - vendor
12+ - $HOME/.composer/cache
13+
14+ install :
15+ - composer install
Original file line number Diff line number Diff line change 1+ # Changelog
2+ All notable changes to this project will be documented in this file.
3+
4+ The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
5+ and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
6+
7+ ## [ Unreleased]
8+
9+ ## [ 0.1.0] - 2019-02-28
10+ ### Added
11+ - A new facade to wrap the client
12+ - The basic Service Provider
13+ - Basic project structure
14+ - The basic Gocardless config file
15+ - Basic Facade unit test
16+
17+ ### Changed
18+
19+ ### Removed
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " Nestednet/gocardless-laravel" ,
3+ "description" : " GoCardless Pro PHP Client package integration for Laravel." ,
4+ "keywords" : [
5+ " php" ,
6+ " nestednet" ,
7+ " laravel" ,
8+ " gocardless"
9+ ],
10+ "license" : " MIT" ,
11+ "authors" : [
12+ {
13+ "name" : " Nested" ,
14+ 15+ "homepage" : " https://nested.net"
16+ }
17+ ],
18+ "require" : {
19+ "php" : " >=7.1.3" ,
20+ "illuminate/support" : " 5.6.*" ,
21+ "gocardless/gocardless-pro" : " ^3.0"
22+ },
23+ "require-dev" : {
24+ "phpunit/phpunit" : " ~7.0"
25+ },
26+ "autoload" : {
27+ "psr-4" : {
28+ "Nestednet\\ Gocardless\\ Laravel\\ " : " src/"
29+ }
30+ },
31+ "extra" : {
32+ "laravel" : {
33+ "providers" : [
34+ " Nestednet\\ Gocardless\\ Laravel\\ GocardlessServiceProvider"
35+ ],
36+ "aliases" : {
37+ "Stripe" : " Nestednet\\ Gocardless\\ Laravel\\ Gocardless"
38+ }
39+ }
40+ },
41+ "minimum-stability" : " stable"
42+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <phpunit bootstrap =" vendor/autoload.php"
3+ backupGlobals =" false"
4+ backupStaticAttributes =" false"
5+ colors =" true"
6+ verbose =" true"
7+ convertErrorsToExceptions =" true"
8+ convertNoticesToExceptions =" true"
9+ convertWarningsToExceptions =" true"
10+ processIsolation =" false"
11+ stopOnFailure =" false"
12+ >
13+ <testsuites >
14+ <testsuite name =" Gocardless Laravel Package Test Suite" >
15+ <directory suffix =" Test.php" >./tests/</directory >
16+ </testsuite >
17+ </testsuites >
18+ <filter >
19+ <whitelist >
20+ <directory suffix =" .php" >src/</directory >
21+ <exclude >
22+ <file >./src/GocardlessServiceProvider.php</file >
23+ </exclude >
24+ </whitelist >
25+ </filter >
26+ </phpunit >
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Part of the GoCardless Pro PHP Client package integration for Laravel
4+ *
5+ * NOTICE OF LICENSE
6+ *
7+ * Licensed under the MIT License.
8+ *
9+ * This source file is subject to the MIT License that is
10+ * bundled with this package in the LICENSE file.
11+ *
12+ * @package Gocardless Laravel
13+ * @version 0.1.0
14+ * @author Nested.net
15+ * @license MIT
16+ * @link https://nested.net
17+ */
18+
19+ namespace Nestednet \Gocardless \Laravel \Facades ;
20+
21+ use Illuminate \Support \Facades \Facade ;
22+
23+ class Gocardless extends Facade
24+ {
25+ /**
26+ * {@inheritDoc}
27+ */
28+ protected static function getFacadeAccessor ()
29+ {
30+ return 'gocardless ' ;
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Part of the GoCardless Pro PHP Client package integration for Laravel
4+ *
5+ * NOTICE OF LICENSE
6+ *
7+ * Licensed under the MIT License.
8+ *
9+ * This source file is subject to the MIT License that is
10+ * bundled with this package in the LICENSE file.
11+ *
12+ * @package Gocardless Laravel
13+ * @version 0.1.0
14+ * @author Nested.net
15+ * @license MIT
16+ * @link https://nested.net
17+ */
18+
19+ namespace Nestednet \Gocardless \Laravel ;
20+
21+ use GoCardlessPro \Client ;
22+ use Illuminate \Support \ServiceProvider ;
23+
24+ class GocardlessServiceProvider extends ServiceProvider
25+ {
26+ /**
27+ * {@inheritDoc}
28+ */
29+ public function register ()
30+ {
31+ $ this ->registerGocardless ();
32+ }
33+
34+ /**
35+ * {@inheritDoc}
36+ */
37+ public function provides ()
38+ {
39+ return [
40+ 'gocardless ' ,
41+ ];
42+ }
43+
44+ /**
45+ * Register the Stripe API class.
46+ *
47+ * @return void
48+ */
49+ protected function registerGocardless ()
50+ {
51+ $ this ->app ->singleton ('gocardless ' , function ($ app ) {
52+ $ config = $ app ['config ' ]->get ('gocardless ' );
53+ $ token = isset ($ config ['token ' ]) ? $ config ['token ' ] : null ;
54+ $ environment = isset ($ config ['environment ' ]) ? $ config ['environment ' ] : null ;
55+ return new Client ( array (
56+ 'access_token ' => $ token ,
57+ 'environment ' => $ environment
58+ ));
59+ });
60+ $ this ->app ->alias ('gocardless ' , 'GoCardlessPro\Client ' );
61+ }
62+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Part of the GoCardless Pro PHP Client package integration for Laravel
4+ *
5+ * NOTICE OF LICENSE
6+ *
7+ * Licensed under the MIT License.
8+ *
9+ * This source file is subject to the MIT License that is
10+ * bundled with this package in the LICENSE file.
11+ *
12+ * @package Gocardless Laravel
13+ * @version 0.1.0
14+ * @author Nested.net
15+ * @license MIT
16+ * @link https://nested.net
17+ */
18+
19+ return [
20+
21+ /**
22+ * The environment of the Gocardless API that you want to use.
23+ * 'SANDBOX' || 'LIVE'
24+ */
25+ 'environment ' => env ('GOCARDLESS_ENVIRONMENT ' , 'SANDBOX ' ),
26+
27+ /**
28+ * Your Gocardless API token.
29+ */
30+ 'token ' => env ('GOCARDLESS_ENVIRONMENT ' ),
31+ ];
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Part of the GoCardless Pro PHP Client package integration for Laravel
4+ *
5+ * NOTICE OF LICENSE
6+ *
7+ * Licensed under the MIT License.
8+ *
9+ * This source file is subject to the MIT License that is
10+ * bundled with this package in the LICENSE file.
11+ *
12+ * @package Gocardless Laravel
13+ * @version 0.1.0
14+ * @author Nested.net
15+ * @license MIT
16+ * @link https://nested.net
17+ */
18+
19+ namespace Nestednet \Gocardless \Tests ;
20+
21+ use ReflectionClass ;
22+ use PHPUnit \Framework \TestCase ;
23+
24+ class FacadeTest extends TestCase
25+ {
26+ /** @test */
27+ public function it_can_test_it_is_a_facade ()
28+ {
29+ $ facade = new ReflectionClass ('Illuminate\Support\Facades\Facade ' );
30+
31+ $ reflection = new ReflectionClass ('Nestednet\Gocardless\Laravel\Facades\Gocardless ' );
32+
33+ $ this ->assertTrue ($ reflection ->isSubclassOf ($ facade ));
34+ }
35+
36+ /** @test */
37+ public function it_can_test_it_is_a_facade_accessor ()
38+ {
39+ $ reflection = new ReflectionClass ('Nestednet\Gocardless\Laravel\Facades\Gocardless ' );
40+
41+ $ method = $ reflection ->getMethod ('getFacadeAccessor ' );
42+ $ method ->setAccessible (true );
43+
44+ $ this ->assertEquals ('gocardless ' , $ method ->invoke (null ));
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments