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


Python PayPalPaymentsForm.get_endpoint方法代碼示例

本文整理匯總了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
開發者ID:sonhar-acordado-sp,項目名稱:festas-sonhar-acordado,代碼行數:40,代碼來源:views.py


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