mirror of
https://github.com/anikeen-com/id.git
synced 2026-11-04 22:59:41 +00:00
refactor code
This commit is contained in:
1 parent
c641ec725d
commit
25248e7822
37 files changed
+180
-143
No files matched your search
@@ -2,13 +2,12 @@
|
||||
|
||||
namespace Anikeen\Id\Concerns;
|
||||
|
||||
use Anikeen\Id\ApiOperations\Request;
|
||||
use Anikeen\Id\Resources\Transaction;
|
||||
use Throwable;
|
||||
|
||||
trait ManagesBalance
|
||||
{
|
||||
use Request;
|
||||
use HasBillable;
|
||||
|
||||
/**
|
||||
* Get balance from the current user.
|
||||
@@ -40,10 +39,12 @@ trait ManagesBalance
|
||||
*/
|
||||
public function charge(float $amount, string $paymentMethodId, array $options = []): Transaction
|
||||
{
|
||||
return new Transaction(fn() => $this->request('POST', 'billing/charge', [
|
||||
'amount' => $amount,
|
||||
'payment_method_id' => $paymentMethodId,
|
||||
'options' => $options,
|
||||
]));
|
||||
return (new Transaction(fn() => $this->anikeenId()
|
||||
->request('POST', 'billing/charge', [
|
||||
'amount' => $amount,
|
||||
'payment_method_id' => $paymentMethodId,
|
||||
'options' => $options,
|
||||
])))
|
||||
->setBillable($this);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user