Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rap2hpoutre committed Nov 28, 2017
1 parent 3f2f3d5 commit ec16895
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor
/.idea
build
23 changes: 23 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
68 changes: 37 additions & 31 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="./vendor/autoload.php" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false">
<testsuites>
<testsuite name="all">
<directory suffix="Test.php">tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<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-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
26 changes: 26 additions & 0 deletions src/StripeConnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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);
Expand Down
19 changes: 19 additions & 0 deletions tests/TransactionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
namespace Rap2hpoutre\LaravelStripeConnect\Tests;

use PHPUnit\Framework\TestCase;
use Rap2hpoutre\LaravelStripeConnect\StripeConnect;
use Rap2hpoutre\LaravelStripeConnect\Transaction;

/**
* Class JackyTest
* @package Rap2hpoutre\LaravelCreditCardValidator\Test
*/
class ValidatorTest extends TestCase
{
public function testSetters()
{
$transaction = StripeConnect::transaction()->fee(35)->amount(1000, 'usd');
$this->assertInstanceOf(Transaction::class, $transaction);
}
}

0 comments on commit ec16895

Please sign in to comment.