Пример #1
0
 def check_charge_info(self, mi, chargeInfo):
     appId = chargeInfo['appId']
     # packageName = chargeInfo['packageName']
     clientId = chargeInfo['clientId']
     diamondId = chargeInfo['diamondId']
     diamondPrice = chargeInfo['diamondPrice']
     chargetype = chargeInfo['chargeType']
     prodDict = ChargeConfigure.get_prod_dict(appId, clientId=clientId)
     payCodes = TyContext.Configure.get_global_item_json('paycodes', clientid=clientId)
     payData = payCodes[chargetype]['paydata']
     prodList = []
     for data in payData:
         prodid = data['prodid']
         if diamondId == prodid:
             return
         # 单机商品过滤掉
         if prodid.endswith('DJ'):
             continue
         try:
             prodInfo = prodDict[prodid]
         except KeyError:
             continue
         if int(prodInfo.get('is_diamond', 0)) and prodInfo['price'] >= diamondPrice:
             prodList.append(prodInfo)
     if prodList:
         prodList.sort(lambda x, y: cmp(x['price'], y['price']))
         prodInfo = prodList[0]
         chargeInfo['buttonId'] = prodInfo['id']
         chargeInfo['diamondId'] = prodInfo['id']
         chargeInfo['diamondName'] = prodInfo['name']
         chargeInfo['buttonName'] = prodInfo['name']
         chargeInfo['diamondPrice'] = prodInfo['price']
         chargeInfo['chargeTotal'] = prodInfo['price'] * chargeInfo['diamondCount']
         chargeInfo['chargeCoin'] = prodInfo['diamondPrice'] * chargeInfo['diamondCount']
Пример #2
0
 def change_chargeinfo(self, diamondList, chargeInfo):
     clientId = chargeInfo['clientId']
     diamondPrice = chargeInfo['diamondPrice']
     prodDict = ChargeConfigure.get_prod_dict(chargeInfo['appId'],
                                              clientId=clientId)
     prodList = []
     for id in diamondList:
         # 单机商品过滤掉
         if id.endswith('DJ'):
             continue
         try:
             prodInfo = prodDict[id]
         except KeyError:
             continue
         if int(prodInfo.get('is_diamond',
                             0)) and prodInfo['price'] >= diamondPrice:
             prodList.append(prodInfo)
     if prodList:
         prodList.sort(lambda x, y: cmp(x['price'], y['price']))
         prodInfo = prodList[0]
         chargeInfo['diamondId'] = prodInfo['id']
         chargeInfo['diamondName'] = prodInfo['name']
         chargeInfo['buttonName'] = prodInfo['name']
         chargeInfo['diamondPrice'] = prodInfo['price']
         chargeInfo[
             'chargeTotal'] = prodInfo['price'] * chargeInfo['diamondCount']
         chargeInfo['chargeCoin'] = prodInfo['diamondPrice'] * chargeInfo[
             'diamondCount']
Пример #3
0
 def filter_payment(self, payment, prod_info, **kwargs):
     """
     支付方式列表中过滤检查,没有计费点得商品就不要显示此支付方式
     :param prodInfo:
     :param chargeInfo:
     :param kwargs:
     :return:
     """
     appId = kwargs['appId']
     clientId = kwargs['clientId']
     prodConfig = TyContext.Configure.get_global_item_json(
         'yisdkpay_prodids', {})
     yipayDict = prodConfig[str(appId)]
     prodId, prodPrice = prod_info['id'], prod_info['price']
     # 计费点直购
     prodDict = ChargeConfigure.get_prod_dict(appId, clientId=clientId)
     if prodId in yipayDict:
         return True
     # 替代计费点
     for id in yipayDict:
         tmpProdInfo = prodDict[id]
         if int(tmpProdInfo.get('is_diamond',
                                0)) and tmpProdInfo['price'] >= prodPrice:
             return True
     return False
