Skip to content

Commit

Permalink
Add support for setting permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
hotmeteor committed Sep 3, 2022
1 parent fc93940 commit 4267cd7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
21 changes: 21 additions & 0 deletions config/phinch.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

return [

/*
|--------------------------------------------------------------------------
| Products
|--------------------------------------------------------------------------
|
| Here you may specify the products your app needs access to.
| All options are found in the Finch documentation:
| https://developer.tryfinch.com/docs/reference/ZG9jOjMxOTg1NTI3-permissions
|
*/

'products' => [
'company',
'directory',
'individual',
'employment',
'payment',
'pay_statement',
// 'benefits',
],

/*
|--------------------------------------------------------------------------
| Default API Version
Expand Down
7 changes: 4 additions & 3 deletions src/ConnectFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Phinch\Phinch;

use Illuminate\Contracts\Container\Container;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Str;
use Phinch\Connect\Connect;
Expand All @@ -13,10 +11,11 @@ class ConnectFactory
{
/**
* @param array $config
* @param array $products
* @param bool $sandbox
* @return Connect
*/
public static function make(array $config, bool $sandbox = false): Connect
public static function make(array $config, array $products = [], bool $sandbox = false): Connect
{
if (!Str::startsWith($redirect = $config['connect_redirect'], 'http')) {
$redirect = URL::to($redirect);
Expand All @@ -28,6 +27,8 @@ public static function make(array $config, bool $sandbox = false): Connect
$redirect,
);

$connect->products($products);

if ($sandbox) {
$connect->inSandbox();
}
Expand Down
1 change: 1 addition & 0 deletions src/PhinchServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function register()
$this->app->singleton(Connect::class, function ($app) {
return ConnectFactory::make(
config('services.finch'),
config('phinch.products'),
config('phinch.sandbox')
);
});
Expand Down

0 comments on commit 4267cd7

Please sign in to comment.