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

[Android] createToken not handling incorrect numbers #405

Closed
ghost opened this issue Jul 7, 2021 · 6 comments
Closed

[Android] createToken not handling incorrect numbers #405

ghost opened this issue Jul 7, 2021 · 6 comments
Labels
bug Something isn't working P1 Address these issues second

Comments

@ghost
Copy link

ghost commented Jul 7, 2021

Describe the bug
when i input bank number into cardfield number on Android it's pass , no error (ios show error number red color but not android) then when i create token with that number , my app got crash

To Reproduce
Steps to reproduce the behavior:

  1. Go to number field in card field
  2. input bank number
  3. See error

Expected behavior
the bank number will change to red color - mean it's not card number

Screenshots
Screen Shot 2021-07-07 at 22 40 59

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@thorsten-stripe
Copy link
Contributor

Can you clarify the exact number you're inputting? On my end I get "Card details not complete" error when calling createToken with an incomplete number.

@thorsten-stripe thorsten-stripe added the question Further information is requested label Jul 12, 2021
@ghost
Copy link
Author

ghost commented Jul 13, 2021

Can you clarify the exact number you're inputting? On my end I get "Card details not complete" error when calling createToken with an incomplete number.

@thorsten-stripe
here is my test number 9704231300893972. I'm using CardField on android and input this number but got crash app even i put try catch when i call createToken

Screen Shot 2021-07-13 at 09 19 16

@thorsten-stripe
Copy link
Contributor

I'm able to reproduce this. Thanks for reporting @Sotatek-AnNguyen3

@thorsten-stripe thorsten-stripe added bug Something isn't working P1 Address these issues second and removed question Further information is requested labels Jul 13, 2021
@thorsten-stripe thorsten-stripe changed the title Android card field can't show error when input bank number [Android] createToken not handling incorrect numbers Jul 13, 2021
@ghost
Copy link
Author

ghost commented Jul 13, 2021

@thorsten-stripe
this problem also happen if you enter wrong year exp example : 99 , it's will make app crash . And other bug is when i input mounth and year exp then input cvc then i re-input mounth and year exp , CardField won't recognize the new value . thank you very much sir .

@souhe
Copy link
Collaborator

souhe commented Jul 14, 2021

Hi @Sotatek-AnNguyen3, I reproduced the issue and figured out what is wrong. We will have to fix the error handling for createToken function so it won't crash your app and you will be able to get the error in your code. After this fix you will be able to get the error message from res.error.message like with every other stripe function without the app crash.

Regarding the number validation (highlighting number in red) it has to be improved on the native Android SDK @thorsten-stripe

@vivekmahato26
Copy link

vivekmahato26 commented Jul 26, 2021

App crashes after installing stripe-react-native sdk with error "java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;". After removing the SDK the app runs fine.

My build.gradle file "

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

def jscFlavor = 'org.webkit:android-jsc:+'

def enableHermes = project.ext.react.get("enableHermes", false);

android {
ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId "com.vevibes"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://reactnative.dev/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // https://developer.android.com/studio/build/configure-apk-splits.html
        // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    defaultConfig.versionCode * 1000 + versionCodes.get(abi)
        }

    }
}

}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
//implementation 'com.stripe:stripe-android:17.0.0'
implementation "com.google.android.gms:play-services-maps:17.0.1"
// implementation "com.google.android.gms:play-services-tagmanager:17.0.0"
implementation "com.google.android.gms:play-services-base:17.6.0"
//implementation "com.google.android.gms:play-services-wallet:18.1.3"
implementation "com.google.android.gms:play-services-auth:19.2.0"
implementation "com.google.android.gms:play-services-auth-api-phone:17.5.1"
implementation "com.facebook.react:react-native:+" // From node_modules

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
  exclude group:'com.facebook.fbjni'
}

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
    exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
}

if (enableHermes) {
    def hermesPath = "../../node_modules/hermes-engine/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
    implementation jscFlavor
}

}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 Address these issues second
Projects
None yet
Development

No branches or pull requests

4 participants