Completed
Push — master ( ece0b7...b451f1 )
by Moecasts
07:43
created
src/Traits/HasWallets.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             ]);
Please login to merge, or discard this patch.
src/WalletServiceProvider.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Tax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
      * @param float $amount
17 17
      * @return float
18 18
      */
19
-    public static function fee(Assemblable $assemblable, Wallet $wallet,float $amount): float
19
+    public static function fee(Assemblable $assemblable, Wallet $wallet, float $amount): float
20 20
     {
21 21
         if ($assemblable instanceof Taxing) {
22 22
             return (float) ($amount * $wallet->coefficient($wallet->currency) * $assemblable->getFeePercent() / 100);
Please login to merge, or discard this patch.
src/Models/Wallet.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     protected function change(string $type, int $amount, ?array $meta, bool $confirmed): Transaction
70 70
     {
71
-        return DB::transaction(function () use ($type, $amount, $meta, $confirmed) {
71
+        return DB::transaction(function() use ($type, $amount, $meta, $confirmed) {
72 72
             if ($confirmed) {
73 73
                 $this->addBalance($amount);
74 74
             }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $this->exists or $this->save();
106 106
 
107
-        if (! WalletProxy::has($this->getKey())) {
107
+        if (!WalletProxy::has($this->getKey())) {
108 108
             $balance = $this->attributes['balance'] / $this->coefficient($this->attributes['currency']);
109 109
             WalletProxy::set($this->getKey(), (float) ($balance ?? 0));
110 110
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $wallet = $transferable->getReceiptWallet($this->currency);
127 127
 
128
-        return DB::transaction(function () use ($transferable, $amount, $wallet, $meta, $action) {
128
+        return DB::transaction(function() use ($transferable, $amount, $wallet, $meta, $action) {
129 129
             $fee = Tax::fee($transferable, $wallet, $amount);
130 130
             $withdraw = $this->withdraw($amount + $fee, $meta);
131 131
             $deposit = $wallet->deposit($amount, $meta);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
     public function withdraw(float $amount, ?array $meta = null, bool $confirmed = true): Transaction
137 137
     {
138
-        if (! $this->canWithdraw($amount)) {
138
+        if (!$this->canWithdraw($amount)) {
139 139
             throw new InsufficientFunds(trans('wallet::errors.insufficient_funds'));
140 140
         }
141 141
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     {
178 178
         $wallet = $transferable->getReceiptWallet($this->currency);
179 179
 
180
-        return DB::transaction(function () use ($transferable, $amount, $wallet, $meta, $action) {
180
+        return DB::transaction(function() use ($transferable, $amount, $wallet, $meta, $action) {
181 181
             $fee = Tax::fee($transferable, $wallet, $amount);
182 182
             $withdraw = $this->forceWithdraw($amount + $fee, $meta);
183 183
             $deposit = $wallet->deposit($amount, $meta);
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 
192 192
         $exchangeRate = config('wallet.exchange.' . $this->currency . '.' . $currency);
193 193
 
194
-        if (! $exchangeRate ||
195
-            ! $this->holder instanceof Exchangeable) {
194
+        if (!$exchangeRate ||
195
+            !$this->holder instanceof Exchangeable) {
196 196
             throw new ExchangeInvalid(trans('wallet::errors.exchange_unsupported'));
197 197
         }
198 198
 
199 199
         $exchangedAmount = $amount * $exchangeRate;
200 200
 
201
-        return DB::transaction(function () use ($wallet, $amount, $exchangedAmount, $meta, $action) {
201
+        return DB::transaction(function() use ($wallet, $amount, $exchangedAmount, $meta, $action) {
202 202
             $fee = Tax::fee($this->holder, $wallet, $amount);
203 203
             $withdraw = $this->withdraw($amount + $fee, $meta);
204 204
             $deposit = $wallet->deposit($exchangedAmount, $meta);
@@ -221,14 +221,14 @@  discard block
 block discarded – undo
221 221
 
222 222
         $exchangeRate = config('wallet.exchange.' . $this->currency . '.' . $currency);
223 223
 
224
-        if (! $exchangeRate ||
225
-            ! $this->holder instanceof Exchangeable) {
224
+        if (!$exchangeRate ||
225
+            !$this->holder instanceof Exchangeable) {
226 226
             throw new ExchangeInvalid(trans('wallet::errors.exchange_unsupported'));
227 227
         }
228 228
 
229 229
         $exchangedAmount = $amount * $exchangeRate;
230 230
 
231
-        return DB::transaction(function () use ($wallet, $amount, $exchangedAmount, $meta, $action) {
231
+        return DB::transaction(function() use ($wallet, $amount, $exchangedAmount, $meta, $action) {
232 232
             $fee = Tax::fee($this->holder, $wallet, $amount);
233 233
             $withdraw = $this->forceWithdraw($amount + $fee, $meta);
234 234
             $deposit = $wallet->deposit($exchangedAmount, $meta);
@@ -257,6 +257,6 @@  discard block
 block discarded – undo
257 257
 
258 258
     public function coefficient(string $currency = ''): float
259 259
     {
260
-        return config('wallet.coefficient.' . $currency , 100.);
260
+        return config('wallet.coefficient.' . $currency, 100.);
261 261
     }
262 262
 }
Please login to merge, or discard this patch.
src/Traits/CanPay.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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($action)) {
14
+        if (!$product->canBePaid($action)) {
15 15
             throw new ProductEnded(trans('wallet::errors.product_stock'));
16 16
         }
17 17
 
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $transfer = $this->paid($product, $action);
67 67
 
68
-        if (! $transfer) {
68
+        if (!$transfer) {
69 69
             throw (new ModelNotFoundException())
70 70
                 ->setModel(config('wallet.transfer.model'));
71 71
         }
72 72
 
73
-        return \DB::transaction(function () use ($transfer) {
73
+        return \DB::transaction(function() use ($transfer) {
74 74
             $transfer->withdraw->update([
75 75
                 'confirmed' => false,
76 76
             ]);
Please login to merge, or discard this patch.