From ec16895d580d17a7605ffb1d35bce1e5032f4218 Mon Sep 17 00:00:00 2001 From: rap2h Date: Tue, 28 Nov 2017 09:21:27 +0100 Subject: [PATCH] fix --- .gitignore | 1 + .scrutinizer.yml | 23 +++++++++++++ .travis.yml | 14 ++++++++ composer.lock | 68 +++++++++++++++++++++------------------ phpunit.xml | 20 ++++++++++++ src/StripeConnect.php | 26 +++++++++++++++ tests/TransactionTest.php | 19 +++++++++++ 7 files changed, 140 insertions(+), 31 deletions(-) create mode 100644 .scrutinizer.yml create mode 100644 .travis.yml create mode 100644 phpunit.xml create mode 100644 tests/TransactionTest.php diff --git a/.gitignore b/.gitignore index 5049f84..ca9098a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /vendor /.idea +build diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..516ca8b --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,23 @@ +filter: + excluded_paths: [tests, vendor] + +checks: + php: + remove_extra_empty_lines: true + remove_php_closing_tag: true + remove_trailing_whitespace: true + fix_use_statements: + remove_unused: true + preserve_multiple: false + preserve_blanklines: true + order_alphabetically: true + fix_php_opening_tag: true + fix_linefeed: true + fix_line_ending: true + fix_identation_4spaces: true + fix_doc_comments: true + +tools: + external_code_coverage: + timeout: 1800 + runs: 3 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..489dacc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: php + +php: + - 7 + +install: + - travis_retry composer install --no-interaction --prefer-source + +script: + - vendor/bin/phpunit + +after_script: + - wget https://scrutinizer-ci.com/ocular.phar + - php ocular.phar code-coverage:upload --format=php-clover coverage.clover \ No newline at end of file diff --git a/composer.lock b/composer.lock index 492dbe3..5ca2b12 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "03a376151438b5bcefa08b2dfb96f6cd", + "content-hash": "7167ca6332501501fc5759898eafcd58", "packages": [ { "name": "doctrine/inflector", @@ -865,29 +865,35 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.1.1", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" + "reference": "66465776cfc249844bde6d117abff1d22e06c2da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da", + "reference": "66465776cfc249844bde6d117abff1d22e06c2da", "shasum": "" }, "require": { "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/reflection-common": "^1.0.0", "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ @@ -906,7 +912,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-30T18:51:59+00:00" + "time": "2017-11-27T17:38:31+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -957,16 +963,16 @@ }, { "name": "phpspec/prophecy", - "version": "v1.7.2", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", "shasum": "" }, "require": { @@ -978,7 +984,7 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", "extra": { @@ -1016,20 +1022,20 @@ "spy", "stub" ], - "time": "2017-09-04T11:05:03+00:00" + "time": "2017-11-24T13:59:53+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "5.2.3", + "version": "5.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d" + "reference": "033ec97498cf530cc1be4199264cad568b19be26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d", - "reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/033ec97498cf530cc1be4199264cad568b19be26", + "reference": "033ec97498cf530cc1be4199264cad568b19be26", "shasum": "" }, "require": { @@ -1038,7 +1044,7 @@ "php": "^7.0", "phpunit/php-file-iterator": "^1.4.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0", + "phpunit/php-token-stream": "^2.0.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^3.0", "sebastian/version": "^2.0.1", @@ -1080,20 +1086,20 @@ "testing", "xunit" ], - "time": "2017-11-03T13:47:33+00:00" + "time": "2017-11-27T09:00:30+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -1127,7 +1133,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -1221,16 +1227,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0" + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9a02332089ac48e704c70f6cefed30c224e3c0b0", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { @@ -1266,7 +1272,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-08-20T05:47:52+00:00" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..8ceda85 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,20 @@ + + + + + tests/ + + + + + src/ + + + + + + + + + + \ No newline at end of file diff --git a/src/StripeConnect.php b/src/StripeConnect.php index ec6ff67..5021a89 100644 --- a/src/StripeConnect.php +++ b/src/StripeConnect.php @@ -8,14 +8,25 @@ use Stripe\Stripe as StripeBase; +/** + * Class StripeConnect + * @package Rap2hpoutre\LaravelStripeConnect + */ class StripeConnect { + /** + * + */ private static function prepare() { StripeBase::setApiKey(config('services.stripe.secret')); } + /** + * @param $user + * @return Stripe + */ private static function getStripeModel($user) { $s = Stripe::where('user_id', $user->id)->first(); @@ -27,6 +38,11 @@ private static function getStripeModel($user) return $s; } + /** + * @param $to + * @param array $params + * @return Stripe + */ public static function createAccount($to, $params = []) { self::prepare(); @@ -40,6 +56,12 @@ public static function createAccount($to, $params = []) return $vendor; } + /** + * @param $token + * @param $from + * @param array $params + * @return Stripe + */ public static function createCustomer($token, $from, $params = []) { self::prepare(); @@ -54,6 +76,10 @@ public static function createCustomer($token, $from, $params = []) return $customer; } + /** + * @param null $token + * @return Transaction + */ public static function transaction($token = null) { return new Transaction($token); diff --git a/tests/TransactionTest.php b/tests/TransactionTest.php new file mode 100644 index 0000000..4d6a2d0 --- /dev/null +++ b/tests/TransactionTest.php @@ -0,0 +1,19 @@ +fee(35)->amount(1000, 'usd'); + $this->assertInstanceOf(Transaction::class, $transaction); + } +} \ No newline at end of file