getPendingRequest(); try { $body = $this->maskBody($response->json()); } catch (\JsonException) { $body = $response->body(); } $this->logger->info( "AlfaBank Response: {$response->status()} {$pendingRequest->getUrl()}", [ 'host' => $pendingRequest->getConnector()->resolveBaseUrl(), 'body' => $body, ] ); } protected function maskBody(mixed $body): mixed { if (! is_array($body)) { return $body; } $sensitiveKeys = ['pan', 'cvc', 'digestSignatures', 'client_secret', 'refresh_token', 'access_token']; foreach ($body as $key => $value) { if (in_array($key, $sensitiveKeys, true)) { $body[$key] = '*****'; } elseif (is_array($value)) { $body[$key] = $this->maskBody($value); } } return $body; } }