本文整理汇总了Python中models.order.Order.orderBonusQuantity方法的典型用法代码示例。如果您正苦于以下问题:Python Order.orderBonusQuantity方法的具体用法?Python Order.orderBonusQuantity怎么用?Python Order.orderBonusQuantity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.order.Order
的用法示例。
在下文中一共展示了Order.orderBonusQuantity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models.order import Order [as 别名]
# 或者: from models.order.Order import orderBonusQuantity [as 别名]
def post(self):
tOrderKey = self.request.get('orderid')
tAgentGold = self.request.get('agentgold')
#logging.debug("tOrderKey: " + tOrderKey)
#logging.debug("tAgentGold: " + tAgentGold)
tOrder = Order()
tOrder = Order.get(tOrderKey)
tUser = users.get_current_user()
tAgent = Agent().GetAgentByEmail(str(tUser.email()))
if (tOrder.orderDeliver == "" or tOrder.orderDeliver == 'False' and tOrder.orderLocked != 'True' and tAgent.agentIsEnabled == True):
tGoldAmount = tOrder.orderQuantity
tPromoCode = ""
tPromoCode = tOrder.orderPromotionalCode
tPromo = Promo()
tPromoCode = tPromoCode.lower()
tReferCode = tOrder.orderReferralCode
tCustomerLookup = CustomerHandler()
tCustomer = Customer()
tCustomer = Customer().get(str(tOrder.orderCustomer))
# Promo codes get unlimited uses per customer
# tUsedBonus = Order.GetCustomerPromoCodes(tCustomer.customerPaypalId)
# tUsedBonus = tCustomer.customerUsedBonus
# logging.debug("Customer used bonuses: " + str(tUsedBonus))
# logging.debug("Order Promo Code: " + str(tPromoCode))
tUsedBonus = []
try:
tPromo = Promo.GetPromoByCode(tPromoCode)
# logging.debug(str(tPromo.promoGoldAmount))
# logging.debug(str(tPromo.promoPercentage))
# logging.debug(str(tPromo.promoIsActive))
if ((tPromo.promoIsActive) and (tPromo.promoUses <= tPromo.promoLimit)):
if (tPromo.promoLimit != 0):
tPromo.promoUses = tPromo.promoUses + 1
if((tPromoCode in tUsedBonus) == True):
tPercentBonus = 0.0
else:
tPercentBonus = float(tGoldAmount) * tPromo.promoPercentage
#tUsedBonus.append(tPromoCode)
tGoldAmount = tGoldAmount + tPercentBonus
tGoldAmount = tGoldAmount + tPromo.promoGoldAmount
tTotalBonusFloat = tPercentBonus + tPromo.promoGoldAmount
tOrder.orderBonusQuantity = int(tTotalBonusFloat)
except:
tOrder.orderBonusQuantity = 0
tGoldAmountLong = tGoldAmount
tGoldAmount = tGoldAmount / 1000000
tOrderValue = float(tOrder.orderCost)
#if(tOrder.orderIsGenerated == True):
#tGoldAmountLong = 0
#tGoldAmount = 0
tStockManager = StockManager()
tStockManager.LoadAccounts()
tStockManager.PlaceOrder(tGoldAmountLong * -1, tOrder.orderGoldType)
#if tOrder.orderGoldType == '07':
#tStockAccountManager.Set07Stock(int(tGoldAmountLong * -1))
#else:
#tStockAccountManager.SetEOCStock(int(tGoldAmountLong * -1))
tCommission = float(tOrderValue) * 0.05 + 0.50
if tCommission >= 10.0:
tCommission = 10.0
tAgent.agentCurrentCommission = float(tAgent.agentCurrentCommission + tCommission)
tAgent.agentTotalCommission = float(tAgent.agentTotalCommission + tCommission)
tAgentOrders = tAgent.agentOrders
tAgentOrders.append(tOrderKey)
tAgent.agentOrders = tAgentOrders
tAgentKey = tAgent.put()
tOrder.orderDeliveryAgent = str(tAgent.agentId)
tOrder.orderAgent = str(tAgentKey)
tOrder.orderDeliver = 'True'
tKey = tOrder.put()
#logging.debug("Delivery by Agent: " + str(tAgentKey))
#logging.debug("Delivery of Order: " + str(tKey))
#taskqueue.add(url='/calcreferral', countdown = 1, params={'key' : str(tKey) } )
self.response.headers['Cache-Control'] = 'Cache-Control: no-cache, must-revalidate'
self.response.headers['Content-Type'] = 'Content-Type: plain/text'
self.response.out.write("Order Delivered")
else:
#logging.debug('Attempted to Deliver ' + tOrderKey + " by Agent " + tAgent.agentId)
self.response.headers['Cache-Control'] = 'Cache-Control: no-cache, must-revalidate'
#.........这里部分代码省略.........
示例2: ProcessOrder
# 需要导入模块: from models.order import Order [as 别名]
# 或者: from models.order.Order import orderBonusQuantity [as 别名]
#.........这里部分代码省略.........
tOrder.orderGoldType = "eoc"
tSkip07 = True
if not tSkip07:
if tOrder.orderSimpleGoldAmount in tCurrent07Prices.keys():
if str(tOrder.orderCost) == str(tCurrent07Prices[tOrder.orderSimpleGoldAmount]):
tOrder.orderGoldType = "07"
tOrderKey = str(tOrder.put())
# logging.debug("Order Saved: " + str(tOrderKey))
taskqueue.add(url="/iplookup", countdown=1, params={"ip": tOrderIp, "transid": tTransactionId})
tUsedBonus = []
tCustomerList = tCustomerHandler.GetCustomerByPpid(tOrder.orderCustomerPaypalId)
if len(tCustomerList) == 1:
tCustomer = tCustomerList[0]
tIpList = tCustomer.customerIpAddresses
tIpList.append(tOrderIp)
tCustomer.customerIpAddresses = tIpList
tOrderList = tCustomer.customerOrders
tOrderList.append(tOrderKey)
tCustomer.customerOrders = tOrderList
tCustomer.customerOrderCount = int(tCustomer.customerOrderCount) + 1
# tUsedBonus = tCustomer.customerUsedBonus
tUsedBonus = Order.GetCustomerPromoCodes(tCustomer.customerPaypalId)
# tOrder.orderCustomer = str(tCustomer.key())
elif len(tCustomerList) == 0:
tCustomer.customerEmail = str(tOrder.orderPaypalEmail).lower()
tCustomer.customerName = tCustomerName
tCustomer.customerFirstName = tOrder.orderPaypalFirstName
tCustomer.customerLastName = tOrder.orderPaypalLastName
tCustomer.customerIpAddresses = [tOrderIp]
tCustomer.customerOrders = [tOrderKey]
tCustomer.customerOrderCount = 1
tCustomer.customerPhone = tMobilePhone
tCustomer.customerEmailVerified = False
tCustomer.customerPhoneVerified = False
tCustomer.customerIdVerified = False
tCustomer.customerPaypalId = tOrder.orderCustomerPaypalId
tCustomer.customerIsGlobalBlacklisted = False
tCustomer.customerIsPaBlacklisted = False
tPromoCode = ""
tPromoCode = tOrder.orderPromotionalCode
# logging.debug("Order Promo Code: " + str(tOrder.orderPromotionalCode))
tPromo = Promo()
tPromoCode = tPromoCode.lower()
try:
logging.debug("Promo Code: " + str(tPromoCode))
tPromo = Promo.GetPromoByCode(tPromoCode)
logging.debug("Promo: " + str(tPromo))
tGoldAmount = tOrder.orderQuantity
logging.debug("Gold Amount: " + str(tGoldAmount))
logging.debug("Promo is active: " + str(tPromo.promoIsActive))
if (tPromo.promoIsActive) and (tPromo.promoUses <= tPromo.promoLimit):
if tPromo.promoLimit != 0:
tPromo.promoUses = tPromo.promoUses + 1
if (tPromoCode in tUsedBonus) == True:
tPercentBonus = 0.0
else:
tPercentBonus = tGoldAmount * tPromo.promoPercentage
# tUsedBonus.append(tPromoCode)
tGoldAmount = tGoldAmount + tPercentBonus
tGoldAmount = tGoldAmount + tPromo.promoGoldAmount
tTotalBonusFloat = tPercentBonus + tPromo.promoGoldAmount
logging.debug("Bonus float: " + str(tTotalBonusFloat))
tOrder.orderBonusQuantity = int(tTotalBonusFloat)
logging.debug("Total Bonus Float " + str(tTotalBonusFloat))
logging.debug("Promo Gold Amount " + str(tPromo.promoGoldAmount))
logging.debug("Promo Percentage " + str(tPercentBonus))
except:
tOrder.orderBonusQuantity = 0
# tCustomer.customerUsedBonus = tUsedBonus
tCustomerKey = str(tCustomer.put())
tOrder.orderCustomer = tCustomerKey
tOrderKey = str(tOrder.put())
if tCustomerName == "":
tCustomerName = tCustomerFirstName + " " + tCustomerLastName
if tGoldAmount == None or len(str(tGoldAmount)) == 0:
tGoldAmount = tGoldAmountString
response = taskqueue.add(
url="/emailnotify",
countdown=1,
params={"email": tPaypalEmail, "gold": tGoldAmount, "name": tCustomerName, "key": tOrderKey},
)
logging.debug(str(response))