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


Python Order.orderRefundId方法代码示例

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


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

示例1: post

# 需要导入模块: from models.order import Order [as 别名]
# 或者: from models.order.Order import orderRefundId [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


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