Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| VerifySeniorAuthenticationService | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| sync | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\User\Services; |
| 4 | |
| 5 | use App\Events\ServiceProcessed; |
| 6 | use App\Models\User; |
| 7 | use Domain\Login\Integrations\AuthenticateSenior; |
| 8 | use Domain\Shared\Integrations\Senior\Exceptions\IntegrationSoapSeniorException; |
| 9 | use Domain\Shared\Integrations\Senior\SeniorCredentialResolver; |
| 10 | use Illuminate\Auth\AuthenticationException; |
| 11 | use SoapFault; |
| 12 | |
| 13 | readonly class VerifySeniorAuthenticationService |
| 14 | { |
| 15 | /** |
| 16 | * @param User $user |
| 17 | * @throws AuthenticationException |
| 18 | * @throws IntegrationSoapSeniorException |
| 19 | * @throws SoapFault |
| 20 | */ |
| 21 | public static function sync(User $user): void |
| 22 | { |
| 23 | ['user' => $userSenior, 'password' => $passwordSenior] = (new SeniorCredentialResolver()) |
| 24 | ->resolveForUser($user); |
| 25 | |
| 26 | ServiceProcessed::dispatch(self::class, $user); |
| 27 | AuthenticateSenior::login($userSenior, $passwordSenior); |
| 28 | } |
| 29 | } |