/** * @param IRequest $request * @throws LogicException * @return string */ private function checkAndGetRequestType(IRequest $request) { switch ($request->getType()) { case Request::CREATE_PAYMENT: case Request::PAYMENT_INFO: case Request::CONFIRM_PAYMENT: case Request::CANCEL_PAYMENT: return $request->getType(); default: throw new LogicException('Not supported request type'); } }
protected function getRequestParameters(IRequest $request) { $config = $this->connection->getConfig(); $parameters = $request->getParameters(); $parameters = array_filter($parameters, function ($value) { return $value !== NULL; }); $parameters['pos_id'] = $config->getPosId(); $parameters['sig'] = $request->getSig($config); if ($request->getType() === IRequest::CREATE_PAYMENT) { $parameters['pos_auth_key'] = $config->getPosAuthKey(); } return $parameters; }