[Payment] Keep EncryptionCheckTrait unchanged to prevent a BC break

This commit is contained in:
Grzegorz Sadowski 2026-06-22 13:18:54 +02:00
parent fddb1d2374
commit 87c0a92377
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
3 changed files with 26 additions and 14 deletions

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}