當前位置: 首頁>>代碼示例>>Python>>正文


Python PayPalPaymentsForm.save方法代碼示例

本文整理匯總了Python中paypal.standard.forms.PayPalPaymentsForm.save方法的典型用法代碼示例。如果您正苦於以下問題:Python PayPalPaymentsForm.save方法的具體用法?Python PayPalPaymentsForm.save怎麽用?Python PayPalPaymentsForm.save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在paypal.standard.forms.PayPalPaymentsForm的用法示例。


在下文中一共展示了PayPalPaymentsForm.save方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: pdt

# 需要導入模塊: from paypal.standard.forms import PayPalPaymentsForm [as 別名]
# 或者: from paypal.standard.forms.PayPalPaymentsForm import save [as 別名]
def pdt(request,item_check_callable=None):
    """
    PayPal IPN endpoint (notify_url).
    Used by both PayPal Payments Pro and Payments Standard to confirm transactions.
    http://tinyurl.com/d9vu9d
    PayPal IPN Simulator:
    https://developer.paypal.com/cgi-bin/devscr?cmd=_ipn-link-session
    """
    flag = None
    ipn_obj = None
    form = PayPalPaymentsForm(request.POST)
    if form.is_valid():
        try:
            pdt_obj = form.save(commit=False)
        except Exception as e:
            flag = "Exception while processing. (%s)" % e
    else:
        flag = "Invalid form. (%s)" % form.errors

    if ipn_obj is None:
        ipn_obj = PayPalPDT()
    ipn_obj.initialize(request)

    if flag is not None:
        ipn_obj.set_flag(flag)
    else:
        # Secrets should only be used over SSL.
        if request.is_secure() and 'secret' in request.GET:
            ipn_obj.verify_secret(form, request.GET['secret'])
        else:
            try:
                ipn_obj.verify(item_check_callable)
            except Exception as e:
                flag = "Exception while processing. (%s)" % e
    ipn_obj.save()
    return HttpResponse("OKAY")
開發者ID:mfoacs,項目名稱:rcwk001,代碼行數:38,代碼來源:views.py


注:本文中的paypal.standard.forms.PayPalPaymentsForm.save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。