Git Product home page Git Product logo

connect-sdk-java's People

Contributors

ingenicoepayments avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

connect-sdk-java's Issues

Installing SDK fails on test cases

Trying to run a mvn clean install, resulting in a test case error:

Tests run: 12, Failures: 11, Errors: 0, Skipped: 0, Time elapsed: 0.278 sec <<< FAILURE! - in com.ingenico.connect.gateway.sdk.java.defaultimpl.DefaultConnectionLoggerTest

Can work around with a mvn clean install -Dmaven.test.skip=true.

Signature fails for some JMV Locale

DefaultAuthenticator authentication should not depend on the default JVM Locale
The current implementation will not generate the same signature based on the jvm default locale

Example :
if your jvm is set to the tr locale (running with -Duser.language=tr or changing the os language)
then the connect server will reject the api call (MISSING_OR_INVALID_AUTHORIZATION)

Memory inefficient Json conversion.

In it's current implementation the connect api calls are allocating twice the memory it needs when converting the server response.

The current steps from the network response to the java object are :
network stream -> org.apache.http.util.CharArrayBuffer -> String -> Gson -> Java Object

The steps network stream -> org.apache.http.util.CharArrayBuffer -> String are done in the org.apache.http.util.EntityUtils.toString(HttpEntity, Charset) method (called in DefaultConnection#executeRequest)

This doubles (at least) the memory allocated to convert the server response to a java object.

Most of the rest clients in use are doing the json conversion directly from the network stream.
Examples :

In Spring RestTemplate (which also use apache http components)

  • see org.springframework.http.client.HttpComponentsClientHttpRequest for the request execution
  • see org.springframework.http.client.HttpComponentsClientHttpResponse#getBody
  • see org.springframework.http.converter.json.(AbstractJsonHttpMessageConverter and GsonHttpMessageConverter) for Gson based converter examples

In retrofit

  • see retrofit2.converter.gson.GsonResponseBodyConverter
  • see okhttp3.ResponseBody

NullPointerException instead of GlobalCollectException on http 500

In order to improve our application resilience, we are generating errors when calling the connect plateform.
The calls are done with the connect sdk but the endpoint is a fake one.
This mock endpoint returns all kinds of errors (4xx, 5xx, timeout, bad json, etc..)

Please note that those tests were made to verify our application not the sdk.

But for one of our test, the sdk is return a NullPointerException which is not the expected behaviour.
In this case our mock returns a http status 500 with an empty body.
The NPE is coming from :

throw new IllegalArgumentException("unsupported error object type: " + errorObject.getClass().getName());

as the errorObject is null.
It raises a NPE instead of the IllegalArgumentException

After reading the documentation, we think that this error should throw a GlobalCollectException and not a NPE or IllegalArgumentException.

Extract from the connect documentation :

A GlobalCollectException if something went wrong on the Ingenico ePayments platform.
The Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Missing fields

Hi!
I'm using the SDK feature by feature, and for now I'm having missing fields on several objects:

  • CreateHostedCheckoutResponse.redirectUrl
  • GetHostedCheckoutResponse.createdPaymentOutput.payment.paymentOutput.references.merchantParameters
    Maybe there are more, but for now I'm stuck with this parameters being absent from the model.

Question Regarding Importing The SDK using sbt

I am trying to get dependency using sbt. what should i put in the libraryDependencies
i tried
libraryDependencies += "com.ingenico.connect.gateway" %% "connect-sdk-java" % "1.0.34"

but got error in dependency resolution

The query string of returnUrl is ignored when using hostedcheckouts

Hello. I am trying to use 'hostedcheckouts' following the information the information found here:

https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/json/hostedcheckouts/create.html?paymentPlatform=ALL#hostedcheckouts-create-request

returnUrl

Description
The URL that the customer is redirect to after the payment flow has finished. You can add any number of key value pairs in the query string that, for instance help you to identify the customer when they return to your site. Please note that we will also append some additional key value pairs that will also help you with this identification process.
Note: The provided URL should be absolute and contain the protocol to use, e.g. http:// or https://. For use on mobile devices a custom protocol can be used in the form of protocol://. This protocol must be registered on the device first.
URLs without a protocol will be rejected.

The returnURL is not fully used when the POST method is called - the query string is not used!

I am not using a SDK but I've tested my code using curl to POST a request using an URL with parameters and that part works!

Wrong behaviour on "Authorization - Pending" test case

Refer to your "test cases" documentation for Visa or MasterCard, there is 3 amount dedicated for testing declined payment authorization:

  • 12.04 € for "Uncertain",
  • 13.04 € for "Refused" and
  • 14.04 € for "Pending"

When these test cases thrown a ResponseException, you catch it in PaymentsClient, line 101.

In 12.04 € & 13.04 € cases, the ResponseException has a status code of 402.

So we fall into an errorType of PaymentErrorResponse.class :
errorType = PaymentErrorResponse.class; (PaymentsClient line 108)

And finally your client return a DeclinedPaymentException in ApiResource line 80 :
return new DeclinedPaymentException(statusCode, responseBody, (PaymentErrorResponse) errorObject);

That allow us to retrieve informations about the declined payment in the CreatePaymentResult.

But with 14.04 € case, the ResponseException has a status code of 500.

So it fall into default errorType wich is ErrorResponse.class :
errorType = ErrorResponse.class; (PaymentsClient line 120)

And finally your client return a GlobalCollectException in ApiResource line 131 :
return new GlobalCollectException(statusCode, responseBody, errorId, errors);

But as shown in the response body of the 14.04 € test case :

com.ingenico.connect.gateway.sdk.java.GlobalCollectException: the Ingenico ePayments platform returned an error response;
statusCode=500;
responseBody='{
   "errorId" : "5ba21df82753eab725a956f4424d3726",
   "errors" : [ {
      "code" : "9999",
      "id" : "UNKNOWN_SERVER_ERROR",
      "category" : "CONNECT_PLATFORM_ERROR",
      "message" : "UNKNOWN_SERVER_ERROR",
      "httpStatusCode" : 500
   } ],
   "paymentResult" : {
      "payment" : {
         "id" : "xxxxxxxxxx_x",
         "paymentOutput" : {
            "amountOfMoney" : {
               "amount" : 1404,
               "currencyCode" : "EUR"
            },
            "references" : {
               "merchantReference" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
            },
            "paymentMethod" : "card",
            "cardPaymentMethodSpecificOutput" : {
               "paymentProductId" : 1,
               "fraudResults" : {
                  "fraudServiceResult" : "accepted"
               },
               "threeDSecureResults" : {
                  "eci" : "9"
               },
               "card" : {
                  "cardNumber" : "XXXXXXXXXXXXXXXX",
                  "expiryDate" : "XXXX"
               },
               "token" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
            }
         },
         "status" : "REJECTED",
         "statusOutput" : {
            "isCancellable" : false,
            "statusCategory" : "UNSUCCESSFUL",
            "statusCode" : 2,
            "isAuthorized" : false,
            "isRefundable" : false
         }
      }
   }
}'

There is a payment result, so the status code should be 402 to allow us to retrieve informations about the declined payment.

Not able to download dependency

Hi ,
I am not able to download the dependency using maven or sbt. It seems the jar is not available in maven central repository. Can someone please check this.

Hosted Checkouts integration with Sofort returns http 500

I'm trying to integrate with Sofort payment method using Hosted Checkouts on the sandbox environment. When I select Sofort payment, I expect a redirect to Sofort, but it instantly returns me to my page with a HTTP Code 500, payment status "REJECTED", error message: "Exception, invalid data" and error code: 15000960. I've tested my application with other redirect payment methods such as PayPal, iDEAL and it works fine.

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.