本文整理汇总了Python中paypal.pro.helpers.PayPalWPP.createRecurringPaymentsProfile方法的典型用法代码示例。如果您正苦于以下问题:Python PayPalWPP.createRecurringPaymentsProfile方法的具体用法?Python PayPalWPP.createRecurringPaymentsProfile怎么用?Python PayPalWPP.createRecurringPaymentsProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paypal.pro.helpers.PayPalWPP
的用法示例。
在下文中一共展示了PayPalWPP.createRecurringPaymentsProfile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createRecurringPaymentsProfile [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: recurring
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createRecurringPaymentsProfile [as 别名]
def recurring(self, money, creditcard, options = None):
if not options:
options = {}
params = {}
params['profilestartdate'] = options.get('startdate') or datetime.datetime.now().strftime("%Y-%m-%dT00:00:00Z")
params['startdate'] = options.get('startdate') or datetime.datetime.now().strftime("%m%Y")
params['billingperiod'] = options.get('billingperiod') or 'Month'
params['billingfrequency'] = options.get('billingfrequency') or '1'
params['amt'] = money
params['desc'] = 'description of the billing'
params['creditcardtype'] = creditcard.card_type.card_name
params['acct'] = creditcard.number
params['expdate'] = '%02d%04d' % (creditcard.month, creditcard.year)
params['firstname'] = creditcard.first_name
params['lastname'] = creditcard.last_name
wpp = PayPalWPP(options.get('request', {}))
try:
response = wpp.createRecurringPaymentsProfile(params, direct=True)
transaction_was_successful.send(sender=self,
type="purchase",
response=response)
except PayPalFailure, e:
transaction_was_unsuccessful.send(sender=self,
type="purchase",
response=e)
# Slight skewness because of the way django-paypal
# is implemented.
return {"status": "FAILURE", "response": e}
示例3: validate_confirm_form
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createRecurringPaymentsProfile [as 别名]
def validate_confirm_form(self):
"""
Third and final step of ExpressCheckout. Request has pressed the confirmation but
and we can send the final confirmation to PayPal using the data from the POST'ed form.
"""
wpp = PayPalWPP(self.request)
pp_data = dict(token=self.request.POST['token'], payerid=self.request.POST['PayerID'])
self.item.update(pp_data)
# @@@ This check and call could be moved into PayPalWPP.
try:
if self.is_recurring():
wpp.createRecurringPaymentsProfile(self.item)
else:
wpp.doExpressCheckoutPayment(self.item)
except PayPalFailure:
self.context['errors'] = self.errors['processing']
return self.render_payment_form()
else:
return HttpResponseRedirect(self.success_url)
示例4: process
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createRecurringPaymentsProfile [as 别名]
def process(self, ipaddress, user, item):
"""Process a PayPal ExpressCheckout payment."""
from paypal.pro.helpers import PayPalWPP
wpp = PayPalWPP(ipaddress, user)
params = self.cleaned_data
params.update(item)
try:
# Create single payment:
if 'billingperiod' not in params:
nvp_obj = wpp.doExpressCheckoutPayment(params)
# Create recurring payment:
else:
nvp_obj = wpp.createRecurringPaymentsProfile(params)
except PayPalFailure:
return None
return nvp_obj
示例5: process
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createRecurringPaymentsProfile [as 别名]
def process(self, request, item):
"""Do a direct payment."""
from paypal.pro.helpers import PayPalWPP
wpp = PayPalWPP(request)
# Change the model information into a dict that PayPal can understand.
params = model_to_dict(self, exclude=self.ADMIN_FIELDS)
params['acct'] = self.acct
params['creditcardtype'] = self.creditcardtype
params['expdate'] = self.expdate
params['cvv2'] = self.cvv2
params.update(item)
# Create recurring payment:
if 'billingperiod' in params:
return wpp.createRecurringPaymentsProfile(params, direct=True)
# Create single payment:
else:
return wpp.doDirectPayment(params)
示例6: validate_confirm_form
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createRecurringPaymentsProfile [as 别名]
def validate_confirm_form(self):
"""
Third and final step of ExpressCheckout. Request has pressed the confirmation but
and we can send the final confirmation to PayPal using the data from the POST'ed form.
"""
wpp = PayPalWPP(self.request)
pp_data = dict(token=self.request.POST['token'], payerid=self.request.POST['PayerID'])
self.item.update(pp_data)
if self.is_recurring:
success = wpp.createRecurringPaymentsProfile(self.item)
else:
success = wpp.doExpressCheckoutPayment(self.item)
if success:
payment_was_successful.send(sender=self.item)
return HttpResponseRedirect(self.success_url)
else:
self.context['errors'] = self.processing_error
return self.render_payment_form()
示例7: process
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createRecurringPaymentsProfile [as 别名]
def process(self, request, item):
"""Do a direct payment."""
from paypal.pro.helpers import PayPalWPP
wpp = PayPalWPP(request)
# Change the model information into a dict that PayPal can understand.
params = model_to_dict(self, exclude=self.ADMIN_FIELDS)
params["ACCT"] = self.acct
params["CREDITCARDTYPE"] = self.creditcardtype
params["EXPDATE"] = self.expdate
params["CVV2"] = self.cvv2
params.update(item)
# Create recurring payment:
if "BILLINGPERIOD" in params:
return wpp.createRecurringPaymentsProfile(params, direct=True)
# Create single payment:
else:
return wpp.doDirectPayment(params)
示例8: process
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createRecurringPaymentsProfile [as 别名]
def process(self, request, item):
"""
Do a 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)
# Create single payment:
if "billingperiod" not in params:
response = wpp.doDirectPayment(params)
# Create recurring payment:
else:
response = wpp.createRecurringPaymentsProfile(params, direct=True)
return response
示例9: validate_confirm_form
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createRecurringPaymentsProfile [as 别名]
def validate_confirm_form(self):
"""
Final express flow step.
User has pressed the confirm button and now we send it off to PayPal.
"""
wpp = PayPalWPP(self.request)
pp_data = dict(token=self.request.POST['token'], payerid=self.request.POST['PayerID'])
self.item.update(pp_data)
if self.is_recurring:
success = wpp.createRecurringPaymentsProfile(self.item)
else:
success = wpp.doExpressCheckoutPayment(self.item)
if success:
payment_was_successful.send(sender=self.item)
return HttpResponseRedirect(self.success_url)
else:
self.context['errors'] = "There was a problem processing the payment. Please check your information and try again."
return self.render_payment_form()