Пример #4
0
 def check_charge_info(self, mi, chargeInfo):
     appId = chargeInfo['appId']
     diamondId = chargeInfo['diamondId']
     prodConfig = TyContext.Configure.get_global_item_json(
         'yisdkpay_prodids', {})
     yipayDict = prodConfig[str(appId)]
     if not diamondId in yipayDict:
         clientId = chargeInfo['clientId']
         diamondPrice = chargeInfo['diamondPrice']
         prodDict = ChargeConfigure.get_prod_dict(appId, clientId=clientId)
         prodList = []
         for id in yipayDict:
             # 单机商品过滤掉
             if id.endswith('DJ'):
                 continue
             prodInfo = prodDict[id]
             if int(prodInfo.get('is_diamond',
                                 0)) and prodInfo['price'] >= diamondPrice:
                 prodList.append(prodInfo)
         if prodList:
             prodList.sort(lambda x, y: cmp(x['price'], y['price']))
             prodInfo = prodList[0]
             chargeInfo['diamondId'] = prodInfo['id']
             chargeInfo['diamondName'] = prodInfo['name']
             chargeInfo['diamondPrice'] = prodInfo['price']
             chargeInfo['chargeTotal'] = prodInfo['price'] * chargeInfo[
                 'diamondCount']
             chargeInfo['chargeCoin'] = prodInfo[
                 'diamondPrice'] * chargeInfo['diamondCount']
Пример #5
0
 def check_charge_info(self, mi, chargeInfo):
     appId = chargeInfo['appId']
     clientId = chargeInfo['clientId']
     diamondId = chargeInfo['diamondId']
     diamondPrice = chargeInfo['diamondPrice']
     packageName = chargeInfo.get('packageName', '')
     products = []
     if packageName:
         _, products = self.get_ios_product_by_packageName(appId, packageName, clientId, diamondId)
     if not products:
         products = TuyouPayDiamondList._get_pay_products_list_(appId, clientId, 'ios-products-v2', clientId)
     # 没有计费点商品
     if not filter(lambda x: x['tyid'] == diamondId, products):
         prodDict = ChargeConfigure.get_prod_dict(appId, clientId=clientId)
         diamondList = []
         for diamond in products:
             tyid = diamond['tyid']
             prodInfo = prodDict.get(tyid, {})
             if prodInfo.get('is_diamond') and prodInfo['price'] >= diamondPrice:
                 diamondList.append(prodInfo)
         if diamondList:
             diamondList.sort(lambda x, y: cmp(x['price'], y['price']))
             prodInfo = diamondList[0]
             chargeInfo['diamondId'] = prodInfo['id']
             chargeInfo['buttonId'] = prodInfo['id']
             chargeInfo['diamondName'] = prodInfo['name']
             chargeInfo['diamondPrice'] = prodInfo['price']
             chargeInfo['chargeTotal'] = prodInfo['price'] * chargeInfo['diamondCount']
             chargeInfo['chargeCoin'] = prodInfo['diamondPrice'] * chargeInfo['diamondCount']
Пример #6
0
 def check_charge_info(self, mi, chargeInfo):
     if not self.need_continue_change_chargeinfo(chargeInfo):
         return
     appId = chargeInfo['appId']
     packageName = chargeInfo['packageName']
     diamondId = chargeInfo['diamondId']
     prodConfig = TyContext.Configure.get_global_item_json('duoku_prodids', {})
     thirdDict = prodConfig[packageName]
     if not diamondId in thirdDict:
         clientId = chargeInfo['clientId']
         diamondPrice = chargeInfo['diamondPrice']
         prodDict = ChargeConfigure.get_prod_dict(appId, clientId=clientId)
         prodList = []
         for id in thirdDict:
             # 单机商品过滤掉
             if id.endswith('DJ'):
                 continue
             try:
                 prodInfo = prodDict[id]
             except KeyError:
                 continue
             if int(prodInfo.get('is_diamond', 0)) and prodInfo['price'] >= diamondPrice:
                 prodList.append(prodInfo)
         if prodList:
             prodList.sort(lambda x, y: cmp(x['price'], y['price']))
             prodInfo = prodList[0]
             chargeInfo['diamondId'] = prodInfo['id']
             chargeInfo['diamondName'] = prodInfo['name']
             chargeInfo['buttonName'] = prodInfo['name']
             chargeInfo['diamondPrice'] = prodInfo['price']
             chargeInfo['chargeTotal'] = prodInfo['price'] * chargeInfo['diamondCount']
             chargeInfo['chargeCoin'] = prodInfo['diamondPrice'] * chargeInfo['diamondCount']