本文整理匯總了Python中paypal.standard.forms.PayPalPaymentsForm.get_endpoint方法的典型用法代碼示例。如果您正苦於以下問題:Python PayPalPaymentsForm.get_endpoint方法的具體用法?Python PayPalPaymentsForm.get_endpoint怎麽用?Python PayPalPaymentsForm.get_endpoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類paypal.standard.forms.PayPalPaymentsForm
的用法示例。
在下文中一共展示了PayPalPaymentsForm.get_endpoint方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get
# 需要導入模塊: from paypal.standard.forms import PayPalPaymentsForm [as 別名]
# 或者: from paypal.standard.forms.PayPalPaymentsForm import get_endpoint [as 別名]
def get(self, request, subscription_id):
preferences = global_preferences_registry.manager()
subscription = get_object_or_404(Subscription, id=int(subscription_id))
volunteer = subscription.volunteer
form = PayPalPaymentsForm(initial={
'business': preferences['payment__receiver_email'],
'amount': preferences['subscription__ticket_value'],
'custom': preferences['payment__campaign'],
'item_name': preferences['payment__item_name'].format(volunteer.name),
'item_number': subscription_id,
'notify_url': urljoin(preferences['general__site_url'], reverse('paypal-ipn')),
'invoice': 'Subscription(id=%s)' % subscription_id,
'currency_code': 'BRL',
'lc': 'BR',
'no_shipping': '1',
'address_override': '1',
'country': 'BR',
'first_name': volunteer.first_name(),
'last_name': volunteer.last_name(),
'address1': volunteer.address,
'address2': volunteer.complement,
'city': volunteer.city,
'state': volunteer.state,
'zip': volunteer.cep,
'night_phone_a': '',
'night_phone_b': '',
'night_phone_c': '',
'email': volunteer.email,
})
data = dict([(f.name, f.value()) for f in form if f.value() is not None])
data['endpoint'] = form.get_endpoint()
data['image_button'] = form.get_image()
response = Response(data)
return response