|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace Shopware\Core\Checkout\Customer\Event; |
|
4
|
|
|
|
|
5
|
|
|
use Shopware\Core\Checkout\Customer\CustomerDefinition; |
|
6
|
|
|
use Shopware\Core\Checkout\Customer\CustomerEntity; |
|
|
|
|
|
|
7
|
|
|
use Shopware\Core\Content\Flow\Dispatching\Action\FlowMailVariables; |
|
8
|
|
|
use Shopware\Core\Content\Flow\Dispatching\Aware\ConfirmUrlAware; |
|
9
|
|
|
use Shopware\Core\Content\Flow\Dispatching\Aware\ScalarValuesAware; |
|
10
|
|
|
use Shopware\Core\Framework\Context; |
|
11
|
|
|
use Shopware\Core\Framework\Event\CustomerAware; |
|
12
|
|
|
use Shopware\Core\Framework\Event\EventData\EntityType; |
|
13
|
|
|
use Shopware\Core\Framework\Event\EventData\EventDataCollection; |
|
14
|
|
|
use Shopware\Core\Framework\Event\EventData\MailRecipientStruct; |
|
15
|
|
|
use Shopware\Core\Framework\Event\EventData\ScalarValueType; |
|
16
|
|
|
use Shopware\Core\Framework\Event\MailAware; |
|
17
|
|
|
use Shopware\Core\Framework\Event\SalesChannelAware; |
|
18
|
|
|
use Shopware\Core\Framework\Log\Package; |
|
19
|
|
|
use Shopware\Core\System\SalesChannel\SalesChannelContext; |
|
20
|
|
|
use Symfony\Contracts\EventDispatcher\Event; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @deprecated tag:v6.6.0 - reason:class-hierarchy-change - ConfirmUrlAware is deprecated and will be removed in v6.6.0 |
|
24
|
|
|
*/ |
|
25
|
|
|
#[Package('customer-order')] |
|
26
|
|
|
class CustomerDoubleOptInRegistrationEvent extends Event implements SalesChannelAware, CustomerAware, MailAware, ConfirmUrlAware, ScalarValuesAware |
|
|
|
|
|
|
27
|
|
|
{ |
|
28
|
|
|
final public const EVENT_NAME = 'checkout.customer.double_opt_in_registration'; |
|
29
|
|
|
|
|
30
|
|
|
private ?MailRecipientStruct $mailRecipientStruct = null; |
|
31
|
|
|
|
|
32
|
|
|
public function __construct( |
|
33
|
|
|
private readonly CustomerEntity $customer, |
|
34
|
|
|
private readonly SalesChannelContext $salesChannelContext, |
|
35
|
|
|
private readonly string $confirmUrl |
|
36
|
|
|
) { |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public static function getAvailableData(): EventDataCollection |
|
40
|
|
|
{ |
|
41
|
|
|
return (new EventDataCollection()) |
|
42
|
|
|
->add('customer', new EntityType(CustomerDefinition::class)) |
|
43
|
|
|
->add('confirmUrl', new ScalarValueType(ScalarValueType::TYPE_STRING)); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function getName(): string |
|
47
|
|
|
{ |
|
48
|
|
|
return self::EVENT_NAME; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function getMailStruct(): MailRecipientStruct |
|
52
|
|
|
{ |
|
53
|
|
|
if (!$this->mailRecipientStruct instanceof MailRecipientStruct) { |
|
54
|
|
|
$this->mailRecipientStruct = new MailRecipientStruct([ |
|
55
|
|
|
$this->customer->getEmail() => $this->customer->getFirstName() . ' ' . $this->customer->getLastName(), |
|
56
|
|
|
]); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
return $this->mailRecipientStruct; |
|
|
|
|
|
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return array<string, scalar|array<mixed>|null> |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getValues(): array |
|
66
|
|
|
{ |
|
67
|
|
|
return [FlowMailVariables::CONFIRM_URL => $this->confirmUrl]; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function getCustomer(): CustomerEntity |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->customer; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function getConfirmUrl(): string |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->confirmUrl; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function getSalesChannelId(): string |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->salesChannelContext->getSalesChannel()->getId(); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function getContext(): Context |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->salesChannelContext->getContext(); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function getCustomerId(): string |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->getCustomer()->getId(); |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths