mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
[Payment] Keep EncryptionCheckTrait unchanged to prevent a BC break
This commit is contained in:
parent
fddb1d2374
commit
87c0a92377
3 changed files with 26 additions and 14 deletions
|
|
@ -20,16 +20,4 @@ trait EncryptionCheckTrait
|
|||
{
|
||||
return is_string($value) && str_ends_with($value, EncrypterInterface::ENCRYPTION_SUFFIX);
|
||||
}
|
||||
|
||||
/** @param array<array-key, mixed> $values */
|
||||
protected function allIsEncrypted(array $values): bool
|
||||
{
|
||||
foreach ($values as $value) {
|
||||
if (!$this->isEncrypted($value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ final readonly class GatewayConfigEncrypter implements EntityEncrypterInterface
|
|||
public function decrypt(EncryptionAwareInterface $resource): void
|
||||
{
|
||||
$config = $resource->getConfig();
|
||||
if (!$this->allIsEncrypted($config)) {
|
||||
if (!$this->isFullyEncrypted($config)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -62,4 +62,16 @@ final readonly class GatewayConfigEncrypter implements EntityEncrypterInterface
|
|||
$resource->setConfig($decryptedConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/** @param array<array-key, mixed> $values */
|
||||
private function isFullyEncrypted(array $values): bool
|
||||
{
|
||||
foreach ($values as $value) {
|
||||
if (!$this->isEncrypted($value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ final readonly class PaymentRequestEncrypter implements EntityEncrypterInterface
|
|||
}
|
||||
|
||||
$responseData = $resource->getResponseData();
|
||||
if (!$this->allIsEncrypted($responseData)) {
|
||||
if (!$this->isFullyEncrypted($responseData)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -70,4 +70,16 @@ final readonly class PaymentRequestEncrypter implements EntityEncrypterInterface
|
|||
$resource->setResponseData($decryptedRequestData);
|
||||
}
|
||||
}
|
||||
|
||||
/** @param array<array-key, mixed> $values */
|
||||
private function isFullyEncrypted(array $values): bool
|
||||
{
|
||||
foreach ($values as $value) {
|
||||
if (!$this->isEncrypted($value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue