Search Results for

    Show / Hide Table of Contents

    Class Communicator

    Used to communicate with the Ingenico ePayments platform web services.

    Inheritance
    object
    Communicator
    Implements
    IDisposable
    ILoggingCapable
    IObfuscationCapable
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Ingenico.Connect.Sdk
    Assembly: connect-sdk-dotnet.dll
    Syntax
    public class Communicator : IDisposable, ILoggingCapable, IObfuscationCapable
    Remarks

    It contains all the logic to transform a request object to a HTTP request and a HTTP response to a response object. It is also thread safe.

    Constructors

    Communicator(Session, IMarshaller)

    Declaration
    public Communicator(Session session, IMarshaller marshaller)
    Parameters
    Type Name Description
    Session session
    IMarshaller marshaller

    Properties

    BodyObfuscator

    The current non-null body obfuscator to use.

    Declaration
    public BodyObfuscator BodyObfuscator { set; }
    Property Value
    Type Description
    BodyObfuscator

    HeaderObfuscator

    The current non-null header obfuscator to use.

    Declaration
    public HeaderObfuscator HeaderObfuscator { set; }
    Property Value
    Type Description
    HeaderObfuscator

    Marshaller

    Gets the IMarshaller object associated with this communicator. Never null.

    Declaration
    public IMarshaller Marshaller { get; }
    Property Value
    Type Description
    IMarshaller

    Methods

    AddGenericHeaders(HttpMethod, Uri, IEnumerable<IRequestHeader>, CallContext)

    Adds the necessary headers to the given list of headers. This includes the authorization header, which uses other headers, so when you need to override this method, make sure to call base.AddGenericHeaders at the end of your overridden method.

    Declaration
    protected IEnumerable<IRequestHeader> AddGenericHeaders(HttpMethod httpMethod, Uri uri, IEnumerable<IRequestHeader> requestHeaders, CallContext context)
    Parameters
    Type Name Description
    HttpMethod httpMethod
    Uri uri
    IEnumerable<IRequestHeader> requestHeaders
    CallContext context
    Returns
    Type Description
    IEnumerable<IRequestHeader>

    CloseExpiredConnections()

    Utility method that delegates the call to this communicator's session's connection if that's an instance of IPooledConnection. If not this method does nothing. CloseExpiredConnections()

    Declaration
    public void CloseExpiredConnections()

    CloseIdleConnections(TimeSpan)

    Utility method that delegates the call to this communicator's session's connection if that's an instance of IPooledConnection.

    Declaration
    public void CloseIdleConnections(TimeSpan timespan)
    Parameters
    Type Name Description
    TimeSpan timespan

    Idle time.

    Delete(string, IEnumerable<IRequestHeader>, AbstractParamRequest, Action<Stream, IEnumerable<IResponseHeader>>, CallContext)

    Corresponds to the HTTP DELETE method.

    Declaration
    public Task Delete(string relativePath, IEnumerable<IRequestHeader> requestHeaders, AbstractParamRequest requestParameters, Action<Stream, IEnumerable<IResponseHeader>> bodyHandler, CallContext context)
    Parameters
    Type Name Description
    string relativePath

    The path to call, relative to the base URI.

    IEnumerable<IRequestHeader> requestHeaders

    An optional list of request headers.

    AbstractParamRequest requestParameters

    The optional set of request parameters.

    Action<Stream, IEnumerable<IResponseHeader>> bodyHandler

    A callback that receives the contents of the body as a stream

    CallContext context

    The optional call context to use

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    CommunicationException

    when an exception occurred communicating with the Ingenico ePayments platform

    ResponseException

    when an error response was received from the Ingenico ePayments platform

    ApiException

    when an error response was received from the Ingenico ePayments platform which contained a list of errors

    BodyHandlerException

    when the BodyHandler throws an exception

    Delete<T>(string, IEnumerable<IRequestHeader>, AbstractParamRequest, CallContext)

    Corresponds to the HTTP DELETE method.

    Declaration
    public Task<T> Delete<T>(string relativePath, IEnumerable<IRequestHeader> requestHeaders, AbstractParamRequest requestParameters, CallContext context)
    Parameters
    Type Name Description
    string relativePath

    The path to call, relative to the base URI.

    IEnumerable<IRequestHeader> requestHeaders

    An optional list of request headers.

    AbstractParamRequest requestParameters

    The optional set of request parameters.

    CallContext context

    The optional call context to use

    Returns
    Type Description
    Task<T>
    Type Parameters
    Name Description
    T

    Type of the response.

    Exceptions
    Type Condition
    CommunicationException

    when an exception occurred communicating with the Ingenico ePayments platform

    ResponseException

    when an error response was received from the Ingenico ePayments platform

    ApiException

    when an error response was received from the Ingenico ePayments platform which contained a list of errors

    DisableLogging()

    Turns off logging.

    Declaration
    public void DisableLogging()

    Dispose()

    Releases all resource used by the Communicator object.

    Declaration
    public void Dispose()
    Remarks

    Call Dispose() when you are finished using the Communicator. The Dispose() method leaves the Communicator in an unusable state. After calling Dispose(), you must release all references to the Communicator so the garbage collector can reclaim the memory that the Communicator was occupying.

    EnableLogging(ICommunicatorLogger)

    Turns on logging using the given communicator logger.

    Declaration
    public void EnableLogging(ICommunicatorLogger communicatorLogger)
    Parameters
    Type Name Description
    ICommunicatorLogger communicatorLogger

    The given communicator logger.

    Exceptions
    Type Condition
    ArgumentException

    If the given communicator logger is null.

    Get(string, IEnumerable<IRequestHeader>, AbstractParamRequest, Action<Stream, IEnumerable<IResponseHeader>>, CallContext)

    Corresponds to the HTTP Get method.

    Declaration
    public Task Get(string relativePath, IEnumerable<IRequestHeader> requestHeaders, AbstractParamRequest requestParameters, Action<Stream, IEnumerable<IResponseHeader>> bodyHandler, CallContext context)
    Parameters
    Type Name Description
    string relativePath

    The path to call, relative to the base URI.

    IEnumerable<IRequestHeader> requestHeaders

    An optional list of request headers.

    AbstractParamRequest requestParameters

    The optional set of request parameters.

    Action<Stream, IEnumerable<IResponseHeader>> bodyHandler

    A callback that receives the contents of the body as a stream

    CallContext context

    The optional call context to use

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    CommunicationException

    when an exception occurred communicating with the Ingenico ePayments platform

    ResponseException

    when an error response was received from the Ingenico ePayments platform

    ApiException

    when an error response was received from the Ingenico ePayments platform which contained a list of errors

    BodyHandlerException

    when the BodyHandler throws an exception

    Get<T>(string, IEnumerable<IRequestHeader>, AbstractParamRequest, CallContext)

    Corresponds to the HTTP Get method.

    Declaration
    public Task<T> Get<T>(string relativePath, IEnumerable<IRequestHeader> requestHeaders, AbstractParamRequest requestParameters, CallContext context)
    Parameters
    Type Name Description
    string relativePath

    The path to call, relative to the base URI.

    IEnumerable<IRequestHeader> requestHeaders

    An optional list of request headers.

    AbstractParamRequest requestParameters

    The optional set of request parameters.

    CallContext context

    The optional call context to use

    Returns
    Type Description
    Task<T>
    Type Parameters
    Name Description
    T

    Type of the response.

    Exceptions
    Type Condition
    CommunicationException

    when an exception occurred communicating with the Ingenico ePayments platform

    ResponseException

    when an error response was received from the Ingenico ePayments platform

    ApiException

    when an error response was received from the Ingenico ePayments platform which contained a list of errors

    GetHeaderDateString()

    Gets the date in the preferred format for the HTTP date header (RFC1123).

    Declaration
    protected string GetHeaderDateString()
    Returns
    Type Description
    string

    The header date string.

    GetIdempotenceTimestamp(IEnumerable<IResponseHeader>)

    Declaration
    protected long? GetIdempotenceTimestamp(IEnumerable<IResponseHeader> headers)
    Parameters
    Type Name Description
    IEnumerable<IResponseHeader> headers
    Returns
    Type Description
    long?

    Post(string, IEnumerable<IRequestHeader>, AbstractParamRequest, object, Action<Stream, IEnumerable<IResponseHeader>>, CallContext)

    Corresponds to the HTTP POST method.

    Declaration
    public Task Post(string relativePath, IEnumerable<IRequestHeader> requestHeaders, AbstractParamRequest requestParameters, object requestBody, Action<Stream, IEnumerable<IResponseHeader>> bodyHandler, CallContext context)
    Parameters
    Type Name Description
    string relativePath

    The path to call, relative to the base URI.

    IEnumerable<IRequestHeader> requestHeaders

    An optional list of request headers.

    AbstractParamRequest requestParameters

    The optional set of request parameters.

    object requestBody

    The optional request body to send.

    Action<Stream, IEnumerable<IResponseHeader>> bodyHandler

    A callback that receives the contents of the body as a stream

    CallContext context

    The optional call context to use

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    CommunicationException

    when an exception occurred communicating with the Ingenico ePayments platform

    ResponseException

    when an error response was received from the Ingenico ePayments platform

    ApiException

    when an error response was received from the Ingenico ePayments platform which contained a list of errors

    BodyHandlerException

    when the BodyHandler throws an exception

    Post<T>(string, IEnumerable<IRequestHeader>, AbstractParamRequest, object, CallContext)

    Corresponds to the HTTP POST method.

    Declaration
    public Task<T> Post<T>(string relativePath, IEnumerable<IRequestHeader> requestHeaders, AbstractParamRequest requestParameters, object requestBody, CallContext context)
    Parameters
    Type Name Description
    string relativePath

    The path to call, relative to the base URI.

    IEnumerable<IRequestHeader> requestHeaders

    An optional list of request headers.

    AbstractParamRequest requestParameters

    The optional set of request parameters.

    object requestBody

    The optional request body to send.

    CallContext context

    The optional call context to use

    Returns
    Type Description
    Task<T>
    Type Parameters
    Name Description
    T

    Type of the response.

    Exceptions
    Type Condition
    CommunicationException

    when an exception occurred communicating with the Ingenico ePayments platform

    ResponseException

    when an error response was received from the Ingenico ePayments platform

    ApiException

    when an error response was received from the Ingenico ePayments platform which contained a list of errors

    ProcessResponse<O>(HttpStatusCode, Stream, IEnumerable<IResponseHeader>, string, CallContext, Action<Stream, IEnumerable<IResponseHeader>>)

    Declaration
    protected O ProcessResponse<O>(HttpStatusCode statusCode, Stream stream, IEnumerable<IResponseHeader> headers, string requestPath, CallContext context, Action<Stream, IEnumerable<IResponseHeader>> bodyHandler = null)
    Parameters
    Type Name Description
    HttpStatusCode statusCode
    Stream stream
    IEnumerable<IResponseHeader> headers
    string requestPath
    CallContext context
    Action<Stream, IEnumerable<IResponseHeader>> bodyHandler
    Returns
    Type Description
    O
    Type Parameters
    Name Description
    O

    Put(string, IEnumerable<IRequestHeader>, AbstractParamRequest, object, Action<Stream, IEnumerable<IResponseHeader>>, CallContext)

    Corresponds to the HTTP PUT method.

    Declaration
    public Task Put(string relativePath, IEnumerable<IRequestHeader> requestHeaders, AbstractParamRequest requestParameters, object requestBody, Action<Stream, IEnumerable<IResponseHeader>> bodyHandler, CallContext context)
    Parameters
    Type Name Description
    string relativePath

    The path to call, relative to the base URI.

    IEnumerable<IRequestHeader> requestHeaders

    An optional list of request headers.

    AbstractParamRequest requestParameters

    The optional set of request parameters.

    object requestBody

    The optional request body to send.

    Action<Stream, IEnumerable<IResponseHeader>> bodyHandler

    A callback that receives the contents of the body as a stream

    CallContext context

    The optional call context to use

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    CommunicationException

    when an exception occurred communicating with the Ingenico ePayments platform

    ResponseException

    when an error response was received from the Ingenico ePayments platform

    ApiException

    when an error response was received from the Ingenico ePayments platform which contained a list of errors

    BodyHandlerException

    when the BodyHandler throws an exception

    Put<T>(string, IEnumerable<IRequestHeader>, AbstractParamRequest, object, CallContext)

    Corresponds to the HTTP PUT method.

    Declaration
    public Task<T> Put<T>(string relativePath, IEnumerable<IRequestHeader> requestHeaders, AbstractParamRequest requestParameters, object requestBody, CallContext context)
    Parameters
    Type Name Description
    string relativePath

    The path to call, relative to the base URI.

    IEnumerable<IRequestHeader> requestHeaders

    An optional list of request headers.

    AbstractParamRequest requestParameters

    The optional set of request parameters.

    object requestBody

    The optional request body to send.

    CallContext context

    The optional call context to use

    Returns
    Type Description
    Task<T>
    Type Parameters
    Name Description
    T

    Type of the response.

    Exceptions
    Type Condition
    CommunicationException

    when an exception occurred communicating with the Ingenico ePayments platform

    ResponseException

    when an error response was received from the Ingenico ePayments platform

    ApiException

    when an error response was received from the Ingenico ePayments platform which contained a list of errors

    ThrowExceptionIfNecessary(HttpStatusCode, Stream, IEnumerable<IResponseHeader>, string)

    Checks the response for errors and throws an exception if necessary.

    Declaration
    protected void ThrowExceptionIfNecessary(HttpStatusCode statusCode, Stream stream, IEnumerable<IResponseHeader> headers, string requestPath)
    Parameters
    Type Name Description
    HttpStatusCode statusCode
    Stream stream
    IEnumerable<IResponseHeader> headers
    string requestPath

    Implements

    IDisposable
    ILoggingCapable
    IObfuscationCapable
    In This Article
    Back to top Copyright (c) 2016 Global Collect Services B.V.