mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-29 00:38:11 -05:00
Do better job of disabling/enabling stripe button.
This commit is contained in:
@@ -749,12 +749,12 @@ class StripeController(GoldPaymentController):
|
||||
customer['active_card']['address_zip_check'] == 'fail'):
|
||||
form.set_html('.status',
|
||||
_('error: address verification failed'))
|
||||
form.find('.stripe-submit').removeClass("disabled").end()
|
||||
form.find('.stripe-submit').removeAttr('disabled').end()
|
||||
return
|
||||
|
||||
if customer['active_card']['cvc_check'] == 'fail':
|
||||
form.set_html('.status', _('error: cvc check failed'))
|
||||
form.find('.stripe-submit').removeClass("disabled").end()
|
||||
form.find('.stripe-submit').removeAttr('disabled').end()
|
||||
return
|
||||
|
||||
charge = stripe.Charge.create(
|
||||
@@ -765,6 +765,7 @@ class StripeController(GoldPaymentController):
|
||||
)
|
||||
except stripe.CardError as e:
|
||||
form.set_html('.status', 'error: %s' % e.message)
|
||||
form.find('.stripe-submit').removeAttr('disabled').end()
|
||||
except stripe.InvalidRequestError as e:
|
||||
form.set_html('.status', _('invalid request'))
|
||||
except stripe.APIConnectionError as e:
|
||||
|
||||
@@ -5435,7 +5435,7 @@ body:not(.gold) .allminus-link {
|
||||
text-shadow: 0px 1px 0px hsla(0,0%,100%,.7);
|
||||
}
|
||||
|
||||
.gold-button.disabled {
|
||||
.gold-button.disabled, .gold-button:disabled {
|
||||
color: #999;
|
||||
background-color: #ccc;
|
||||
border-color: #aaa;
|
||||
|
||||
@@ -134,9 +134,8 @@ r.gold = {
|
||||
cardZip = form.find('.card-address_zip').val()
|
||||
|
||||
var stripeResponseHandler = function(status, response) {
|
||||
window.clearTimeout(workingTimer)
|
||||
if (response.error) {
|
||||
submit.removeClass("disabled")
|
||||
submit.removeAttr('disabled')
|
||||
status.html(response.error.message)
|
||||
} else {
|
||||
token.val(response.id)
|
||||
@@ -164,10 +163,8 @@ r.gold = {
|
||||
status.text(r.strings('missing_credit_zip'))
|
||||
} else {
|
||||
|
||||
var workingTimer = setTimeout(function () {
|
||||
submit.addClass('disabled')
|
||||
}, 200)
|
||||
|
||||
status.text('')
|
||||
submit.attr('disabled', 'disabled')
|
||||
Stripe.createToken({
|
||||
name: cardName,
|
||||
number: cardNumber,
|
||||
|
||||
Reference in New Issue
Block a user