本文整理汇总了Python中models.order.Order.orderDeliver方法的典型用法代码示例。如果您正苦于以下问题:Python Order.orderDeliver方法的具体用法?Python Order.orderDeliver怎么用?Python Order.orderDeliver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.order.Order
的用法示例。
在下文中一共展示了Order.orderDeliver方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GetContext
# 需要导入模块: from models.order import Order [as 别名]
# 或者: from models.order.Order import orderDeliver [as 别名]
#.........这里部分代码省略.........
tContext['SHIPTOCITY'] = 'UNKNOWN'
if 'SHIPTOSTATE' in tResultDictionary.keys():
tContext['SHIPTOSTATE'] = tResultDictionary['SHIPTOSTATE']
else:
tContext['SHIPTOSTATE'] = 'UNKNOWN'
if 'SHIPTOZIP' in tResultDictionary.keys():
tContext['SHIPTOZIP'] = tResultDictionary['SHIPTOZIP']
else:
tContext['SHIPTOZIP'] = 'UNKNOWN'
if 'SHIPTOCOUNTRYCODE' in tResultDictionary.keys():
tContext['SHIPTOCOUNTRYCODE'] = tResultDictionary['SHIPTOCOUNTRYCODE']
else:
tContext['SHIPTOCOUNTRYCODE'] = 'UNKNOWN'
if 'SHIPTOPHONENUM' in tResultDictionary.keys():
tContext['SHIPTOPHONENUM'] = tResultDictionary['SHIPTOPHONENUM']
else:
tContext['SHIPTOPHONENUM'] = 'UNKNOWN'
#Get order amount to add to dated totals
tCurrentCost = float(tOrder.orderCost)
#Get date 30 days ago
tStartDate = tOrder.orderCreated
tIncrement = datetime.timedelta(days = -30)
tEndDate = tStartDate + tIncrement
tCustomerOrderQuery = Order.all()
tCustomerOrderQuery.filter("orderCreated >", tEndDate)
tCustomerOrderQuery.filter("orderCustomer", tOrder.orderCustomer)
tCustomerOrderQuery.filter("orderDeliver", 'True')
tCustomerOrders = tCustomerOrderQuery.fetch(1000)
#logging.debug("30 day date: " + str(tEndDate))
#logging.debug("30 day orders: " + str(len(tCustomerOrders)))
tCustomerOrderTotal = 0.0
for tCustomerOrder in tCustomerOrders:
tCustomerOrderTotal += float(tCustomerOrder.orderCost)
if (tOrder.orderDeliver == 'False'):
tCustomerOrderTotal += tCurrentCost
tOrderData['orderTotal'] = str("%.2f"% tCustomerOrderTotal)
#Get date 24 hours ago
tStartDate = tOrder.orderCreated
tIncrement = datetime.timedelta(days = -1)
tEndDate = tStartDate + tIncrement
tCustomerOrderQuery = Order.all().filter("orderCreated >", tEndDate)
tCustomerOrderQuery.filter("orderCustomer", tOrder.orderCustomer)
tCustomerOrderQuery.filter("orderDeliver", 'True')
tCustomerOrders = tCustomerOrderQuery.fetch(1000)
#logging.debug("24 hour date: " + str(tEndDate))
#logging.debug("24 hour orders: " + str(len(tCustomerOrders)))
tCustomerOrderTotal24 = 0.0
for tCustomerOrder in tCustomerOrders:
tCustomerOrderTotal24 += float(tCustomerOrder.orderCost)
if (tOrder.orderDeliver == 'False'):
tCustomerOrderTotal24 += tCurrentCost
tOrderData['orderTotal24'] = str("%.2f" % tCustomerOrderTotal24)
#Get date 15 days ago
tStartDate = tOrder.orderCreated
tIncrement = datetime.timedelta(days = -15)
tEndDate = tStartDate + tIncrement
示例2: post
# 需要导入模块: from models.order import Order [as 别名]
# 或者: from models.order.Order import orderDeliver [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'
#.........这里部分代码省略.........
示例3: ProcessOrder
# 需要导入模块: from models.order import Order [as 别名]
# 或者: from models.order.Order import orderDeliver [as 别名]
#.........这里部分代码省略.........
tGoldAmount = tGoldMatch[0]
except:
# logging.debug("No gold match")
tGoldAmount = ""
tOrder.orderQuantity = NumberToGp.ConvertBetToInt(tGoldAmount)
tOrder.orderSimpleGoldAmount = tGoldAmount
tOrder.orderFormEmail = tEmail
tOrder.orderAccountName = tRsName
tOrder.orderMobileNumber = tMobilePhone
tOrder.orderPromotionalCode = tPromotionCode.lower()
tOrder.orderIp = tOrderIp
if tMembers == "yes":
tOrder.orderCustomerIsMember = True
else:
tOrder.orderCustomerIsMember = False
# Paypal Info
tOrder.orderTransactionId = tTransactionId
tOrder.orderPaypalFirstName = tCustomerFirstName
tOrder.orderPaypalLastName = tCustomerLastName
tOrder.orderCost = float(tArgumentDic["payment_gross"])
tOrder.orderCustomerPaypalId = tArgumentDic["payer_id"]
tOrder.orderPaypalEmail = str(tPaypalEmail).lower()
tAssignedAgentNick = tPaypalOrder.GetAssignedAgent(tOrder)
tOrder.orderAssignedAgent = tAssignedAgentNick
# logging.debug("Order assigned to agent: " + str(tAssignedAgentNick))
tOrder.orderReferralCode = tReferCode
tOrder.orderDeliver = "False"
if tOrder.orderVerificationCode == None or tOrder.orderVerificationCode == "":
tOrder.orderVerificationCode = re.sub(r"\W", "", str(uuid.uuid4())).lower()
tCurrentEocPrices = PriceContainer.GetCurrentPriceDic()
tCurrent07Prices = PriceContainer.GetCurrentPriceDic07()
tSkip07 = False
if tOrder.orderSimpleGoldAmount in tCurrentEocPrices.keys():
if str(tOrder.orderCost) == str(tCurrentEocPrices[tOrder.orderSimpleGoldAmount]):
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