本文整理汇总了Python中r2.lib.authorize.edit_profile函数的典型用法代码示例。如果您正苦于以下问题:Python edit_profile函数的具体用法?Python edit_profile怎么用?Python edit_profile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edit_profile函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: POST_update_pay
def POST_update_pay(self, form, jquery, link, campaign, customer_id, pay_id,
edit, address, creditcard):
address_modified = not pay_id or edit
form_has_errors = False
if address_modified:
if (form.has_errors(["firstName", "lastName", "company", "address",
"city", "state", "zip",
"country", "phoneNumber"],
errors.BAD_ADDRESS) or
form.has_errors(["cardNumber", "expirationDate", "cardCode"],
errors.BAD_CARD)):
form_has_errors = True
elif g.authorizenetapi:
pay_id = edit_profile(c.user, address, creditcard, pay_id)
else:
pay_id = 1
# if link is in use or finished, don't make a change
if pay_id and not form_has_errors:
# valid bid and created or existing bid id.
# check if already a transaction
if g.authorizenetapi:
success, reason = promote.auth_campaign(link, campaign, c.user,
pay_id)
else:
success = True
if success:
form.redirect(promote.promo_edit_url(link))
else:
form.set_html(".status",
reason or
_("failed to authenticate card. sorry."))
开发者ID:Chef1991,项目名称:reddit,代码行数:31,代码来源:promotecontroller.py
示例2: POST_update_pay
def POST_update_pay(self, form, jquery, link, campaign, customer_id, pay_id,
edit, address, creditcard):
if not g.authorizenetapi:
return
if not link or not campaign or link._id != campaign.link_id:
return abort(404, 'not found')
# Check inventory
if campaign_has_oversold_error(form, campaign):
return
# check that start is not so late that authorization hold will expire
max_start = promote.get_max_startdate()
if campaign.start_date > max_start:
msg = _("please change campaign start date to %(date)s or earlier")
date = format_date(max_start, format="short", locale=c.locale)
msg %= {'date': date}
form.set_html(".status", msg)
return
# check the campaign start date is still valid (user may have created
# the campaign a few days ago)
now = promote.promo_datetime_now()
min_start = now + timedelta(days=g.min_promote_future)
if campaign.start_date.date() < min_start.date():
msg = _("please change campaign start date to %(date)s or later")
date = format_date(min_start, format="short", locale=c.locale)
msg %= {'date': date}
form.set_html(".status", msg)
return
address_modified = not pay_id or edit
if address_modified:
address_fields = ["firstName", "lastName", "company", "address",
"city", "state", "zip", "country", "phoneNumber"]
card_fields = ["cardNumber", "expirationDate", "cardCode"]
if (form.has_errors(address_fields, errors.BAD_ADDRESS) or
form.has_errors(card_fields, errors.BAD_CARD)):
return
pay_id = edit_profile(c.user, address, creditcard, pay_id)
reason = None
if pay_id:
success, reason = promote.auth_campaign(link, campaign, c.user,
pay_id)
if success:
form.redirect(promote.promo_edit_url(link))
return
msg = reason or _("failed to authenticate card. sorry.")
form.set_html(".status", msg)
开发者ID:6r3nt,项目名称:reddit,代码行数:55,代码来源:promotecontroller.py
示例3: POST_update_pay
def POST_update_pay(self, form, jquery, bid, link, customer_id, pay_id,
edit, address, creditcard):
address_modified = not pay_id or edit
if address_modified:
if (form.has_errors(["firstName", "lastName", "company", "address",
"city", "state", "zip",
"country", "phoneNumber"],
errors.BAD_ADDRESS) or
form.has_errors(["cardNumber", "expirationDate", "cardCode"],
errors.BAD_CARD)):
pass
else:
pay_id = edit_profile(c.user, address, creditcard, pay_id)
if form.has_errors('bid', errors.BAD_BID) or not bid:
pass
# if link is in use or finished, don't make a change
elif link.promote_status == promote.STATUS.promoted:
form.set_html(".status",
_("that link is currently promoted. "
"you can't update your bid now."))
elif link.promote_status == promote.STATUS.finished:
form.set_html(".status",
_("that promotion is already over, so updating "
"your bid is kind of pointless, don't you think?"))
# don't create or modify a transaction if no changes have been made.
elif (link.promote_status > promote.STATUS.unpaid and
not address_modified and
getattr(link, "promote_bid", "") == bid):
form.set_html(".status",
_("no changes needed to be made"))
elif pay_id:
# valid bid and created or existing bid id.
# check if already a transaction
if promote.auth_paid_promo(link, c.user, pay_id, bid):
form.redirect(promote.promo_edit_url(link))
else:
form.set_html(".status",
_("failed to authenticate card. sorry."))
开发者ID:kevinrose,项目名称:diggit,代码行数:38,代码来源:promotecontroller.py
示例4: POST_update_pay
def POST_update_pay(self, form, jquery, link, campaign, customer_id, pay_id,
edit, address, creditcard):
if not g.authorizenetapi:
return
if not link or not campaign or link._id != campaign.link_id:
return abort(404, 'not found')
# Check inventory
if campaign_has_oversold_error(form, campaign):
return
# check the campaign dates are still valid (user may have created
# the campaign a few days ago)
min_start, max_start, max_end = promote.get_date_limits(
link, c.user_is_sponsor)
if campaign.start_date.date() > max_start:
msg = _("please change campaign start date to %(date)s or earlier")
date = format_date(max_start, format="short", locale=c.locale)
msg %= {'date': date}
form.set_text(".status", msg)
return
if campaign.start_date.date() < min_start:
msg = _("please change campaign start date to %(date)s or later")
date = format_date(min_start, format="short", locale=c.locale)
msg %= {'date': date}
form.set_text(".status", msg)
return
new_payment = not pay_id
address_modified = new_payment or edit
if address_modified:
address_fields = ["firstName", "lastName", "company", "address",
"city", "state", "zip", "country", "phoneNumber"]
card_fields = ["cardNumber", "expirationDate", "cardCode"]
if (form.has_errors(address_fields, errors.BAD_ADDRESS) or
form.has_errors(card_fields, errors.BAD_CARD)):
return
pay_id = edit_profile(c.user, address, creditcard, pay_id)
if pay_id:
promote.new_payment_method(user=c.user, ip=request.ip, address=address, link=link)
if pay_id:
success, reason = promote.auth_campaign(link, campaign, c.user,
pay_id)
if success:
hooks.get_hook("promote.campaign_paid").call(link=link, campaign=campaign)
if not address and g.authorizenetapi:
profiles = get_account_info(c.user).paymentProfiles
profile = {p.customerPaymentProfileId: p for p in profiles}[pay_id]
address = profile.billTo
promote.successful_payment(link, campaign, request.ip, address)
jquery.payment_redirect(promote.promo_edit_url(link), new_payment, campaign.bid)
return
else:
promote.failed_payment_method(c.user, link)
msg = reason or _("failed to authenticate card. sorry.")
form.set_text(".status", msg)
else:
promote.failed_payment_method(c.user, link)
form.set_text(".status", _("failed to authenticate card. sorry."))
开发者ID:2ndnotch,项目名称:reddit,代码行数:71,代码来源:promotecontroller.py
注:本文中的r2.lib.authorize.edit_profile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论