mirror of
https://github.com/bitinflow/accounts.git
synced 2026-03-13 13:35:52 +00:00
Refactoring
This commit is contained in:
34
src/Payments/Traits/Wallets.php
Normal file
34
src/Payments/Traits/Wallets.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Bitinflow\Payments\Traits;
|
||||
|
||||
use Bitinflow\Payments\Result;
|
||||
use Bitinflow\Payments\BitinflowPayments;
|
||||
|
||||
trait Wallets
|
||||
{
|
||||
/**
|
||||
* Get all wallets that belong to the user.
|
||||
*/
|
||||
public function getWallets(): Result
|
||||
{
|
||||
return $this->query('GET', 'wallets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default wallet to given wallet token.
|
||||
*
|
||||
* @param string $token default payment method token
|
||||
*/
|
||||
public function setDefaultWallet(string $token): Result
|
||||
{
|
||||
return $this->query('PUT', 'wallets/default', [], null, [
|
||||
'token' => $token
|
||||
]);
|
||||
}
|
||||
|
||||
public function getWalletSetupIntent(string $successUrl): string
|
||||
{
|
||||
return sprintf('%swallet/?continue_url=%s', config('bitinflow-accounts.payments.dashboard_url'), urlencode($successUrl));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user