Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Commands/RefreshBalance.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RefreshBalance extends Command
*/
public function handle(): void
{
DB::transaction(static function () {
DB::transaction(static function() {
$wallet = config('wallet.wallet.table');
$trans = config('wallet.transaction.table');

Expand All @@ -43,7 +43,7 @@ public function handle(): void
->where('confirmed', true)
->groupBy('wallet_id');

$joinClause = static function (JoinClause $join) use ($wallet) {
$joinClause = static function(JoinClause $join) use ($wallet) {
$join->on("$wallet.id", '=', 'b.wallet_id');
};

Expand Down
2 changes: 1 addition & 1 deletion src/Services/CommonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function multiOperation(Wallet $self, array $operations): array
public function assemble(array $brings): array
{
$self = $this;
return DB::transaction(static function () use ($self, $brings) {
return DB::transaction(static function() use ($self, $brings) {
return $self->multiBrings($brings);
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/Services/WalletService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function fee(Wallet $wallet, int $amount): int
$result = 0;

if ($wallet instanceof Taxable) {
$result = (int)($amount * $wallet->getFeePercent() / 100);
$result = (int) ($amount * $wallet->getFeePercent() / 100);

/**
* Added minimum commission condition
Expand Down Expand Up @@ -97,7 +97,7 @@ public function getBalance(Wallet $object): int
$wallet = $this->getWallet($object);
$proxy = app(ProxyService::class);
if (!$proxy->has($wallet->getKey())) {
$proxy->set($wallet->getKey(), (int)$wallet->getOriginal('balance', 0));
$proxy->set($wallet->getKey(), (int) $wallet->getOriginal('balance', 0));
}

return $proxy[$wallet->getKey()];
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/CanConfirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait CanConfirm
public function confirm(Transaction $transaction): bool
{
$self = $this;
return DB::transaction(static function () use ($self, $transaction) {
return DB::transaction(static function() use ($self, $transaction) {
$wallet = app(WalletService::class)
->getWallet($self);

Expand Down Expand Up @@ -63,7 +63,7 @@ public function safeConfirm(Transaction $transaction): bool
public function forceConfirm(Transaction $transaction): bool
{
$self = $this;
return DB::transaction(static function () use ($self, $transaction) {
return DB::transaction(static function() use ($self, $transaction) {

$wallet = app(WalletService::class)
->getWallet($self);
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/CanExchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function forceExchange(Wallet $to, int $amount, ?array $meta = null): Tra
*/
$from = app(WalletService::class)->getWallet($this);

return DB::transaction(static function () use ($from, $to, $amount, $meta) {
return DB::transaction(static function() use ($from, $to, $amount, $meta) {
$rate = app(ExchangeService::class)->rate($from, $to);
$fee = app(WalletService::class)->fee($to, $amount);

Expand Down
6 changes: 3 additions & 3 deletions src/Traits/CartPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function payFreeCart(Cart $cart): array
->verifyWithdraw($this, 0);

$self = $this;
return DB::transaction(static function () use ($self, $cart) {
return DB::transaction(static function() use ($self, $cart) {
$results = [];
foreach ($cart->getItems() as $product) {
$results[] = app(CommonService::class)->forceTransfer(
Expand Down Expand Up @@ -75,7 +75,7 @@ public function payCart(Cart $cart, bool $force = null): array
}

$self = $this;
return DB::transaction(static function () use ($self, $cart, $force) {
return DB::transaction(static function() use ($self, $cart, $force) {
$results = [];
foreach ($cart->getItems() as $product) {
if ($force) {
Expand Down Expand Up @@ -138,7 +138,7 @@ public function safeRefundCart(Cart $cart, bool $force = null, bool $gifts = nul
public function refundCart(Cart $cart, bool $force = null, bool $gifts = null): bool
{
$self = $this;
return DB::transaction(static function () use ($self, $cart, $force, $gifts) {
return DB::transaction(static function() use ($self, $cart, $force, $gifts) {
$results = [];
$transfers = $cart->alreadyBuy($self, $gifts);
if (count($transfers) !== count($cart)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasGift.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function gift(Wallet $to, Product $product, bool $force = null): Transfer
* I think it is wrong to make the "assemble" method public.
* That's why I address him like this!
*/
return DB::transaction(static function () use ($santa, $to, $product, $force) {
return DB::transaction(static function() use ($santa, $to, $product, $force) {
$amount = $product->getAmountProduct();
$meta = $product->getMetaProduct();
$fee = app(WalletService::class)
Expand Down
6 changes: 3 additions & 3 deletions src/Traits/HasWallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ trait HasWallet
public function deposit(int $amount, ?array $meta = null, bool $confirmed = true): Transaction
{
$self = $this;
return DB::transaction(static function () use ($self, $amount, $meta, $confirmed) {
return DB::transaction(static function() use ($self, $amount, $meta, $confirmed) {
return app(CommonService::class)
->deposit($self, $amount, $meta, $confirmed);
});
Expand Down Expand Up @@ -156,7 +156,7 @@ public function canWithdraw(int $amount): bool
public function forceWithdraw(int $amount, ?array $meta = null, bool $confirmed = true): Transaction
{
$self = $this;
return DB::transaction(static function () use ($self, $amount, $meta, $confirmed) {
return DB::transaction(static function() use ($self, $amount, $meta, $confirmed) {
return app(CommonService::class)
->forceWithdraw($self, $amount, $meta, $confirmed);
});
Expand All @@ -174,7 +174,7 @@ public function forceWithdraw(int $amount, ?array $meta = null, bool $confirmed
public function forceTransfer(Wallet $wallet, int $amount, ?array $meta = null): Transfer
{
$self = $this;
return DB::transaction(static function () use ($self, $amount, $wallet, $meta) {
return DB::transaction(static function() use ($self, $amount, $wallet, $meta) {
return app(CommonService::class)
->forceTransfer($self, $wallet, $amount, $meta);
});
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasWallets.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function createWallet(array $data): WalletModel
*/
public function hasWallet(string $slug): bool
{
return (bool)$this->getWallet($slug);
return (bool) $this->getWallet($slug);
}

}