当前位置: 首页>>代码示例>>Python>>正文


Python Order.orderIsRefunded方法代码示例

本文整理汇总了Python中models.order.Order.orderIsRefunded方法的典型用法代码示例。如果您正苦于以下问题:Python Order.orderIsRefunded方法的具体用法?Python Order.orderIsRefunded怎么用?Python Order.orderIsRefunded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.order.Order的用法示例。


在下文中一共展示了Order.orderIsRefunded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from models.order import Order [as 别名]
# 或者: from models.order.Order import orderIsRefunded [as 别名]
    def post(self):
        tUrl = "https://api-3t.paypal.com/nvp"
        tPaypalPayload = {}
        tPaypal = PaypalRefund()
        tAgent = Agent()
        tOrder = Order()
        tUser = users.get_current_user()

        tTransId = str(self.request.get("orderid"))

        tAgentEmail = str(tUser.email())
        tAgent = Agent().GetAgentByEmail(tAgentEmail)
        tRefundAgent = tAgentEmail

        tOrderQuery = Order.all()
        tOrderQuery.filter("orderTransactionId", tTransId)
        # logging.debug("Transaction id: " + tTransId)
        tOrder = tOrderQuery.get()

        if tOrder.orderDeliver != "True":

            tPaypalPayload["METHOD"] = "RefundTransaction"
            tPaypalPayload["TRANSACTIONID"] = tTransId

            tPayloadEncoded = tPaypal.GeneratePayload(tPaypalPayload)

            request_cookies = mechanize.CookieJar()
            request_opener = mechanize.build_opener(mechanize.HTTPCookieProcessor(request_cookies))
            request_opener.addheaders = [("Content-Type", "application/x-www-form-urlencoded")]
            mechanize.install_opener(request_opener)

            tResponse = mechanize.urlopen(url=tUrl, timeout=25.0, data=tPayloadEncoded)
            # logging.debug("Mechanize Package")
            # logging.debug("Url: " + tUrl)
            # logging.debug("Data: " + str(tPaypalPayload))

            tResult = tResponse.read()
            # logging.debug(tResult)

            tOrder.orderIsRefunded = "True"
            tOrder.orderRefundAgent = tRefundAgent
            tOrder.orderLocked = "True"
            tOrder.orderRefundId = ""
            tOrder.put()

            self.response.out.write("Order Locked and Refunded")
开发者ID:Kenneth-Posey,项目名称:kens-old-projects,代码行数:48,代码来源:paypal.py

示例2: GetContext

# 需要导入模块: from models.order import Order [as 别名]
# 或者: from models.order.Order import orderIsRefunded [as 别名]

#.........这里部分代码省略.........
                         
         try:
             tTotalBonusString = NumberToGp.ConvertIntToBet(int(tOrder.orderBonusQuantity))
             #logging.debug("Total Bonus String " + tTotalBonusString)
         except:
             tTotalBonusString = ""
             
         if (tCustomer.customerIsPaBlacklisted == True):
             tOrderData['instructions'] = tOrderData['instructions'] + "<br /><span style='color:red'>Refer to PA - Blacklist</span>"
             tContext['tDisplayDeliver'] = 'False'
             
         if (tCustomer.customerIsGlobalBlacklisted == True):
             tOrderData['instructions'] = tOrderData['instructions'] + "<br /><span style='color:red'>Do Not Deliver - Blacklist</span>"
             tContext['tDisplayDeliver'] = 'False'
         
         #normalize unicode
         try:
             tSimpleGold = unicodedata.normalize("NFC", tOrder.orderSimpleGoldAmount).encode("ascii", "ignore")
         except:
             tSimpleGold = tOrder.orderSimpleGoldAmount
         
         #logging.debug(str(tPriceDic[tSimpleGold]))
         #logging.debug(str(tOrder.orderCost))
         tCurrentEocPrices = PriceContainer.GetCurrentPriceDic()
         tCurrent07Prices = PriceContainer.GetCurrentPriceDic07()
                     
         #logging.debug(str(tCurrent07Prices))
         #logging.debug(str(tCurrentEocPrices))
         
         tSkip07 = False
         tValidOrder = False
         if tOrder.orderSimpleGoldAmount in tCurrentEocPrices.keys():
             if str(tOrder.orderCost) == str(tCurrentEocPrices[tOrder.orderSimpleGoldAmount]):
                 tOrder.orderGoldType = 'eoc'
                 tSkip07 = True
                 tValidOrder = True
         
         if not tSkip07:
             if tOrder.orderSimpleGoldAmount in tCurrent07Prices.keys():
                 if str(tOrder.orderCost) == str(tCurrent07Prices[tOrder.orderSimpleGoldAmount]):
                     tOrder.orderGoldType = '07'
                     tValidOrder = True
         
         #logging.debug("skip07 {}".format(tSkip07))
         #logging.debug("valid {}".format(tValidOrder))
         #logging.debug("order simple gold amount {}".format(tOrder.orderSimpleGoldAmount))
         #logging.debug("order value {}".format(tOrderData['orderTotal']))
         #logging.debug("gold type {}".format(tContext['gold_type']))
                     
         if not tValidOrder:
             tOrderData['instructions'] = tOrderData['instructions'] + '<br /><span style="color:red">Do Not Deliver - Bad Payment</span>'
             #tOrderData['tDisplayDeliver'] = 'False'
             #tOrder.orderLocked = 'True'
             #tOrder.put()
         
         #logging.debug(str(tOrder.orderIsGenerated))
         if(tOrder.orderIsGenerated == True):
             tOrder.orderLocked = 'False'
             tOrder.orderIsRefunded = 'False'
             tOrder.orderDeliver = 'False'
             tOrderData['tDisplayDeliver'] = 'True'
             
         try:
             tDeliveryAgent = Agent.GetAgentByEmail(tOrder.orderDeliveryAgent)
             tContext['tDeliveryAgent'] = tDeliveryAgent
         except:
             pass
         
         try:
             tAssignedAgent = Agent.GetAgentByEmail(tOrder.orderAssignedAgent)
             tContext['tAssignedAgent'] = tAssignedAgent
         except:
             pass
         
         try:
             tRefundAgent = Agent.GetAgentByEmail(tOrder.orderRefundAgent)
             tContext['tRefundAgent'] = tRefundAgent
         except:
             pass            
         tOrderData['bonus'] = tTotalBonusString
         
         tOrderData['phoneverified'] = str(tCustomer.customerPhoneVerified)
         tOrderData['emailverified'] = str(tCustomer.customerEmailVerified)
         tOrderData['idverified'] = str(tCustomer.customerIdVerified)
         
         tContext['tOrder'] = tOrder
         tContext['tOrderData'] = tOrderData
         tContext['tCustomer'] = tCustomer
         tContext['tIpInfo'] = tIpInfo
         tContext['tPhoneInfo'] = tPhoneInfo
     
     
     if ((tOrder.orderDeliveryAgent == "" or tOrder.orderDeliveryAgent == None) and tOrder.orderDeliver == 'True'):
         tAgentKey = tOrder.orderAgent
         tAgentId = Agent()
         tAgentId = Agent.get(tAgentKey)
         tOrder.orderDeliveryAgent = str(tAgentId.agentId)
                     
     #logging.debug(str(tOrderData))
     return tContext
开发者ID:Kenneth-Posey,项目名称:kens-old-projects,代码行数:104,代码来源:orderhandler.py


注:本文中的models.order.Order.orderIsRefunded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。