Skip to content

Commit

Permalink
feat: add signup journey catering for consultants
Browse files Browse the repository at this point in the history
  • Loading branch information
fibble committed Aug 23, 2024
1 parent b430fda commit 8c487db
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
namespace Dvsa\Olcs\Api\Domain\CommandHandler\Email;

use Dvsa\Olcs\Api\Domain\Command\Result;
use Dvsa\Olcs\Api\Domain\ToggleAwareInterface;
use Dvsa\Olcs\Api\Domain\ToggleAwareTrait;
use Dvsa\Olcs\Api\Entity\System\FeatureToggle;
use Dvsa\Olcs\Transfer\Command\CommandInterface;
use Dvsa\Olcs\Api\Domain\CommandHandler\AbstractCommandHandler;

/**
* Send User Registered Email
*/
final class SendUserRegistered extends AbstractCommandHandler implements \Dvsa\Olcs\Api\Domain\EmailAwareInterface
final class SendUserRegistered extends AbstractCommandHandler implements \Dvsa\Olcs\Api\Domain\EmailAwareInterface, ToggleAwareInterface
{
use \Dvsa\Olcs\Api\Domain\EmailAwareTrait;
use ToggleAwareTrait;

protected $repoServiceName = 'User';

Expand All @@ -35,9 +39,14 @@ public function handleCommand(CommandInterface $command)

$message->setTranslateToWelsh($user->getTranslateToWelsh());

$template = $this->toggleService->isEnabled(
FeatureToggle::TRANSPORT_CONSULTANT_ROLE)
? 'user-registered-tc' : 'user-registered';


$this->sendEmailTemplate(
$message,
'user-registered',
$template,
[
'orgName' => $user->getRelatedOrganisationName(),
'loginId' => $user->getLoginId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use Dvsa\Olcs\Transfer\Command\CommandInterface;
use Dvsa\Olcs\Transfer\Command\User\RegisterUserSelfserve as RegisterUserSelfserveCommand;
use Laminas\Authentication\Adapter\ValidatableAdapterInterface;
use Olcs\Logging\Log\Logger;

/**
* Register User Selfserve
Expand Down Expand Up @@ -129,8 +128,8 @@ public function handleCommand(CommandInterface $command)
)
);
}
} catch (\Exception $e) {
Logger::crit('Error sending email: ' . print_r($e->getMessage(), true));
} catch (\Exception) {
// swallow any exception
}

$result->addId('user', $user->getId());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<p>Hello,</p>

<p>You've been added to the Vehicle Operator Licensing service for <?php echo $this->escapeHtml($this->orgName); ?>.</p>

<p>Your username is: <?php echo $this->escapeHtml($this->loginId); ?></p>

<p>You'll receive a second email with a temporary password in the next two hours. If it doesn't arrive email notification@vehicle-operator-licensing.service.gov.uk</p>

<p>
<a href="<?php echo $this->escapeHtml($this->url); ?>">Sign in</a>
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Hello,

You've been added to the Vehicle Operator Licensing service for <?php echo $this->orgName; ?>.

Your username is: <?php echo $this->loginId; ?></p>

You'll receive a second email with a temporary password in the next two hours. If it doesn't arrive email notification@vehicle-operator-licensing.service.gov.uk

Sign in at <?php echo $this->url; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ public function operatorRepresentationAction()

return $this->prepareView('olcs/user-registration/index', [
'form' => $form,
'pageTitle' => 'operator-representation.page.title' // Set appropriate title if needed
]);
}

Expand Down

0 comments on commit 8c487db

Please sign in to comment.