本文整理匯總了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")