Class HttpTerminalTransport

java.lang.Object
com.codename1.payment.terminal.HttpTerminalTransport
All Implemented Interfaces:
TerminalTransport

public class HttpTerminalTransport extends Object implements TerminalTransport

The default TerminalTransport, over ConnectionRequest.

Error statuses are answered like any other: a provider's error body is what says why a request failed, so it is read and handed on rather than turned into a dialog.

  • Constructor Details

    • HttpTerminalTransport

      public HttpTerminalTransport()
  • Method Details

    • setTimeout

      public void setTimeout(int timeout)

      The read timeout in milliseconds. Defaults to three minutes, because a synchronous terminal request is answered only once the customer has tapped (Adyen's /sync waits up to 150 seconds).

      Parameters
      • timeout: the timeout in milliseconds
    • setInsecure

      public void setInsecure(boolean insecure)

      Makes sure a request can run while a long one holds a network thread. Adyen's /sync payment stays open until the customer taps; with the default single network thread, the abort that cancels it would wait behind it and arrive only after the payment had ended, and every other request of the app would wait too. Raises the thread count to two, only while the queue is idle, because restarting the threads drops whatever they are running. The count stays at two afterwards.

      Returns

      true when two or more network threads are running Skips the platform's certificate check, for a terminal on the shop's network whose certificate names no host a device can verify. Only for a protocol that authenticates its messages itself, as Adyen's local Terminal API does with its shared key: without that, anyone on the network could answer in the terminal's place.

      Parameters
      • insecure: true to skip the check
    • prepareForLongRequest

      public boolean prepareForLongRequest()
    • send

      public void send(String method, String url, Map<String,String> headers, String contentType, String body, TerminalTransport.Callback callback)
      Description copied from interface: TerminalTransport

      Performs one request. Exactly one of the callback's methods must be called, on the EDT.

      Parameters
      • method: GET or POST

      • url: the absolute URL

      • headers: request headers; may be empty, never null

      • contentType: the body's content type, or null for a bodiless request

      • body: the request body, or null

      • callback: receives the outcome

      Specified by:
      send in interface TerminalTransport