Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

feat: subscription page #288

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
chore: php linting with pint
  • Loading branch information
djaiss authored and github-actions[bot] committed Jan 11, 2023
commit 893be903de68e3be5027e6d128439e02818bc9d5
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
class ActivateLicenceKey extends BaseService implements ServiceInterface
{
private Account $account;

private array $data;

private int $status;

private array $response;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

use App\Exceptions\CustomerPortalWrongCredentials;
use App\Exceptions\NoCustomerPortalSecretsException;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Cache;
use App\Interfaces\ServiceInterface;
use App\Services\BaseService;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;

class CallCustomerPortal extends BaseService implements ServiceInterface
{
Expand Down Expand Up @@ -62,7 +62,7 @@ private function validateEnvVariables(): void
private function getAccessToken(): string
{
return Cache::remember('customer_portal.access_token', 31449600 /* 364 days */, function () {
$url = config('monica.customer_portal_url') . '/oauth/token';
$url = config('monica.customer_portal_url').'/oauth/token';

$response = Http::asForm()->post($url, [
'grant_type' => 'client_credentials',
Expand All @@ -72,7 +72,7 @@ private function getAccessToken(): string
]);

$json = $response->json();
if ($response->failed() || !isset($json['access_token'])) {
if ($response->failed() || ! isset($json['access_token'])) {
throw new CustomerPortalWrongCredentials();
}

Expand All @@ -82,7 +82,7 @@ private function getAccessToken(): string

private function makeRequestToCustomerPortal(string $accessToken): Response
{
$url = config('monica.customer_portal_url') . '/api/validate';
$url = config('monica.customer_portal_url').'/api/validate';

return Http::withToken($accessToken)
->acceptJson()
Expand Down
6 changes: 3 additions & 3 deletions app/Providers/EncryptionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Providers;

use Illuminate\Support\Str;
use function Safe\base64_decode;
use App\Exceptions\MissingPrivateKeyException;
use Illuminate\Encryption\Encrypter;
use Illuminate\Support\ServiceProvider;
use App\Exceptions\MissingPrivateKeyException;
use Illuminate\Support\Str;
use function Safe\base64_decode;

class EncryptionServiceProvider extends ServiceProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

use App\Domains\Settings\ManageSubscription\Services\ActivateLicenceKey;
use App\Domains\Settings\ManageSubscription\Services\CallCustomerPortal;
use Tests\TestCase;
use Mockery\MockInterface;
use App\Exceptions\LicenceKeyDontExistException;
use App\Exceptions\LicenceKeyErrorException;
use App\Exceptions\LicenceKeyInvalidException;
use App\Exceptions\MissingPrivateKeyException;
use Illuminate\Validation\ValidationException;
use App\Exceptions\LicenceKeyDontExistException;
use App\Models\Account;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Validation\ValidationException;
use Mockery\MockInterface;
use Tests\TestCase;

class ActivateLicenceKeyTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
namespace Tests\Unit\Domains\Settings\ManageSubscription\Services;

use App\Domains\Settings\ManageSubscription\Services\CallCustomerPortal;
use Tests\TestCase;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Cache;
use Illuminate\Validation\ValidationException;
use App\Exceptions\NoCustomerPortalSetException;
use App\Exceptions\CustomerPortalWrongCredentials;
use App\Exceptions\NoCustomerPortalSecretsException;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
use Illuminate\Validation\ValidationException;
use Tests\TestCase;

class CallCustomerPortalTest extends TestCase
{
Expand Down