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]