/** * @service coupon read * @param Id * @return Gpf_Rpc_Data */ public function loadCouponsCount(Gpf_Rpc_Params $params) { $data = new Gpf_Rpc_Data($params); $coupon = new Pap_Features_Coupon_Coupon(); $coupon->setId($data->getId()); try { $coupon->load(); } catch (Gpf_DbEngine_NoRowException $e) { return $data; } $couponsUsed = $coupon->getCouponsCount(Gpf_Session::getAuthUser()->getPapUserId()); $data->setValue('usedcoupons', $couponsUsed); $data->setValue('availablecoupons', $this->computeAvailableCoupons($coupon, $couponsUsed)); $data->setValue('validcoupons', $coupon->getValidCouponsCount(Gpf_Session::getAuthUser()->getPapUserId())); return $data; }
/** * Load Location information for Ip address specified in Id * * @anonym * @service geoip read * @param $fields */ public function load(Gpf_Rpc_Params $params) { $data = new Gpf_Rpc_Data($params); $location = new GeoIp_Location(); $location->setIpString($data->getId()); $location->load(); $data->setValue('ip', $location->getIpString()); $data->setValue('countryCode', $location->getCountryCode()); $data->setValue('countryName', $location->getCountryName()); $data->setValue('city', $location->getCity()); $data->setValue('areaCode', $location->getAreaCode()); $data->setValue('dmaCode', $location->getDmaCode()); $data->setValue('latitude', $location->getLatitude()); $data->setValue('longitude', $location->getLongitude()); $data->setValue('postalCode', $location->getPostalCode()); $data->setValue('region', $location->getRegion()); return $data; }
/** * Load fileName for import * * @service export_file read * @param Gpf_Rpc_Params $params * @return Gpf_Rpc_Data */ public function loadFileName(Gpf_Rpc_Params $params) { $data = new Gpf_Rpc_Data($params); try { $export = new Gpf_Db_Export(); $export->setPrimaryKeyValue($data->getId()); $export->load(); $fileUrl = $this->getFileUrl($export->getFileName()); $data->setValue("fileName", $fileUrl); } catch (Gpf_DbEngine_NoRowException $e) { $data->setValue("fileName", ""); } return $data; }
/** * Returns general affiliate link * * @service general_link read */ public function getGeneralAffiliateLink(Gpf_Rpc_Params $params) { $response = new Gpf_Rpc_Data($params); $response->setValue("generalAffiliateLink", $this->getGeneralAffiliateLinkNoRpc($response->getId())); return $response; }