| @@ 33-64 (lines=32) @@ | ||
| 30 | * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3) |
|
| 31 | * @link http://www.noovias.com |
|
| 32 | */ |
|
| 33 | class Payone_Api_Mapper_Response_GetFile |
|
| 34 | extends Payone_Api_Mapper_Response_Abstract |
|
| 35 | implements Payone_Api_Mapper_Response_Interface |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @param array $params |
|
| 40 | * |
|
| 41 | * @return Payone_Api_Response_Management_GetFile|Payone_Api_Response_Error |
|
| 42 | * @throws Payone_Api_Exception_UnknownStatus |
|
| 43 | */ |
|
| 44 | public function map(array $params) |
|
| 45 | { |
|
| 46 | $this->setParams($params); |
|
| 47 | ||
| 48 | if ($this->isError()) { |
|
| 49 | $response = new Payone_Api_Response_Error($params); |
|
| 50 | } |
|
| 51 | elseif (empty($params) || $this->isApproved() || $this->isBlocked() || $this->isEnrolled() || |
|
| 52 | $this->isInvalid() || $this->isRedirect() || $this->isValid() |
|
| 53 | ) { |
|
| 54 | throw new Payone_Api_Exception_UnknownStatus(); |
|
| 55 | } |
|
| 56 | else { |
|
| 57 | $params = array('response' => $params); |
|
| 58 | $response = new Payone_Api_Response_Management_GetFile($params); |
|
| 59 | $response->setStatus(Payone_Api_Enum_ResponseType::VALID); |
|
| 60 | } |
|
| 61 | ||
| 62 | return $response; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| @@ 33-64 (lines=32) @@ | ||
| 30 | * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3) |
|
| 31 | * @link http://www.noovias.com |
|
| 32 | */ |
|
| 33 | class Payone_Api_Mapper_Response_GetInvoice |
|
| 34 | extends Payone_Api_Mapper_Response_Abstract |
|
| 35 | implements Payone_Api_Mapper_Response_Interface |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @param array $params |
|
| 40 | * |
|
| 41 | * @return Payone_Api_Response_Capture_Approved|Payone_Api_Response_Error |
|
| 42 | * @throws Payone_Api_Exception_UnknownStatus |
|
| 43 | */ |
|
| 44 | public function map(array $params) |
|
| 45 | { |
|
| 46 | $this->setParams($params); |
|
| 47 | ||
| 48 | if ($this->isError()) { |
|
| 49 | $response = new Payone_Api_Response_Error($params); |
|
| 50 | } |
|
| 51 | elseif (empty($params) || $this->isApproved() || $this->isBlocked() || $this->isEnrolled() || |
|
| 52 | $this->isInvalid() || $this->isRedirect() || $this->isValid() |
|
| 53 | ) { |
|
| 54 | throw new Payone_Api_Exception_UnknownStatus(); |
|
| 55 | } |
|
| 56 | else { |
|
| 57 | $params = array('response' => $params); |
|
| 58 | $response = new Payone_Api_Response_Management_GetInvoice($params); |
|
| 59 | $response->setStatus(Payone_Api_Enum_ResponseType::VALID); |
|
| 60 | } |
|
| 61 | ||
| 62 | return $response; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||