@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | trait CanPay { |
12 | 12 | public function pay(Product $product, string $action = Transfer::ACTION_PAID, bool $force = false): Transfer |
13 | 13 | { |
14 | - if (! $product->canBePaid($this, $force)) { |
|
14 | + if (!$product->canBePaid($this, $force)) { |
|
15 | 15 | throw new ProductEnded(trans('wallet::errors.product_stock')); |
16 | 16 | } |
17 | 17 | |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | { |
61 | 61 | $transfer = $this->paid($product, $action); |
62 | 62 | |
63 | - if (! $transfer) { |
|
63 | + if (!$transfer) { |
|
64 | 64 | throw (new ModelNotFoundException()) |
65 | 65 | ->setModel(config('wallet.transfer.model')); |
66 | 66 | } |
67 | 67 | |
68 | - return \DB::transaction(function () use ($transfer) { |
|
68 | + return \DB::transaction(function() use ($transfer) { |
|
69 | 69 | $transfer->withdraw->update([ |
70 | 70 | 'confirmed' => false, |
71 | 71 | ]); |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | |
20 | 20 | public function getWallet(string $currency): ?Wallet |
21 | 21 | { |
22 | - if (! in_array($currency, config('wallet.currencies'))) { |
|
22 | + if (!in_array($currency, config('wallet.currencies'))) { |
|
23 | 23 | throw new CurrencyInvalid(trans('wallet::errors.currency_unsupported')); |
24 | 24 | } |
25 | 25 | |
26 | 26 | $wallet = $this->wallets()->where('currency', $currency)->first(); |
27 | 27 | |
28 | - if (! $wallet) { |
|
28 | + if (!$wallet) { |
|
29 | 29 | $wallet = $this->wallets()->create([ |
30 | 30 | 'currency' => $currency, |
31 | 31 | 'balance' => 0 |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | { |
65 | 65 | $transfer = $this->paid($product, $action); |
66 | 66 | |
67 | - if (! $transfer) { |
|
67 | + if (!$transfer) { |
|
68 | 68 | throw (new ModelNotFoundException()) |
69 | 69 | ->setModel(config('wallet.transfer.model')); |
70 | 70 | } |
71 | 71 | |
72 | - return \DB::transaction(function () use ($transfer) { |
|
72 | + return \DB::transaction(function() use ($transfer) { |
|
73 | 73 | $transfer->withdraw->update([ |
74 | 74 | 'confirmed' => false, |
75 | 75 | ]); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | if (\function_exists('config_path')) { |
21 | 21 | $this->publishes([ |
22 | - __DIR__ . '/../config/wallet.php' => config_path('wallet.php') |
|
22 | + __DIR__ . '/../config/wallet.php' => config_path('wallet.php') |
|
23 | 23 | ], 'wallet-config'); |
24 | 24 | } |
25 | 25 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * @param float $amount |
17 | 17 | * @return float |
18 | 18 | */ |
19 | - public static function fee(Transferable $transferable, Wallet $wallet,float $amount): float |
|
19 | + public static function fee(Transferable $transferable, Wallet $wallet, float $amount): float |
|
20 | 20 | { |
21 | 21 | if ($transferable instanceof Taxing) { |
22 | 22 | return (float) ($amount * $wallet->coefficient($wallet->currency) * $transferable->getFeePercent() / 100); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | protected function change(string $type, int $amount, ?array $meta, bool $confirmed): Transaction |
67 | 67 | { |
68 | - return DB::transaction(function () use ($type, $amount, $meta, $confirmed) { |
|
68 | + return DB::transaction(function() use ($type, $amount, $meta, $confirmed) { |
|
69 | 69 | if ($confirmed) { |
70 | 70 | $this->addBalance($amount); |
71 | 71 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $this->exists or $this->save(); |
103 | 103 | |
104 | - if (! WalletProxy::has($this->getKey())) { |
|
104 | + if (!WalletProxy::has($this->getKey())) { |
|
105 | 105 | $balance = $this->attributes['balance'] / $this->coefficient($this->attributes['currency']); |
106 | 106 | WalletProxy::set($this->getKey(), (float) ($balance ?? 0)); |
107 | 107 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $wallet = $transferable->getReceiptWallet($this->currency); |
124 | 124 | |
125 | - return DB::transaction(function () use ($transferable, $amount, $wallet, $meta, $action) { |
|
125 | + return DB::transaction(function() use ($transferable, $amount, $wallet, $meta, $action) { |
|
126 | 126 | $fee = Tax::fee($transferable, $wallet, $amount); |
127 | 127 | $withdraw = $this->withdraw($amount + $fee, $meta); |
128 | 128 | $deposit = $wallet->deposit($amount, $meta); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function withdraw(float $amount, ?array $meta = null, bool $confirmed = true): Transaction |
134 | 134 | { |
135 | - if (! $this->canWithdraw($amount)) { |
|
135 | + if (!$this->canWithdraw($amount)) { |
|
136 | 136 | throw new InsufficientFunds(trans('wallet::errors.insufficient_funds')); |
137 | 137 | } |
138 | 138 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | { |
175 | 175 | $wallet = $transferable->getReceiptWallet($this->currency); |
176 | 176 | |
177 | - return DB::transaction(function () use ($transferable, $amount, $wallet, $meta, $action) { |
|
177 | + return DB::transaction(function() use ($transferable, $amount, $wallet, $meta, $action) { |
|
178 | 178 | $fee = Tax::fee($transferable, $wallet, $amount); |
179 | 179 | $withdraw = $this->forceWithdraw($amount + $fee, $meta); |
180 | 180 | $deposit = $wallet->deposit($amount, $meta); |
@@ -203,6 +203,6 @@ discard block |
||
203 | 203 | |
204 | 204 | public function coefficient(string $currency = ''): float |
205 | 205 | { |
206 | - return config('wallet.coefficient.' . $currency , 100.); |
|
206 | + return config('wallet.coefficient.' . $currency, 100.); |
|
207 | 207 | } |
208 | 208 | } |