Giter Site home page Giter Site logo

rxp-android's People

Contributors

damianjsullivan avatar eduardo76609 avatar leonidbuzmacov avatar realexitso avatar rxp-developers avatar seanmacdomhnall avatar securesubmit-buildmaster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rxp-android's Issues

Problem with Retrofit & Okhttp

When I add the dependency
compile 'com.realexpayments.hpp.sdk:rxp-hpp-android:1.2'
I get this crash error:

java.lang.RuntimeException: Retrofit detected an unsupported OkHttp on the classpath.
To use OkHttp with this version of Retrofit, you'll need:
1. com.squareup.okhttp:okhttp:1.6.0 (or newer)
2. com.squareup.okhttp:okhttp-urlconnection:1.6.0 (or newer)
Note that OkHttp 2.0.0+ is supported!
at retrofit.Platform.hasOkHttpOnClasspath(Platform.java:186)
at retrofit.Platform.access$300(Platform.java:37)
at retrofit.Platform$Android.defaultClient(Platform.java:122)
at retrofit.RestAdapter$Builder.ensureSaneDefaults(RestAdapter.java:686)
at retrofit.RestAdapter$Builder.build(RestAdapter.java:676)
at com.realexpayments.hpp.ApiAdapter.getAdapter(ApiAdapter.java:19)
at com.realexpayments.hpp.HPPManagerFragment.onAttach(HPPManagerFragment.java:93)
at android.app.Fragment.onAttach(Fragment.java:1464)

So adding

compile 'com.squareup.okhttp:okhttp:1.6.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'

I get this error response in hppManagerFailedWithError method:

No virtual method open(Ljava/net/URL;)Ljava/net/HttpURLConnection; in class Lcom/squareup/okhttp/OkHttpClient; or its super classes (declaration of 'com.squareup.okhttp.OkHttpClient' appears in /data/app/com.geomobile.tmbmobile-pmA28ANdnNr8GrLjnwqjlQ==/split_lib_dependencies_apk.apk!classes62.dex)

With updated dependencies to:

compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'

the error changes to

No field METHODS of type Ljava/util/Set; in class Lcom/squareup/okhttp/internal/http/HttpMethod; or its superclasses (declaration of 'com.squareup.okhttp.internal.http.HttpMethod' appears in /data/app/com.geomobile.tmbmobile-Z0HuYnHyWLHllogWx4xbUw==/split_lib_dependencies_apk.apk!classes62.dex)

In my app i'm already using retrofit 2 and okhttp 3

compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'

Any advice? Thanks!

Android integration issue

Hello,

I have some help for RXP integration in android. I have also check all documentation for RXP integration in android. But i have some issue in call payment api so please give me a simple demo for rxp-hpp-android

Thanks.

NullPointerException

The request producer call returned a blank response (which isn't correct) but that causes the whole app to crash:

java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Set java.util.Map.keySet()' on a null object reference
at com.realexpayments.hpp.HPPManagerFragment.getHPPPostData(HPPManagerFragment.java:283)
at com.realexpayments.hpp.HPPManagerFragment.success(HPPManagerFragment.java:269)
at com.realexpayments.hpp.HPPManagerFragment.success(HPPManagerFragment.java:59)
at retrofit.CallbackRunnable$1.run(CallbackRunnable.java:45)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

SDK not compatible with Activities written in Kotlin

When a successful result has been received by the SDK it uses Gson to convert the JSON code into a class. To get the class type the following code is executed in HppManagerFragment in the callbackHandler():

method.getParameterTypes()[0]

When mListener is written in Java, this code will complete successfully. When mListnener is written in Kotlin, instead of the ConsumerResponse type, 'Object' is returned, causing Gson to throw a ClassCastException.

Please make your SDK compatible with Kotlin.

Minimisation with Proguard causes a ClassCastException on GSON

When minimised using Proguard listed below, a ClassCastException occurs.

I believe that this is caused by the following lines (309 - 313 of HPPManagerFragment)
try {
mListener.hppManagerCompletedWithResult(ApiAdapter.getGson().fromJson(msg, method.getParameterTypes()[0]));
} catch (Exception error) {
mListener.hppManagerFailedWithError(new HPPError(msg, error, hppManager.getHppResponseConsumerURL()));
}

Proguard configuration
# Realex Payment
-keep class com.realexpayments.hpp.** { *; }
-keep class com.ex.ample.sync.dto.ConsumerResponse { *; }

-keepattributes Signature

-keepattributes *Annotation*

-keep class sun.misc.Unsafe { *; }

# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

when i integrate in my android application , my app crach

when i integrate in my android application , my app crach in code line
RealexClient client = new RealexClient("Po8lRRT67a", httpConfiguration);
with error message :
E/UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/config/RequestConfig;

and my full integrated code is

  Card card = new Card()
            .addType(Card.CardType.VISA)
            .addNumber("4263970000005262")
            .addExpiryDate("0121")
            .addCvn("123")
            .addCvnPresenceIndicator(Cvn.PresenceIndicator.CVN_PRESENT)
            .addCardHolderName("James Mason");

    PaymentRequest request = new PaymentRequest()
            .addType(PaymentRequest.PaymentType.AUTH)
            .addMerchantId("realexsandbox")
            .addAccount("internet")
            .addAmount(1001)
            .addCurrency("GBP")
            .addCard(card)
            .addAutoSettle(new AutoSettle().addFlag(AutoSettle.AutoSettleFlag.TRUE));

    HttpConfiguration httpConfiguration = new HttpConfiguration();
    httpConfiguration.setEndpoint("https://test.realexpayments.com/epage-remote.cgi");
    RealexClient client = new RealexClient("Po8lRRT67a", httpConfiguration);

    try {
        PaymentResponse response = client.send(request);
        String result = response.getResult(); // '00' == success
        // get the details required for Transaction Management requests
        String paymentsReference = response.getPaymentsReference();
        String orderId = response.getOrderId();
        String authCode = response.getAuthCode();

        Log.d("response",response.getMessage());
    }
    catch (RealexServerException e) {
        Log.d("error",e.getMessage());

    }
    catch (RealexException e) {
        Log.d("error",e.toString());
    }

401 error unauthorized when implementing the API

I've implemented the hppManager as described, translating the Java to Kotlin and have matched the iOS implementation which has worked flawlessly, however I get 401 unauthorized errors.

Any suggestions how to resolve those errors?

NullPointerException - `mListener` is null when trying to deliver error

Issue reported via Sentry.io using v2.0
Here is the Log from Sentry:

java.lang.NullPointerException: Attempt to invoke interface method 'void com.realexpayments.hpp.HPPManagerListener.hppManagerFailedWithError(com.realexpayments.hpp.HPPError)' on a null object reference
    at com.realexpayments.hpp.HPPManagerFragment$3.onReceivedError(HPPManagerFragment.java:251)
    at Uy0.c(chromium-TrichromeWebViewGoogle.aab-stable-495106133:160)
    at P9.handleMessage(chromium-TrichromeWebViewGoogle.aab-stable-495106133:521)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:236)
    at android.app.ActivityThread.main(ActivityThread.java:8043)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)

Please add support library fragment

Dear Realexpayments,

We use android.support.v4.Fragment classes in our project and we cannot use them in combination with HPPFragment, which is of type android.app.Fragment. Looking at your code it would be possible to extend the HPPManager interface with something like manager.newCompatInstance() and return a HPPManager fragment with type android.support.v4.Fragment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.