Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Expiry date problem #19

Closed
sergyv opened this issue Feb 12, 2014 · 3 comments · Fixed by #22 · May be fixed by #32 or #45
Closed

Expiry date problem #19

sergyv opened this issue Feb 12, 2014 · 3 comments · Fixed by #22 · May be fixed by #32 or #45

Comments

@sergyv
Copy link

sergyv commented Feb 12, 2014

If expiry date is entered incorrectly eg 12/222 and then the user left the expiry field to input other things. When he comes back to fix expiry it still stays the old value for some reason. So I would get an error:
{"error":{"message":"Your card's expiration year is invalid.","type":"card_error","param":"exp_year","code":"invalid_expiry_year"}}

@jamesblackwell
Copy link

Yep got this as well, seems that if you remove the checks below it works. This code seems to be the culprit. Not sure why it was added. It stops the updated form values from being submitted by using the old values. I think the current form values should just be sent everytime

                    var expMonthUsed = scope.expMonth ? true : false;
                    var expYearUsed = scope.expYear ? true : false;

                    if (!(expMonthUsed && expYearUsed)) {
                        var exp = Common.parseExpiry(scope.expiry);
                        scope.expMonth = exp.month;
                        scope.expYear = exp.year;
                    }

cubicleWar added a commit to cubicleWar/ng-stripe-payments that referenced this issue Apr 17, 2014
…urihy#19).

* Added main entry point for bower.
* Bumped version number.
@siygle
Copy link

siygle commented Aug 21, 2014

I also agree with @jamesblackwell , the check there is meaningless and should get the new value every time user submit the form.

@anthonypleshek
Copy link

It's been a while since I've looked at this, but if I remember correctly, the check needs to be there in situations where the UI has separate fields for scope.expMonth and scope.expYear. Getting the values from scope.expiry only makes sense if scope.expiry is actually being used.

Changing the lines

scope.expiryMonth = expMonthUsed ? scope.expMonth : null;
scope.expiryYear = expYearUsed ? scope.expMonth : null;

to

scope.expMonth = expMonthUsed ? scope.expMonth : null;
scope.expYear = expYearUsed ? scope.expYear : null;

as in #32 fixes the issue for scope.expiry without breaking the use of scope.expMonth and scope.expYear as individual fields.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.