Skip to content

Introduction

patricnson edited this page Sep 13, 2021 · 1 revision

To implement the EPAS Client Library is almost as simple as importing it to your project. Follow these steps and you should be ready to send your first transactions within minutes.

Using the EPAS Client Library

Step 1 - Add the library DLL to your project

Step 2 - Create an instance of the library

Step 3 - Implement IClientApp

The IClientApp interface

void Display(string text);
void PrintReceipt(ReceiptData receipt);
void PrintReport(string report);
bool VerifySignature(string displayText, out bool signatureOk);
bool HandleVoiceReferral(string displayText, out string approvalCode);
bool PaymentCodeRequired(string displayText, out string paymentCode);
bool VatAmountRequired(string displayText, out decimal vatAmount);
bool LoyaltyCardPresented(string cardNumber, out bool cardAccepted);
bool CheckDccOnOriginalTransaction(string displayText, out bool dccWasUsed);
void ParameterDownloadAvailable(string displayText, out bool permitDownload);
void Log(LogLevel level, string text);

These are explored in detail in the API document found in this repo.


Step 4 - Consider the optional handlers

  • CardActionNotification CardStatus
  • CardAcceptedNotification CardAccepted
  • StatusNotification BusyStatus
  • StatusNotification LinkStatus
  • EpasMessageReceiver RawMessageHandler

These are documented in the API document


Step 5 - Connect to the terminal

TerminalNetworkConnection tnc = new TerminalNetworkConnection()
	{
TerminalConnectionDetails =
	new IPEndPoint(IPAddress.Parse("192.168.0.18"), 3000),
UseKeepAlive = true
	};

	if (mEpas.ConnectNetwork(tnc) == ApiResult.OK)
	{
			......

Step 6 - Log in to the terminal

TerminalEnvironment te = new TerminalEnvironment()
{
AuthorisationServer = new IPEndPoint(IPAddress.Parse("185.27.171.42"), 55144),
	ConfigurationServer = new IPEndPoint(IPAddress.Parse("185.27.171.42"), 55133),
	ISO639_1_LanguageCode = TerminalEnvironment.LangSwedish,
	OperatorId = "cashier_1",
	TerminalId = "80000082"
};

if (mEpas.Login(te, out LoginResponse lr) == ApiResult.OK)
	{
		if (lr?.LoggedIn)
		{
			......

Step 7 - Run transactions

if (mEpas.Purchase(499, out TransactionResponse tr) == ApiResult.OK)
{
	if (tr.Approved)
	{
		MessageBox.Show("Purchase approved");
	}
	else
	{
		MessageBox.Show("Purchase declined: " + tr.ToString());
	}
}

The library will call IClientApp methods and optional handlers during the transaction.

Step 8 - Logout and disconnect at the end of the day

LogoutResponse lr;
epas.Logout(out lr);
epas.Disconnect();

That was easy! Where are all the challenges?

There is not much more to it really. If you want some extra control over the integration then you should consider:

  • You will probably want to do your own receipt formatting.
  • You will have to supply the terminal ID and server addresses.
  • You will have to manage your own transaction totals and daily accounts.
  • Currently limited to .Net on Windows, though we plan to introduce a Java library in the future.
  • Currently limited to network connections, but we plan to add USB / serial in the future.