Skip to content

Commit 1f31da7

Browse files
authored
Merge pull request payolapayments#297 from meesterdude/patch-1
adds single exp field support to validation
2 parents 0de7ceb + 8043e2b commit 1f31da7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

app/assets/javascripts/payola/subscription_form_onestep.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ var PayolaOnestepSubscriptionForm = {
2727
PayolaOnestepSubscriptionForm.showError(form, 'The card number is not a valid credit card number.');
2828
return false;
2929
}
30-
31-
var expMonth = $("[data-stripe='exp_month']").val();
32-
var expYear = $("[data-stripe='exp_year']").val();
33-
if (!Stripe.card.validateExpiry(expMonth, expYear)) {
30+
if ($("[data-stripe='exp']").length){
31+
var valid = !Stripe.card.validateExpiry($("[data-stripe='exp']").val());
32+
}else{
33+
var expMonth = $("[data-stripe='exp_month']").val();
34+
var expYear = $("[data-stripe='exp_year']").val();
35+
var valid = !Stripe.card.validateExpiry(expMonth, expYear);
36+
}
37+
if (valid) {
3438
PayolaOnestepSubscriptionForm.showError(form, "Your card's expiration month/year is invalid.");
3539
return false;
3640
}

0 commit comments

Comments
 (0)