mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Provide post-CR fixes
This commit is contained in:
parent
852f2db9f5
commit
474f12a819
14 changed files with 82 additions and 42 deletions
|
|
@ -36,6 +36,18 @@
|
|||
}
|
||||
````
|
||||
|
||||
1. The constructor signature of `Sylius\Bundle\ApiBundle\Command\Account\VerifyCustomerAccount` changed:
|
||||
|
||||
````diff
|
||||
public function __construct(
|
||||
- public $token,
|
||||
+ public string $token,
|
||||
+ public ?string $channelCode = null,
|
||||
+ public ?string $localeCode = null,
|
||||
) {
|
||||
}
|
||||
````
|
||||
|
||||
1. The item operation paths for ProductVariantTranslation resource changed:
|
||||
|
||||
- `GET /admin/product-variant-translation/{id}` -> `GET /admin/product-variant-translations/{id}`
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Feature: Account registration
|
|||
Background:
|
||||
Given the store operates on a single channel in "United States"
|
||||
|
||||
@ui @api
|
||||
@ui @no-api
|
||||
Scenario: Registering a new account with minimum information when channel has enabled registration verification
|
||||
Given on this channel account verification is required
|
||||
When I want to register a new account
|
||||
|
|
@ -21,6 +21,19 @@ Feature: Account registration
|
|||
And I should be on registration thank you page
|
||||
But I should not be logged in
|
||||
|
||||
@api @no-ui
|
||||
Scenario: Registering a new account with minimum information when channel has enabled registration verification
|
||||
Given on this channel account verification is required
|
||||
When I want to register a new account
|
||||
And I specify the first name as "Saul"
|
||||
And I specify the last name as "Goodman"
|
||||
And I specify the email as "goodman@gmail.com"
|
||||
And I specify the password as "heisenberg"
|
||||
And I confirm this password
|
||||
And I register this account
|
||||
Then I should be notified that new account has been successfully created
|
||||
But I should not be logged in
|
||||
|
||||
@ui @api
|
||||
Scenario: Registering a new account with minimum information when channel has disabled registration verification
|
||||
Given on this channel account verification is not required
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ Feature: Registering a new account after checkout
|
|||
And the store allows paying Offline
|
||||
|
||||
@ui @no-api
|
||||
Scenario: Registering a new account after checkout when channel has enabled registration verification
|
||||
Scenario: Displaying thank you page after registration
|
||||
Given on this channel account verification is required
|
||||
Given I have product "PHP T-Shirt" in the cart
|
||||
And I have product "PHP T-Shirt" in the cart
|
||||
And I have completed addressing step with email "john@example.com" and "United States" based billing address
|
||||
And I have proceeded order with "Free" shipping method and "Offline" payment
|
||||
And I have confirmed order
|
||||
|
|
@ -22,13 +22,25 @@ Feature: Registering a new account after checkout
|
|||
And I confirm this password
|
||||
And I register this account
|
||||
Then I should be on registration thank you page
|
||||
When I verify my account using link sent to "john@example.com"
|
||||
|
||||
@ui @no-api
|
||||
Scenario: Registering a new account after checkout when channel has enabled registration verification
|
||||
Given on this channel account verification is required
|
||||
And I have product "PHP T-Shirt" in the cart
|
||||
And I have completed addressing step with email "john@example.com" and "United States" based billing address
|
||||
And I have proceeded order with "Free" shipping method and "Offline" payment
|
||||
And I have confirmed order
|
||||
When I proceed to the registration
|
||||
And I specify a password as "sylius"
|
||||
And I confirm this password
|
||||
And I register this account
|
||||
And I verify my account using link sent to "john@example.com"
|
||||
Then I should be able to log in as "john@example.com" with "sylius" password
|
||||
|
||||
@ui @no-api
|
||||
Scenario: Registering a new account after checkout when channel has disabled registration verification
|
||||
Given on this channel account verification is not required
|
||||
Given I have product "PHP T-Shirt" in the cart
|
||||
And I have product "PHP T-Shirt" in the cart
|
||||
And I have completed addressing step with email "john@example.com" and "United States" based billing address
|
||||
And I have proceeded order with "Free" shipping method and "Offline" payment
|
||||
And I have confirmed order
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ final class EmailContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @Then only one email should have been sent to :recipientEmail
|
||||
* @Then only one email should have been sent to :recipient
|
||||
*/
|
||||
public function onlyOneEmailShouldHaveBeenSentTo(string $recipient): void
|
||||
{
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ final class EmailContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @Then /^only one email should have been sent to "([^"]*)"$/
|
||||
* @Then only one email should have been sent to :recipient
|
||||
*/
|
||||
public function onlyOneEmailShouldHaveBeenSentTo(string $recipient): void
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ final class RegistrationAfterCheckoutContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should be on my account dashboard/
|
||||
* @Then I should be on my account dashboard
|
||||
*/
|
||||
public function iShouldBeOnMyAccountDashboard(): void
|
||||
{
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ class RegistrationContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should be on registration thank you page$/
|
||||
* @Then I should be on registration thank you page
|
||||
*/
|
||||
public function iShouldBeOnRegistrationThankYouPage(): void
|
||||
{
|
||||
|
|
@ -362,7 +362,7 @@ class RegistrationContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should be on my account dashboard$/
|
||||
* @Then I should be on my account dashboard
|
||||
*/
|
||||
public function iShouldBeOnMyAccountDashboard(): void
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,18 +13,42 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Bundle\ApiBundle\Command\Account;
|
||||
|
||||
use Sylius\Bundle\ApiBundle\Command\ChannelCodeAwareInterface;
|
||||
use Sylius\Bundle\ApiBundle\Command\LocaleCodeAwareInterface;
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class VerifyCustomerAccount
|
||||
class VerifyCustomerAccount implements ChannelCodeAwareInterface, LocaleCodeAwareInterface
|
||||
{
|
||||
/** @var string */
|
||||
public $token;
|
||||
public function __construct(
|
||||
public string $token,
|
||||
private ?string $localeCode = null,
|
||||
private ?string $channelCode = null,
|
||||
) {
|
||||
}
|
||||
|
||||
public function __construct(string $token)
|
||||
public function getChannelCode(): ?string
|
||||
{
|
||||
$this->token = $token;
|
||||
return $this->channelCode;
|
||||
}
|
||||
|
||||
public function setChannelCode(?string $channelCode): void
|
||||
{
|
||||
/** @psalm-suppress InaccessibleProperty */
|
||||
$this->channelCode = $channelCode;
|
||||
}
|
||||
|
||||
public function getLocaleCode(): ?string
|
||||
{
|
||||
return $this->localeCode;
|
||||
}
|
||||
|
||||
public function setLocaleCode(?string $localeCode): void
|
||||
{
|
||||
/** @psalm-suppress InaccessibleProperty */
|
||||
$this->localeCode = $localeCode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ use InvalidArgumentException;
|
|||
use Sylius\Bundle\ApiBundle\Command\Account\SendAccountRegistrationEmail;
|
||||
use Sylius\Bundle\ApiBundle\Command\Account\VerifyCustomerAccount;
|
||||
use Sylius\Calendar\Provider\DateTimeProviderInterface;
|
||||
use Sylius\Component\Channel\Context\ChannelContextInterface;
|
||||
use Sylius\Component\Core\Model\ShopUserInterface;
|
||||
use Sylius\Component\Locale\Context\LocaleContextInterface;
|
||||
use Sylius\Component\Resource\Repository\RepositoryInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||
|
|
@ -33,8 +31,6 @@ final class VerifyCustomerAccountHandler implements MessageHandlerInterface
|
|||
private RepositoryInterface $shopUserRepository,
|
||||
private DateTimeProviderInterface $calendar,
|
||||
private MessageBusInterface $commandBus,
|
||||
private ChannelContextInterface $channelContext,
|
||||
private LocaleContextInterface $localeContext,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -52,11 +48,8 @@ final class VerifyCustomerAccountHandler implements MessageHandlerInterface
|
|||
$user->setEmailVerificationToken(null);
|
||||
$user->enable();
|
||||
|
||||
$channel = $this->channelContext->getChannel();
|
||||
$localeCode = $this->localeContext->getLocaleCode();
|
||||
|
||||
$this->commandBus->dispatch(
|
||||
new SendAccountRegistrationEmail($user->getEmail(), $localeCode, $channel->getCode()),
|
||||
new SendAccountRegistrationEmail($user->getEmail(), $command->getLocaleCode(), $command->getChannelCode()),
|
||||
[new DispatchAfterCurrentBusStamp()]
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -214,8 +214,6 @@
|
|||
<argument type="service" id="sylius.repository.shop_user" />
|
||||
<argument type="service" id="Sylius\Calendar\Provider\DateTimeProviderInterface" />
|
||||
<argument type="service" id="sylius.command_bus" />
|
||||
<argument type="service" id="sylius.context.channel" />
|
||||
<argument type="service" id="sylius.context.locale" />
|
||||
<tag name="messenger.message_handler" bus="sylius.command_bus" />
|
||||
<tag name="messenger.message_handler" bus="sylius_default.bus" />
|
||||
</service>
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@ use Prophecy\Argument;
|
|||
use Sylius\Bundle\ApiBundle\Command\Account\SendAccountRegistrationEmail;
|
||||
use Sylius\Bundle\ApiBundle\Command\Account\VerifyCustomerAccount;
|
||||
use Sylius\Calendar\Provider\DateTimeProviderInterface;
|
||||
use Sylius\Component\Channel\Context\ChannelContextInterface;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Sylius\Component\Locale\Context\LocaleContextInterface;
|
||||
use Sylius\Component\Resource\Repository\RepositoryInterface;
|
||||
use Sylius\Component\User\Model\UserInterface;
|
||||
use Symfony\Component\Messenger\Envelope;
|
||||
|
|
@ -34,10 +31,8 @@ final class VerifyCustomerAccountHandlerSpec extends ObjectBehavior
|
|||
RepositoryInterface $shopUserRepository,
|
||||
DateTimeProviderInterface $dateTimeProvider,
|
||||
MessageBusInterface $commandBus,
|
||||
ChannelContextInterface $channelContext,
|
||||
LocaleContextInterface $localeContext,
|
||||
): void {
|
||||
$this->beConstructedWith($shopUserRepository, $dateTimeProvider, $commandBus, $channelContext, $localeContext);
|
||||
$this->beConstructedWith($shopUserRepository, $dateTimeProvider, $commandBus);
|
||||
}
|
||||
|
||||
function it_is_a_message_handler(): void
|
||||
|
|
@ -50,9 +45,6 @@ final class VerifyCustomerAccountHandlerSpec extends ObjectBehavior
|
|||
DateTimeProviderInterface $dateTimeProvider,
|
||||
UserInterface $user,
|
||||
MessageBusInterface $commandBus,
|
||||
ChannelContextInterface $channelContext,
|
||||
LocaleContextInterface $localeContext,
|
||||
ChannelInterface $channel,
|
||||
): void {
|
||||
$shopUserRepository->findOneBy(['emailVerificationToken' => 'ToKeN'])->willReturn($user);
|
||||
$dateTimeProvider->now()->willReturn(new \DateTime());
|
||||
|
|
@ -62,17 +54,12 @@ final class VerifyCustomerAccountHandlerSpec extends ObjectBehavior
|
|||
$user->setEmailVerificationToken(null)->shouldBeCalled();
|
||||
$user->enable()->shouldBeCalled();
|
||||
|
||||
$channel->getCode()->willReturn('WEB');
|
||||
|
||||
$channelContext->getChannel()->willReturn($channel);
|
||||
$localeContext->getLocaleCode()->willReturn('en_US');
|
||||
|
||||
$commandBus->dispatch(
|
||||
new SendAccountRegistrationEmail('shop@example.com', 'en_US', 'WEB'),
|
||||
[new DispatchAfterCurrentBusStamp()]
|
||||
)->willReturn(new Envelope(new \stdClass()));
|
||||
|
||||
$this(new VerifyCustomerAccount('ToKeN'));
|
||||
$this(new VerifyCustomerAccount('ToKeN', 'en_US', 'WEB'));
|
||||
}
|
||||
|
||||
function it_throws_error_if_user_does_not_exist(
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ final class RegistrationThankYouController
|
|||
if ($channel->isAccountVerificationRequired()) {
|
||||
return new Response($this->twig->render('@SyliusShop/registerThankYou.html.twig'));
|
||||
}
|
||||
|
||||
return new RedirectResponse($this->router->generate('sylius_shop_account_dashboard'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<h1 class="ui icon header">
|
||||
<i class="circular smile icon"></i>
|
||||
<div class="content">
|
||||
{{ 'sylius.ui.thank_you_for_register'|trans }}
|
||||
{{ 'sylius.ui.thank_you_for_registration'|trans }}
|
||||
<div class="sub header">{{ 'sylius.ui.verify_email_address'|trans }}</div>
|
||||
</div>
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -845,8 +845,8 @@ sylius:
|
|||
text: 'Text'
|
||||
textarea: 'Textarea'
|
||||
thank_you: 'Thank you!'
|
||||
thank_you_for_registration: 'Thank you for your registration'
|
||||
thank_you_for_your_order: 'Thank you for your order'
|
||||
thank_you_for_register: 'Thank you for your registration'
|
||||
the_instructions_below_will_be_displayed_to_the_customer: 'The instructions below will be displayed to the customer'
|
||||
the_page_you_are_looking_for_does_not_exist: 'The page you are looking for does not exist.'
|
||||
the_page_you_are_looking_for_is_forbidden: 'The page you are looking for is forbidden.'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue