Skip to content

Commit

Permalink
Fix method visibility, use enum
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhamp authored Mar 28, 2024
1 parent 920e58e commit b9bff60
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/Traits/Payable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

namespace SimonHamp\LaravelStripeConnect\Traits;

use Stripe\Account;
use Stripe\Balance;
use Stripe\Transfer;
use Stripe\StripeClient;

use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Config;
use SimonHamp\LaravelStripeConnect\Enums\LinkType;
use SimonHamp\LaravelStripeConnect\Interfaces\StripeConnect;
use Stripe\Account;
use Stripe\Balance;
use Stripe\Transfer;
use Stripe\StripeClient;

trait Payable
{
Expand Down Expand Up @@ -55,14 +57,14 @@ public function isStripeAccountActive()
/**
* Get the redirect URL needed to take this account through Stripe's onboarding flow
*/
public function getStripeAccountLink($type = 'account_onboarding'): string
public function getStripeAccountLink(LinkType $type = LinkType::Onboarding): string
{
$link = static::$stripe->accountLinks->create(
[
'account' => $this->getStripeAccountId(),
'refresh_url' => URL::route(Config::get('stripe_connect.routes.account.refresh')),
'return_url' => URL::route(Config::get('stripe_connect.routes.account.return')),
'type' => 'account_onboarding',
'type' => $type,
]
);

Expand All @@ -86,6 +88,13 @@ public function getAccountBalance(): Balance
]);
}

public function setStripeAccountStatus($status)
{
$this->{$this->getStripeAccountStatusColumn()} = $status;

return $this;
}

protected function getStripeAccountIdColumn()
{
return Config::get('stripe_connect.payable.account_id_column');
Expand All @@ -102,11 +111,4 @@ protected function getStripeAccountStatusColumn()
{
return Config::get('stripe_connect.payable.account_status_column');
}

protected function setStripeAccountStatus($status)
{
$this->{$this->getStripeAccountStatusColumn()} = $status;

return $this;
}
}

0 comments on commit b9bff60

Please sign in to comment.