Skip to content

Commit

Permalink
Merge branch 'main' of github.com:SSEsmaeeli/laravel-pay-pocket
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjad Esmaeely committed Dec 12, 2023
2 parents 013f24d + bf92ab1 commit 2b091e8
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1]
php: [8.3, 8.2, 8.1]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
include:
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/InsufficientBalanceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class InsufficientBalanceException extends Exception
* @param string $message
* @param int $code
*/
public function __construct($message = 'Insufficient balance to cover the order', $code = 0, \Throwable $previous = null)
public function __construct($message = 'Insufficient balance to cover the order', $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/InvalidDepositException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class InvalidDepositException extends Exception
* @param string $message
* @param int $code
*/
public function __construct($message = 'Invalid deposit operation', $code = 0, \Throwable $previous = null)
public function __construct($message = 'Invalid deposit operation', $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/InvalidValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class InvalidValueException extends Exception
* @param string $message
* @param int $code
*/
public function __construct($message = 'Invalie value to deposit', $code = 0, \Throwable $previous = null)
public function __construct($message = 'Invalie value to deposit', $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/InvalidWalletTypeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class InvalidWalletTypeException extends Exception
{
public function __construct($message = 'Invalid wallet type', $code = 0, \Throwable $previous = null)
public function __construct($message = 'Invalid wallet type', $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/WalletNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class WalletNotFoundException extends Exception
{
public function __construct($message = 'Wallet not found', $code = 0, \Throwable $previous = null)
public function __construct($message = 'Wallet not found', $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
6 changes: 2 additions & 4 deletions src/Traits/HandlesPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ trait HandlesPayment
/**
* Pay the order value from the user's wallets.
*
* @param int|float $orderValue
* @return void
*
* @throws InsufficientBalanceException
*/
Expand All @@ -24,9 +22,9 @@ public function pay(int|float $orderValue): void
DB::transaction(function () use ($orderValue) {
$remainingOrderValue = $orderValue;

$wallets = $this->wallets()->whereIn('type', $this->walletsInOrder())->get();
$walletsInOrder = $this->wallets()->whereIn('type', $this->walletsInOrder())->get();

foreach ($wallets as $wallet) {
foreach ($walletsInOrder as $wallet) {
if (! $wallet || ! $wallet->hasBalance()) {
continue;
}
Expand Down

0 comments on commit 2b091e8

Please sign in to comment.