/** * Updates location * * @param Paysera_WalletApi_Entity_Location $location * * @return Paysera_WalletApi_Entity_Location * @throws Paysera_WalletApi_Exception_LogicException */ public function updateLocation(Paysera_WalletApi_Entity_Location $location) { if ($location->getId() === null) { throw new Paysera_WalletApi_Exception_LogicException("Location id has been not provided"); } $responseData = $this->put('location/' . $location->getId(), $this->mapper->encodeLocation($location)); return $this->mapper->decodeLocation($responseData); }
/** * Encode location * * @param Paysera_WalletApi_Entity_Location $object * * @return array */ public function encodeLocation(Paysera_WalletApi_Entity_Location $object) { $workingHours = array(); foreach ($object->getWorkingHours() as $dayWorkingHours) { $workingHours = array_merge($workingHours, $this->encodeDayWorkingHours($dayWorkingHours)); } $prices = array(); foreach ($object->getPrices() as $price) { $prices[] = $this->encodeLocationPrice($price); } $services = $this->encodeLocationServices($object->getServices(), $object->getPayCategories()); return array('id' => $object->getId(), 'title' => $object->getTitle(), 'description' => $object->getDescription(), 'address' => $object->getAddress(), 'lat' => $object->getLat(), 'lng' => $object->getLng(), 'radius' => $object->getRadius(), 'working_hours' => $workingHours, 'prices' => $prices, 'status' => $object->getStatus(), 'services' => $services, 'public' => $object->getPublic()); }