• Articles
  • API Documentation
  • Integrating the EPAS Client Library
Search Results for

    Show / Hide Table of Contents
    • Introduction
    • Additional features
    • Alternative payment methods
    • Dynamic Currency Conversion
    • Identifying cards
    • Integrating the EPAS Client Library
    • Using Multiple Terminal IDs
    • Log storage
    • Receipts
    • Release notes
    • Transaction types
    • Transaction examples
    • Using the EPAS Client Library

    Integrating the EPAS client library

    The steps to integrate the EPAS Client Library are:

    1. Add the library module to the ECR project.
    2. Add an instance of the library to the ECR application.
    3. Implement required methods.
    4. Implement optional handler methods as required.

    1. Add a reference to EpasClientLibrary.dll

    The EPAS Client Library is implemented as a .NET Framework 4.7.2 class library.

    2. Create an EpasClient instance

    The EPAS Client Library is implemented by the EpasClient class in the Westpay.Epas namespace. The client takes a single parameter, which is an instance of a class that implements IClientApp.

    using Westpay.Epas;
    
    public class SampleECR : IClientApp
    {
        /// <summary>
        /// Instance of the EPAS client library
        /// </summary>
        EpasClient mEpas = null;
        public SampleECR()
        {
            // Create the EPAS client library instance
            mEpas = new EpasClient(this);
        }
        .
        .
        .
    }
    

    Note: An EpasClient instance is only connected to one terminal at a time. If the ECR needs to interact with several terminals simultaneously, one instance must be created for each terminal.

    3. Implement IClientApp

    The EpasClient class requires an IClientApp instance. This instance must be provided by the ECR application, which must implement all the required members of the interface.

    • Display
    • PrintRecipt
    • PrintReport
    • VerifySignature
    • HandleVoiceReferral
    • PaymentCodeRequired
    • VatAmountRequired
    • LoyaltyCardPresented
    • CheckDccOnOriginalTransaction
    • ParameterDownloadAvailable
    • Log

    4. Optional methods

    The client library offers a range of handler methods that are optional, and the ECR can implement any that will be useful.

    Each handler method is implemented as a callback. The ECR simply assigns a method reference to the appropriate library callback handler in EpasClient and the method will be called when appropriate.

    • BusyStatus
    • CardAccepted
    • CardStatus
    • LinkStatus
    • RawMessageHandler

    About callbacks

    When the library calls methods in the ECR, only one method will be called at any time. This is done to ensure that there are no race conditions, since events can happen quickly and it would be confusing if, for example, the CardAccepted handler is called while the CardInserted handler is still executing.

    It is, therefore, recommended that the ECR returns from interface methods and handlers as quickly as possible so that the remainder of the transaction can be processed without delay.

    There is one exception to this, which is IClientApp.Log. This has a dedicated thread so that the Log method can be called while another method or handler is executing. Only one call to Log will be made at a time, however – there will be no overlapping calls made.

    Using the library

    The next step is to start using the library

    In This Article
    • Integrating the EPAS client library
      • 1. Add a reference to EpasClientLibrary.dll
      • 2. Create an EpasClient instance
      • 3. Implement IClientApp
      • 4. Optional methods
        • About callbacks
    • Using the library
    Back to top Generated by DocFX