Better language around renewing and changing credit cards.

This commit is contained in:
Samuel Clay 2018-05-03 15:38:59 -07:00
parent 078c287ddf
commit 5952e0b4b0
5 changed files with 31 additions and 10 deletions

View file

@ -26,7 +26,7 @@ from apps.social.models import MSocialServices, MActivity, MSocialProfile
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
from utils import json_functions as json
from utils.user_functions import ajax_login_required
from utils.view_functions import render_to
from utils.view_functions import render_to, is_true
from utils.user_functions import get_user
from utils import log as logging
from vendor.paypalapi.exceptions import PayPalAPIResponseError
@ -334,6 +334,7 @@ def stripe_form(request):
stripe.api_key = settings.STRIPE_SECRET
plan = int(request.GET.get('plan', 2))
plan = PLANS[plan-1][0]
renew = is_true(request.GET.get('renew', False))
error = None
if request.method == 'POST':
@ -388,6 +389,10 @@ def stripe_form(request):
new_user_queue_behind = new_user_queue_count - new_user_queue_position
new_user_queue_position -= 1
immediate_charge = True
if user.profile.premium_expire and user.profile.premium_expire > datetime.datetime.now():
immediate_charge = False
logging.user(request, "~BM~FBLoading Stripe form")
return render_to_response('profile/stripe_form.xhtml',
@ -398,6 +403,8 @@ def stripe_form(request):
'new_user_queue_count': new_user_queue_count - 1,
'new_user_queue_position': new_user_queue_position,
'new_user_queue_behind': new_user_queue_behind,
'renew': renew,
'immediate_charge': immediate_charge,
'error': error,
},
context_instance=RequestContext(request)

View file

@ -175,6 +175,13 @@
display: block;
font-weight: bold;
}
.NB-static-form .payment-notice {
margin: 8px 0 0 150px;
color: #606060;
display: block;
font-weight: 300;
font-size: 11px;
}
.NB-static-form .payextra-label {
clear: none;

View file

@ -320,10 +320,11 @@ _.extend(NEWSBLUR.ReaderAccount.prototype, {
},
close_and_load_premium: function() {
this.close(function() {
NEWSBLUR.reader.open_feedchooser_modal({'premium_only': true});
});
close_and_load_premium: function(options) {
options = _.extend({}, {'premium_only': true}, options);
this.close(function() {
NEWSBLUR.reader.open_feedchooser_modal(options);
});
},
cancel_premium: function() {
@ -496,7 +497,7 @@ _.extend(NEWSBLUR.ReaderAccount.prototype, {
$.targetIs(e, { tagSelector: '.NB-account-premium-renew' }, function($t, $p) {
e.preventDefault();
self.close_and_load_premium();
self.close_and_load_premium({'renew': true});
});
$.targetIs(e, { tagSelector: '.NB-account-premium-cancel' }, function($t, $p) {
e.preventDefault();

View file

@ -176,7 +176,7 @@ _.extend(NEWSBLUR.ReaderFeedchooser.prototype, {
$.make('div', {
className: "NB-stripe-button NB-modal-submit-button NB-modal-submit-green"
}, [
"Pay by",
(this.options.renew ? "Renew by" : "Pay by"),
$.make('br'),
"Credit Card"
])
@ -465,7 +465,8 @@ _.extend(NEWSBLUR.ReaderFeedchooser.prototype, {
},
open_stripe_form: function() {
window.location.href = "https://" + NEWSBLUR.URLs.domain + "/profile/stripe_form?plan=" + this.plan;
var renew = (this.options.renew ? "&renew=true" : "");
window.location.href = "https://" + NEWSBLUR.URLs.domain + "/profile/stripe_form?plan=" + this.plan + renew;
},
choose_dollar_amount: function(plan) {

View file

@ -132,8 +132,13 @@ float: right;">
<noscript><h3>Note:&nbsp; this form requires Javascript to use.</h3></noscript>
<span class="payment-errors"></span>
<button type="submit" class="submit-button NB-modal-submit-button NB-modal-submit-green">Submit Payment</button>
<button type="submit" class="submit-button NB-modal-submit-button NB-modal-submit-green">{% if renew %}Switch to this Credit Card{% else %}Submit Payment{% endif %}</button>
<span class="payment-notice">
{% if immediate_charge and user.profile.premium_expire %}
You will not be charged until {{ user.profile.premium_expire|date:"F j, Y" }}
{% endif %}
</span>
</form>
</div>