Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation crashing on iOS #47

Open
whitecat opened this issue Mar 26, 2018 · 2 comments
Open

Validation crashing on iOS #47

whitecat opened this issue Mar 26, 2018 · 2 comments

Comments

@whitecat
Copy link

The following three methods are crashing out when run on iOS. I do not get an error. Calling these functions cause iOS to crash.
validateCardNumber
validateCVC
validateExpiryDate

Here is my ionic info:

cli packages: (/Users/leetcat/.nvm/versions/node/v9.8.0/lib/node_modules)
    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:
    cordova (Cordova CLI) : 7.0.1

local packages:
    @ionic/app-scripts : 1.3.0
    Cordova Platforms  : android 7.0.0 browser 4.1.0 ios 4.4.0
    Ionic Framework    : ionic-angular 3.0.1

System:
    ios-deploy        : 1.9.2
    Node              : v9.8.0
    npm               : 5.6.0
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b

Misc:
    backend : pro

I call the methods like this:

        self.stripe.validateCardNumber(stripeRequest.number).then(resp => {
            console.log("CC Validated")
            self.stripe.validateCVC(stripeRequest.cvc).then(resp => {
                console.log("CVC Validated")
                self.stripe.validateExpiryDate(stripeRequest.expMonth, stripeRequest.expYear).then(resp => {
                    console.log("Date Validated")
                    // Everything is valid now let's submit this to Stripe!
                    self.stripe.createCardToken(stripeRequest)
                        .then(token => {
                            //Do Stuff with token
                        })
                        .catch(error => {
                            self.service.hideLoader();
                            console.error(error);
                        });
                }).catch(resp => {
                    this.service.notify('Invalid Expiration Date', 'warning');
                    self.service.hideLoader();
                    return;
                })
            }).catch(resp => {
                this.service.notify('Invalid CVC', 'warning');
                self.service.hideLoader();
                return;
            })
        }).catch(resp => {
            this.service.notify('Invalid Credit Card number', 'warning');
            self.service.hideLoader();
            return;
        })

@hcassar93
Copy link

I am also having this issue. It was previously working.

@Peter1234444
Copy link

Peter1234444 commented Jun 12, 2019

I'm getting the same issue. Version 1.5.3

I made sure to to make each validation function a knock on and instead used "Await", so I could log any errors between each method. What happens is that it successfully goes through the card number and expiry validation methods, but fails at the CVC validation method.

The highlighted code in Xcode is STPCardValidationState state = [STPCardValidator validationStateForCVC:[command.arguments objectAtIndex:0] cardBrand:STPCardBrandUnknown];

The error being logged is [NSNull rangeOfCharacterFromSet:]: unrecognized selector sent to instance 0x1dd96d9d0

When you check out the Stripe docs I can see that their method for validating the CVC actually takes in both CVC number "cvc" and the card brand "brand". Apparently the brand has another method for finding it, called brandForNumber.

Problematically, this error is occurring regardless of the validity of card details entered. My theory is the the issue is something to do with the card brand not being passed as a parameter correctly. Perhaps exposing the brandForNumber method and making the user pass in the brand as an argument may help to stop this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants