/**
  * @param Payone_TransactionStatus_Request_Interface $request
  * @return bool
  * @throws Payone_TransactionStatus_Exception_MissmatchingKeys
  */
 public function validateRequest(Payone_TransactionStatus_Request_Interface $request)
 {
     if ($request->getKey() !== $this->getKey()) {
         throw new Payone_TransactionStatus_Exception_MissmatchingKeys();
     }
     return true;
 }
Ejemplo n.º 2
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);
         }
     }
 }
 /**
  * @param Payone_TransactionStatus_Request_Interface $request
  * @param null|Payone_TransactionStatus_Response_Interface $response
  */
 public function protocol(Payone_TransactionStatus_Request_Interface $request, Payone_TransactionStatus_Response_Interface $response = null)
 {
     foreach ($this->loggers as $key => $logger) {
         /** @var $logger Payone_Protocol_Logger_Interface */
         $requestAsString = $request->__toString();
         $responseAsString = $response->__toString();
         $logger->log($requestAsString, Payone_Protocol_Logger_Interface::LEVEL_INFO);
         $logger->log($responseAsString, Payone_Protocol_Logger_Interface::LEVEL_INFO);
     }
     foreach ($this->repositories as $key => $repository) {
         /** @var $repository Payone_TransactionStatus_Persistence_Interface */
         $repository->save($request, $response);
     }
 }