/** * @param Response\Data\Init|Response\Data\Payment|Response\Data\CancelInit|Response\Data\CancelPayment $bodyData * * @return string */ public function render($bodyData = null) { /** @var Response\Body\Xml */ $xml = new Response\Body\Xml(); $xml->appendErrorCode($this->errorCode); $xml->appendErrorDescription($this->errorDescription); if ($this->willCallback !== null) { $xml->appendWillCallback($this->willCallback); } $xml->appendSignature($this->calcSignature($bodyData)); if ($this->willCallback === null || $this->willCallback === false) { $xml->appendResponseBody(); } if ($bodyData !== null) { $this->renderXmlResponseBody($xml, $bodyData); } return $xml->saveXML(); }
/** * @param Body\Xml $xml * @param Data\CancelPayment $bodyData */ protected function renderXmlResponseBody(Body\Xml $xml, Data\CancelPayment $bodyData) { $xml->append($xml->responseBody(), 'Date', $bodyData->date->format('Y-m-d H:i:s')); $xml->append($xml->responseBody(), 'ExternalId', $bodyData->id); $xml->append($xml->responseBody(), 'Id', $bodyData->externalId); }
/** * @param Body\Xml $xml * @param Data\Init $bodyData */ protected function renderXmlResponseBody(Body\Xml $xml, Data\Init $bodyData) { $xml->append($xml->responseBody(), 'Amount', $bodyData->amount); $xml->append($xml->responseBody(), 'Date', $bodyData->date->format('Y-m-d H:i:s')); $xml->append($xml->responseBody(), 'ExternalId', $bodyData->id); $xml->append($xml->responseBody(), 'Info', $bodyData->info); $xml->append($xml->responseBody(), 'Id', $bodyData->externalId); }