/** * Update client * * @param Paysera_WalletApi_Entity_Client $client * * @return Paysera_WalletApi_Entity_Client */ public function updateClient(Paysera_WalletApi_Entity_Client $client) { $responseData = $this->put('client/' . $client->getId(), $this->mapper->encodeClient($client)); return $this->mapper->decodeClient($responseData); }
/** * Encodes client * * @param Paysera_WalletApi_Entity_Client $client * * @return array */ public function encodeClient(Paysera_WalletApi_Entity_Client $client) { if ($client->getMainProject() && $client->getMainProject()->getId()) { $projectId = $client->getMainProject()->getId(); } else { $projectId = $client->getMainProjectId(); } $result = array('type' => $client->getType()); if (count($client->getPermissions()->getScopes()) > 0) { $result['permissions'] = $this->encodeClientPermissions($client->getPermissions()); } if (!empty($projectId)) { $result['project_id'] = $projectId; } if (count($client->getHosts()) > 0) { $result['hosts'] = array(); foreach ($client->getHosts() as $host) { $result['hosts'][] = $this->encodeHost($host); } } return $result; }