Refactoring

This commit is contained in:
René Preuß
2022-10-01 14:00:25 +02:00
parent 7ba3cdffb0
commit a2405875ad
26 changed files with 569 additions and 391 deletions

View 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));
}
}