Beispiel #1
0
    def detect_cc(self, refer, offer, country, affsub2, currency):
        # refer URL is always true
        cc = parse.detect_cc_refer(refer)
        if pandas.notnull(cc):
            return cc

        # otherwise use affsub2
        cc = parse.detect_cc_affid(affsub2)
        if pandas.notnull(cc):
            return cc

        # backwards compatibility, detect from offer name
        cc = parse.detect_cc_name(offer)
        if pandas.notnull(cc):
            return cc

        # if that isn't set either, take the user's country
        cc = parse.detect_cc_name(country)
        if pandas.notnull(cc):
            return cc

        # if the country was missed, use the original currency name
        cc = parse.detect_cc_from_currency(currency)
        if pandas.notnull(cc):
            return cc

        return ''
Beispiel #2
0
    def detect_cc(self, refer, website_name):
        cc = parse.detect_cc_refer(refer)
        if pandas.notnull(cc):
            return cc

        cc = website_name.decode('utf8')[-2:]
        if cc in ['ID', 'HK', 'MY', 'PH', 'SG', 'TH', 'VN']:
            return cc

        return ''
Beispiel #3
0
    def detect_cc(self, refer, program, site_id):
        # refer URL is always true
        cc = parse.detect_cc_refer(refer)
        if pandas.notnull(cc):
            return cc

        # use merchant and product
        cc = parse.detect_cc_name(program)
        if pandas.notnull(cc):
            return cc

        # otherwise use site id
        if pandas.notnull(site_id):
            if site_id in self.countries:
                return self.countries[site_id]
            else:
                self.logger.warning("Couldn't detect cc from site id", {"site_id": site_id})

        return ''
Beispiel #4
0
    def detect_cc(self, refer, merchant, product, uid2):
        # refer URL is always true
        cc = parse.detect_cc_refer(refer)
        if pandas.notnull(cc):
            return cc

        # use merchant and product
        cc = parse.detect_cc_name(merchant)
        if pandas.notnull(cc):
            return cc

        cc = parse.detect_cc_name(product)
        if pandas.notnull(cc):
            return cc

            # otherwise use uid2
        cc = parse.detect_cc_affid(uid2)
        if pandas.notnull(cc):
            return cc

        return ''
Beispiel #5
0
    def detect_cc(self, traffic_source):
        cc = parse.detect_cc_refer(traffic_source)
        if pandas.notnull(cc):
            return cc

        return ''