diff --git a/src/Accounts/Traits/BitinflowPaymentsWallet/Balance.php b/src/Accounts/Traits/BitinflowPaymentsWallet/Balance.php new file mode 100644 index 0000000..ab2c40f --- /dev/null +++ b/src/Accounts/Traits/BitinflowPaymentsWallet/Balance.php @@ -0,0 +1,57 @@ +user->getPaymentsUser()->data->balance; + } + + /** + * Deposit given amount from bank to account. + * + * @param float $amount + * @param string $description + * @return bool + */ + public function deposit(float $amount, string $decription): bool + { + $this->user->asPaymentsUser('PUT', sprintf('wallet/deposit', [ + 'amount' => $amount, + 'decription' => $decription, + ])); + } + + /** + * Charge given amount from account. + * + * @param float $amount + * @param string $decription + * @return bool + */ + public function charge(float $amount, string $decription): bool + { + $order = $this->user->orders()->create([ + 'name' => $decription, + 'description' => 'one-time payment', + 'amount' => 1, + 'price' => $amount, + ]); + + return $this->user->orders()->checkout($order->id); + } +}