本文整理汇总了Python中paypal.pro.helpers.PayPalWPP.updateRecurringPaymentsProfile方法的典型用法代码示例。如果您正苦于以下问题:Python PayPalWPP.updateRecurringPaymentsProfile方法的具体用法?Python PayPalWPP.updateRecurringPaymentsProfile怎么用?Python PayPalWPP.updateRecurringPaymentsProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paypal.pro.helpers.PayPalWPP
的用法示例。
在下文中一共展示了PayPalWPP.updateRecurringPaymentsProfile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import updateRecurringPaymentsProfile [as 别名]
def process(self, request, item):
"""Process a PayPal direct payment."""
from paypal.pro.helpers import PayPalWPP
wpp = PayPalWPP(request)
params = self.cleaned_data
params['creditcardtype'] = self.fields['acct'].card_type
params['expdate'] = self.cleaned_data['expdate'].strftime("%m%Y")
params['ipaddress'] = request.META.get("REMOTE_ADDR", "")
params.update(item)
try:
# Create single payment:
if 'billingperiod' not in params:
nvp_obj = wpp.doDirectPayment(params)
# Create recurring payment:
else:
if 'profileid' in params:
# Updating a payment profile.
nvp_obj = wpp.updateRecurringPaymentsProfile(params, direct=True)
else:
# Creating a payment profile.
nvp_obj = wpp.createRecurringPaymentsProfile(params, direct=True)
except PayPalFailure:
return False
return True
示例2: PayPalWPP
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import updateRecurringPaymentsProfile [as 别名]
from paypal.pro.helpers import PayPalWPP
from paypal.pro.exceptions import PayPalFailure
from paypal.pro.models import PayPalNVP
from users.models import UsersProfile
wpp = PayPalWPP()
user_email = "[email protected]"
params = {'expdate': '012024', 'cvv2': u'123', 'acct': u'4032031179702831', 'creditcardtype': 'Visa'}
usr_obj = UsersProfile.objects.get(email=user_email)
paypal_obj = PayPalNVP.objects.filter(user=usr_obj).latest('updated_at')
params['profileid'] = paypal_obj.profileid
nvp_obj = wpp.updateRecurringPaymentsProfile(params)