Do better job of disabling/enabling stripe button.

This commit is contained in:
bsimpson63
2013-02-27 19:52:42 -05:00
committed by Max Goodman
parent c32fdd1adf
commit baf48978e1
3 changed files with 7 additions and 9 deletions

View File

@@ -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:

View File

@@ -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;

View File

@@ -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,