8 use Psr\Log\LoggerInterface;
37 $responseInfo = $this->buildResponseInfo($responseStatus, $responseBody);
42 $this->writeToLog(
$info);
51 $exceptionInfo = $this->buildExceptionInfo($exception);
56 $this->writeToLog(
$info);
66 private function buildRequestInfo($requestUrl,
$requestData)
68 $infoContent = $this->buildInfoSection(
'URL', $requestUrl)
71 $info = $this->buildInfoSection(
'Request', $infoContent);
82 private function buildResponseInfo($responseStatus, $responseBody)
84 $infoContent = $this->buildInfoSection(
'Status', $responseStatus)
85 . $this->buildInfoSection(
'Body', $responseBody);
87 $info = $this->buildInfoSection(
'Response', $infoContent);
97 private function buildExceptionInfo(Exception $exception)
99 $infoContent = (string)$exception;
100 $info = $this->buildInfoSection(
'Exception', $infoContent);
110 private function writeToLog(
$info)
112 $logMessage = $this->buildInfoSection(
'Signifyd API integration debug info',
$info);
113 $this->logger->debug($logMessage);
125 $formattedInfo =
$title .
":\n" 126 . $this->addIndent(
$content) .
"\n";
127 return $formattedInfo;
137 private function addIndent(
$content, $indent =
' ')
139 $contentLines = explode(
"\n",
$content);
140 $contentLinesWithIndent = array_map(
function ($line) use ($indent) {
141 return $indent . $line;
143 $content = implode(
"\n", $contentLinesWithIndent);
__construct(LoggerInterface $logger)
failure($requestUrl, $requestData, Exception $exception)
success($requestUrl, $requestData, $responseStatus, $responseBody)
foreach($optionCollection as $option) $requestInfo
foreach( $_productCollection as $_product)() ?>" class $info