本文整理汇总了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