From 91bdad593f832adc45ca1423fb2193d3f2a49f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maurice=20Preu=C3=9F?= Date: Thu, 29 Sep 2022 14:41:26 +0200 Subject: [PATCH] Create Wallets.php --- .../BitinflowPaymentsWallet/Wallets.php | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/Accounts/Traits/BitinflowPaymentsWallet/Wallets.php diff --git a/src/Accounts/Traits/BitinflowPaymentsWallet/Wallets.php b/src/Accounts/Traits/BitinflowPaymentsWallet/Wallets.php new file mode 100644 index 0000000..d36da69 --- /dev/null +++ b/src/Accounts/Traits/BitinflowPaymentsWallet/Wallets.php @@ -0,0 +1,49 @@ +user->getPaymentsUser()->data->wallets; + } + + /** + * Check if user has an active wallet. + * + * @return bool + * @throws GuzzleException + */ + public function has(): ?bool + { + return $this->user->getPaymentsUser()->data->has_wallet; + } + + /** + * Set default wallet to given wallet token. + * + * @param string $token default payment method token + * @return bool + */ + public function setDefault(string $token): bool + { + $this->user->asPaymentsUser('PUT', sprintf('wallets/default', [ + 'token' => $token + ])); + + return true; + } +}