/**
  * Building XML response.
  * @param  string $functionName  "checkOrder" or "paymentAviso" string
  * @param  string $invoiceId     transaction number
  * @param  string $result_code   result code
  * @param  string $message       error message. May be null.
  * @return string                prepared XML response
  */
 private function buildResponse($functionName, $invoiceId, $result_code, $message = null)
 {
     try {
         $performedDatetime = Utils::formatDate(new DateTime());
         $response = '<?xml version="1.0" encoding="UTF-8"?><' . $functionName . 'Response performedDatetime="' . $performedDatetime . '" code="' . $result_code . '" ' . ($message != null ? 'message="' . $message . '"' : "") . ' invoiceId="' . $invoiceId . '" shopId="' . $this->settings->SHOP_ID . '"/>';
         return $response;
     } catch (\Exception $e) {
         $this->log($e);
     }
     return null;
 }
 /**
  * Cancels a deferred payment.
  * @param  string|int $orderId transaction number of the deferred payment
  * @return string              response from Yandex.Money in XML format
  */
 public function cancelPayment($orderId)
 {
     $methodName = "cancelPayment";
     $this->log->info("Start " . $methodName);
     $dateTime = Utils::formatDate(new \DateTime());
     $requestParams = array('requestDT' => $dateTime, 'orderId' => $orderId);
     $result = $this->sendUrlEncodedRequest($methodName, $requestParams);
     $this->log->info($result);
     return $result;
 }