def _get_merchants(self, all=False): """ Cimri Service'den merchantlarin listesini alir @type all: bool @param all: eger dogru ise butun merchantlar alinir, aksi takdirde sadece aktif merchantlar alinir @rtype: list (L{cimri.api.cimriservice.data.merchant.MerchantInfo}) @return: merchant listesi """ self.logger.info("getting merchants...") # get active merchants api = MerchantsAPI() if all is True: merchants = api.get_merchants() else: merchants = api.get_merchants(status=MerchantInfo.STATUS_ACTIVE) if merchants is None: self._log_error("error getting cimri service merchant list") self.logger.warn("did not get any merchants from cimri-service") return [] self.logger.info("number of merchants retrieved: " + str(len(merchants))) # get only the active ones # merchants=[merchant for merchant in merchants if merchant.status==MerchantInfo.STATUS_ACTIVE] self.logger.info("number of active merchants found: " + str(len(merchants))) return merchants
def xmlrpc_getmerchants(self): """ XML-RPC uzerinden Cimri Service'de bulunan butun aktif merchantlarin listesini alir @rtype: list @return: sistemde bulunan aktif merchantlarin id ve isimlerini iceren bir liste """ api=MerchantsAPI() merchants=api.get_merchants(status=MerchantInfo.STATUS_ACTIVE) merchants.sort(lambda a,b:a.merchantName>b.merchantName) return [{"id":merchant.merchantId, "name":merchant.merchantName} for merchant in merchants]
def _get_merchant(self, id): """ Cimri service'den belli bir merchanti alir @type id: str @param id: merchant ID @rtype: L{cimri.api.cimriservice.data.merchant.MerchantInfo} @return: MerchantInfo objecti """ self.logger.info("getting merchant..." + str(id)) # get active merchants api = MerchantsAPI() merchant = api.get_merchant(id) if merchant is None: self._log_error("error getting cimri service merchant " + str(id)) self.logger.warn("did not get merchant from cimri-service") return None return merchant
def clean_items(items): api=MerchantsAPI() res=api.clean_paused_items(items) if res is False: self._log_error("cimriservice clean failed") return res
def update_items(items): api=MerchantsAPI() res=api.update_items(items) if res is False: self._log_error("cimriservice update failed") return res