Skip to content

Commit

Permalink
Merge branch 'main' of github.com:mortenebak/laravel-quickpay
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenebak committed Jan 7, 2024
2 parents 0cfc468 + 98c31f9 commit 4a74978
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/Exceptions/CardNotAccepted.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class CardNotAccepted extends Exception
{

}
1 change: 0 additions & 1 deletion src/Exceptions/ConfigNotCorrect.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class ConfigNotCorrect extends Exception
{

}
1 change: 0 additions & 1 deletion src/Exceptions/QuickPayTestNotAllowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class QuickPayTestNotAllowed extends Exception
{

}
1 change: 0 additions & 1 deletion src/Exceptions/QuickPayValidationError.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class QuickPayValidationError extends Exception
{

}
7 changes: 3 additions & 4 deletions src/Quickpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public function __construct()
$credentials = null;

if (config('quickpay.api_key')) {
$credentials = ":" . config('quickpay.api_key');
} else if (config('quickpay.login') && config('quickpay.password')) {
$credentials = ':'.config('quickpay.api_key');
} elseif (config('quickpay.login') && config('quickpay.password')) {
$credentials = sprintf('%s:%s', config('quickpay.login'), config('quickpay.password'));
}

if (!$credentials) {
if (! $credentials) {
throw new ConfigNotCorrect('You should specify an `api_key` or `login` and `password` in the `quickpay` config file');
}

Expand Down Expand Up @@ -65,5 +65,4 @@ public function fees(): FeeResource
client: $this->client
);
}

}
1 change: 0 additions & 1 deletion src/QuickpayServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

class QuickpayServiceProvider extends PackageServiceProvider
{

protected bool $defer = true;

public function configurePackage(Package $package): void
Expand Down
7 changes: 1 addition & 6 deletions src/Resources/Concerns/QuickpayApiConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ public function __construct(QuickPay $client)
}

/**
* @param string $method
* @param string $endpoint
* @param array $data
* @return object
* @throws CardNotAccepted
* @throws QuickPayValidationError
*/
Expand All @@ -36,7 +32,7 @@ public function request(string $method, string $endpoint, array $data = []): obj
$data = $response->asObject();

// if app is in production mode, and the request is not a test, and the card is not accepted, throw an exception
if (config('app.env') === 'production' && !$data->test_mode && !$data->accepted) {
if (config('app.env') === 'production' && ! $data->test_mode && ! $data->accepted) {
throw new CardNotAccepted(
message: 'You cannot use test cards in production mode.',
code: 402
Expand All @@ -51,5 +47,4 @@ public function request(string $method, string $endpoint, array $data = []): obj
);
}
}

}
2 changes: 0 additions & 2 deletions src/Resources/PaymentResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,4 @@ public function createFraudConfirmationReport($id)
{

}


}

0 comments on commit 4a74978

Please sign in to comment.