Esempio n. 1
0
    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
Esempio n. 2
0
	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]
Esempio n. 3
0
    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
Esempio n. 4
0
		def clean_items(items):
			api=MerchantsAPI()
			res=api.clean_paused_items(items)	
			if res is False:
				self._log_error("cimriservice clean failed")
			return res
Esempio n. 5
0
		def update_items(items):
			api=MerchantsAPI()
			res=api.update_items(items)	
			if res is False:
				self._log_error("cimriservice update failed")
			return res