The ECR driver consists of 3 library files. The marketpay_pos_api.dll (API definitions) and marketpay-pos-driver.dll (.NET wrapper on core library) are .NET libraries so they both have to be included into project as DLL library reference in VisualStudio. There is also 3rd necessary library marketpay-driver-cpp.dll file which is written in C++. This file is not needed at build time because it's dynamically linked in runtime. But it has to be reached by executable program. The simplest way is to copy this file into directory where an exe app is located. There are also 2 other ways like modifying PATH environmental variable or putting library into system directory like C:/Windows/System32. The last 2 ways are more difficult because of access permission or need of OS restart)
The diagram below shows processing transation in direct mode.
The diagram below shows processing transation in dual mode which allows to modify an amount during processing a transaction depending on loyaltyId or PAN.
The diagram below shows processing transation which is successfully aborted. An early state of transaction is usually possible to aborted a transaction.
The diagram below shows processing transaction interrupted by broken TCP/IP connection.
The diagram below shows processing transaction interrupted by broken TCP/IP connection
There is below example console application source in Visual Basic language showing how to perform transation in direct mode.
Imports System.Windows
Module Module1
Public Class Logger
Implements ILogger
Public Sub log(logLevel As
LogLevel, message As String) Implements ILogger.log
Console.WriteLine("DRIVER LOG: " + message)
End Sub
End Class
Public Class TransactionHandler
Implements ITransactionHandler
Dim transactionRuntime As ITransactionRuntime
Private Sub ITransactionHandler_onTransactionStarted(runtime As ITransactionRuntime) Implements ITransactionHandler.onTransactionStarted
Console.WriteLine("ITransactionHandler_onTransactionStarted")
transactionRuntime = runtime
End Sub
Private Sub ITransactionHandler_onTransactionStatus(status As
TransactionStatus) Implements ITransactionHandler.onTransactionStatus
Console.WriteLine("ITransactionHandler_onTransactionStatus: " + status.ToString)
End Sub
Private Sub ITransactionHandler_onDualProcessing(intermediateTransactionResult As IntermediateTransactionResult, mutableDualTransactionParams As MutableDualTransactionParams) Implements ITransactionHandler.onDualProcessing
Console.WriteLine("ITransactionHandler_onDualProcessing")
If True Then
Console.WriteLine("Modifying amount...")
mutableDualTransactionParams.amount = 4567
mutableDualTransactionParams.merchantOption = "modified merchant option"
Else
Console.WriteLine("Aborting")
transactionRuntime.abort()
End If
End Sub
End Class
Sub Main()
Dim loggerHandler As
fr.marketpay.driver.ILogger
loggerHandler = New Logger()
Dim transactionHandler As
fr.marketpay.driver.ITransactionHandler
transactionHandler = New TransactionHandler()
Dim ecrConfiguration As
fr.marketpay.driver.EcrConfiguration
ecrConfiguration = New
fr.marketpay.driver.EcrConfiguration()
Dim poiConfiguration As
fr.marketpay.driver.PoiConfiguration
poiConfiguration = New
fr.marketpay.driver.PoiConfiguration()
Dim transactionParams As
fr.marketpay.driver.TransactionParams
transactionParams = New
fr.marketpay.driver.TransactionParams()
driver = New
fr.marketpay.driver.Driver(loggerHandler)
ecrConfiguration.ecrId = "123"
ecrConfiguration.cashierId = "456"
ecrConfiguration.providerId = "Novelpay"
ecrConfiguration.appName = "ECR Simulator"
ecrConfiguration.version = "0.0.5"
ecrConfiguration.componentDescription = ""
ecrConfiguration.operatorLanguage = "PL"
ecrConfiguration.printerAvailable = True
poiConfiguration.address = "192.168.42.129:7778"
poiConfiguration.maxMessageSize = 32768
poiConfiguration.tc1 = 1000
poiConfiguration.tc1 = 2000
transactionParams.amount = 1234
transactionParams.amountTip = 0
transactionParams.amountCashback = 0
transactionParams.transactionId = "123"
transactionParams.currency = 978 'euro
transactionParams.cashierId = "666"
transactionParams.merchantId = "777"
transactionParams.terminalId = "888"
transactionParams.merchantOption = ""
Console.WriteLine("API version: " + driver.getApiVersion().ToString)
Console.WriteLine("driver version: " + driver.getVersion())
Console.WriteLine("Openign...")
driver.open(ecrConfiguration, poiConfiguration)
Console.WriteLine("Open...")
Console.WriteLine("Performing transaction...")
driver.processTransaction(transactionParams, transactionHandler)
Console.WriteLine("Performed transaction")
Console.WriteLine("Closing...")
driver.close()
Console.WriteLine("closed")
Console.WriteLine("the end")
End Sub
End Module