Exemplo n.º 1
0
 /**
  * @param Payone_TransactionStatus_Request_Interface $request
  * @param Payone_TransactionStatus_Response_Interface $response
  * @return boolean
  */
 public function save(Payone_TransactionStatus_Request_Interface $request, Payone_TransactionStatus_Response_Interface $response)
 {
     $factory = $this->getFactory();
     $domainObject = $factory->getModelTransactionStatus();
     /* map request to domain object */
     $data = $request->toArray();
     // UTF-8 encoding, PAYONE sends ISO-encoded TransactionStatus, we want to preserve special characters (e.g. Umlauts in clearing parameters)
     foreach ($data as $key => $value) {
         $data[$key] = utf8_encode($value);
     }
     $domainObject->setData($data);
     $domainObject->save();
 }
 /**
  * @param Exception $e
  * @param null|Payone_TransactionStatus_Request_Interface $request
  */
 public function protocolException(Exception $e, Payone_TransactionStatus_Request_Interface $request = null)
 {
     if ($request !== null) {
         $this->getServiceApplyFilters()->apply($request->toArray());
     }
     foreach ($this->loggers as $key => $logger) {
         /** @var $logger Payone_Protocol_Logger_Interface */
         $logger->log(get_class($e) . ' ' . $e->getMessage());
         if ($request !== null) {
             $requestAsString = $request->__toString();
             $logger->log($requestAsString, Payone_Protocol_Logger_Interface::LEVEL_ERROR);
         }
     }
 }