developers-payu-latam / payu-latam-java-payments-sdk

PayU Latam Java SDK for the Payments API
MIT License
11 stars 30 forks source link

Trying to integrate in Android. for Columbia. It keeps crashing as we are using HttpClient inside it. #40

Open pramodit opened 5 years ago

pramodit commented 5 years ago

Trying to integrate the PayU Latam SDK in Android using the Jar files provided ( payu-java-sdk-1.3.2.jar ) from the website http://developers.payulatam.com/en/sdk/ And i tend to see that it keeps crashing in the library while making a request for createToken API using the HttpClientHelper class inside it.

I checked for the configurations and it seems to be perfect from my end as per the documentation.

        PayU.apiKey = "4Vj8eK4rloUd272L4a8hsasdnUA"; //Enter your ApiKey here.
        PayU.apiLogin = "pRXKKasdskMmt9u"; //Enter your apiLogin here.
        PayU.language = Language.es; //Enter the language you prefer here
        PayU.isTest = true; //Leave it true when testing..
        LoggerUtil.setLogLevel(Level.ALL); //Include it only if you want to
                                          // see all the trace of the log; if you want to
                                          // see the response only, you can delete it.
        //https://api.payulatam.com/payments-api/
        PayU.paymentsUrl = "https://sandbox.api.payulatam.com/payments-api/"; //Include it only if you
                                                                     // want to test a specific payment
                                                                     //server, and display the route of the same.
        PayU.reportsUrl = "https://sandbox.api.payulatam.com/reports-api/"; //Include it only if you
                                                                   // want to test it in a specific
                                                                  // query server, and indicate the path of the same.

        //-- “Create Token” operation--
        Map<String, String> parameters = new HashMap<>();
        //Enter the payer's name here.
        parameters.put(PayU.PARAMETERS.PAYER_NAME, etcardname.getText().toString());
        //Enter the payer's ID here.
        parameters.put(PayU.PARAMETERS.PAYER_ID, "10");
        //Enter the payer's contact document here.
        parameters.put(PayU.PARAMETERS.PAYER_DNI, "32144457");
        //Enter the number of the credit card here
        //4111111111111111
        parameters.put(PayU.PARAMETERS.CREDIT_CARD_NUMBER, etcard.getText().toString());
        //Enter the expiration date of the credit card here
        parameters.put(PayU.PARAMETERS.CREDIT_CARD_EXPIRATION_DATE, etcardcvv.getText().toString());
        //Enter the name of the credit card here
        //parameters.put(PayU.PARAMETERS.PAYMENT_METHOD, "VISA");

        String paymentMethod = Utilities.capitalizeWord(CardUtils.getPossibleCardType(etcard.getText().toString(), true));

        parameters.put(PayU.PARAMETERS.PAYMENT_METHOD, paymentMethod);

        try {
            CreditCardToken response = PayUTokens.create(parameters);

            if (response != null) {
                response.getTokenId();
                response.getMaskedNumber();
                response.getPayerId();
                response.getIdentificationNumber();
                response.getPaymentMethod();

                Log.i("TAG", "PAYU " + response.getTokenId());
           }
        } catch (Exception e) {
            e.printStackTrace();
        }

It keeps crashing in PayUTokens.create line. When i checked inside of it , its using HttpClient for the createToken API and this is the crash log .

java.lang.NoSuchMethodError: No direct method (Ljavax/net/ssl/SSLContext;[Ljava/lang/String;[Ljava/lang/String;Lorg/apache/http/conn/ssl/X509HostnameVerifier;)V in class Lorg/apache/http/conn/ssl/SSLSocketFactory; or its super classes (declaration of 'org.apache.http.conn.ssl.SSLSocketFactory' appears in /system/framework/framework.jar:classes2.dex)

here's the screenshot

Screenshot (104)

pramodit commented 5 years ago

I also attach my app level gradle file

buildscript { repositories { maven { url 'https://maven.fabric.io/public' } google() }

dependencies {
    classpath 'io.fabric.tools:gradle:1.25.4'
}

} apply plugin: 'com.android.application' apply plugin: 'io.fabric'

android { compileSdkVersion 28 useLibrary 'org.apache.http.legacy' defaultConfig { // vectorDrawables.useSupportLibrary = true applicationId "com.Supply" minSdkVersion 15 targetSdkVersion 26 versionCode 21 // fabric uncomment versionName "1.0" multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        /*minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'*/
    }
}
compileOptions {
    targetCompatibility 1.8
    sourceCompatibility 1.8
}

}

repositories { mavenCentral() maven { url "https://repo.eclipse.org/content/repositories/paho-snapshots/" } maven { url 'https://maven.fabric.io/public' }

} dependencies { implementation fileTree(include: ['.jar'], dir: 'libs') implementation files('libs/LiveChatWindow.jar') implementation files('libs/payu-java-sdk-1.3.2.jar')/ { exclude module: "httpclient" }/ //implementation 'org.apache.httpcomponents:httpcore:4.4.1' //noinspection DuplicatePlatformClasses //implementation 'org.apache.httpcomponents:httpclient:4.1' //noinspection GradleCompatible implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:support-v4:28.0.0' implementation 'com.android.support:multidex:1.0.3' implementation 'com.android.support:design:28.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' implementation project(':simplecrop') implementation 'com.google.android.gms:play-services-maps:11.6.2' implementation 'com.android.support:gridlayout-v7:28.0.0' implementation 'com.google.android.gms:play-services-location:11.6.2' implementation 'com.google.android.gms:play-services-places:11.6.2' implementation 'com.google.firebase:firebase-messaging:11.6.2' implementation 'com.google.code.gson:gson:2.8.1' implementation 'com.squareup.okhttp3:okhttp:3.9.1' implementation 'com.squareup.picasso:picasso:2.5.2' implementation 'com.github.bumptech.glide:glide:4.5.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.5.0' implementation 'com.facebook.android:facebook-login:4.29.0' implementation 'com.facebook.android:facebook-share:4.29.0' implementation 'com.amazonaws:aws-android-sdk-core:2.6.14' implementation 'com.amazonaws:aws-android-sdk-s3:2.6.14' implementation 'com.amazonaws:aws-android-sdk-ddb:2.6.14' implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.2-SNAPSHOT' implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1' implementation 'io.reactivex.rxjava2:rxjava:2.0.5' implementation 'com.stripe:stripe-android:6.1.0' implementation 'io.card:android-sdk:5.0.1' implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') { transitive = true; } implementation project(':singledateandtimepicker') implementation 'com.googlecode.libphonenumber:libphonenumber:8.2.0' //compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.4.1' //noinspection DuplicatePlatformClasses implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2' /implementation('org.apache.httpcomponents:httpmime:4.3') { exclude module: "httpclient" }*/ } apply plugin: 'com.google.gms.google-services'

pramodit commented 5 years ago

Can anyone please assist us with the issue @mrdavidhidalgo @juanromanf @guedim @msuevis

pramodit commented 5 years ago

Worst support team ever. they havent't responded yet . still we had the same issues in integration to our android app

neoacevedo commented 5 years ago

Colombia* Es mejor recurrir al SDK del sitio web y pedir soporte de ellos desde el foro de soporte.

guedim commented 5 years ago

@pramodit , please contact the PayU Latam support team:

https://www.payulatam.com/co/preguntas-frecuentes/

AladMocu commented 4 years ago

did you find a solution?

guedim commented 4 years ago

@AladMocu

Please user the PayU Latam support page: https://colombia.payu.com/soporte/