Hi.
Personally, I did not communicate with the EFT payment terminal.
I looked at the TIMSDK C you sent, but I'm no expert in C. I tried to run the timapi.dll based on the C examples, the function
ta_terminal_get_tim_api_version() runs, but I don't know if the result is correct (the return value looks more like a pointer to me than a correct return). Calling the terminal settings
ta_terminal_settings_create() requires the structure of the "settings" variable, but I can't create it - it gives me error 139, which according to the file timsdk_C\C\TimApi\Include\timapi\constants\result_code.h means
a_c_rc_invalid_argument
Code: Select all
#include "hmg.ch"
#include "hbdyn.ch"
function main()
Local settings, rc
Public hLib := ltim_init()
msgdebug ( ta_terminal_get_tim_api_version() )
// create settings
rc = ta_terminal_settings_create(@settings)
msgdebug ( settings, rc )
return Nil
FUNCTION ltim_init()
RETURN hb_libLoad( "timapi.dll" )
FUNCTION CallDll( cProc, ... )
RETURN hb_DynCall( { cProc, hLib, HB_DYN_CALLCONV_SYSCALL }, ... )
FUNCTION ta_terminal_get_tim_api_version()
RETURN CallDll( "ta_terminal_get_tim_api_version" )
FUNCTION ta_terminal_settings_create ( settings )
RETURN CallDll( "ta_terminal_settings_create", @settings )
It seems to me that it will be easier to write communication based on inet and socket, but for this you need documentation describing the communication protocol.
In Poland, we have a standardized communication protocol between ECR and EFT and it allows communication of any devices that have this protocol implemented. It is required by law that all cash registers (ECR) have this protocol, otherwise they cannot be used. This solution enables the plug-and-play connection of ECR and payment terminals.
I think that worldline EFT devices should have this protocol implemented in order to be used in Poland.
Documentation describing this protocol is here and is in Polish:
https://www.gov.pl/attachment/8f3f785e- ... 6d054d9bc9. I haven't been able to find an English translation.
Based on this protocol, I wrote a short code that tests the connection to the terminal.
Code: Select all
#include "hmg.ch"
Function Main
#define STX Chr ( 0x02 )
#define ETX Chr ( 0x03 )
#define FS Chr ( 0x1C )
nTimeOut := 300
ipadres := '127.0.0.1'
ipport := 7784
nToken := 0x2710
IF ! hb_inetInit()
MsgStop ( "Cannot initialize inet" )
quit
ENDIF
socket := hb_inetCreate()
hb_inetTimeout( socket, nTimeOut )
nProba := 1
DO WHILE nProba <= 10
nProba ++
hb_inetConnect( ipadres, ipport, socket )
nTCPIPErr := hb_inetErrorCode( socket )
IF nTCPIPErr = 0
EXIT
ENDIF
Inkey(.1)
ENDDO
IF nTCPIPErr # 0
hb_inetClose( socket )
RETURN
ENDIF
hb_inetFD( socket )
cBlokDanych := STX + hb_NumToHex( nToken , 6) + FS + "T1" + FS + ETX
cPakiet := cBlokDanych + LRC ( cBlokDanych )
strfile ( cpakiet, "pakiet.txt" )
hb_inetSendAll( socket, cPakiet )
cBuf := SPACE ( 1024 )
nBuf:=hb_inetRecvAll( socket, @cBuf, Len( cBuf ) )
msgdebug ( cBuf, nBuf )
strfile ( cbuf, "resp.txt" )
hb_inetClose( socket )
RETURN
**********************************************
Function LRC ( cPakiet )
Local nLRC := 0, cChr := "", n := 0
FOR EACH cChr IN cPakiet
n++
IF .Not. ( cChr == STX .And. n == 1 )
nLRC := NUMXOR ( nLRC, Asc ( cChr ) )
ENDIF
NEXT
RETURN Chr ( nLRC )
Unfortunately, I don't have any testing terminal, and the EFT simulator in tim_toolsTools does not support this protocol. Communication results are returned in the form of xml.
Code: Select all
SIXml`<?xml version="1.0" encoding="UTF-8"?><sixml:Notification xmlns:sixml="http://www.worldline.com/" FunctionGroup="Status" Function="TerminalStatus"><sixml:DisplayContent><sixml:DisplayLine LineNum="1">Please Login</sixml:DisplayLine></sixml:DisplayContent><sixml:CardReaderStatus>CardReaderEmpty</sixml:CardReaderStatus><sixml:TransactionStatus>Idle</sixml:TransactionStatus><sixml:ConnectionStatus>LoggedOut</sixml:ConnectionStatus><sixml:ManagementStatus>Closed</sixml:ManagementStatus><sixml:ReceiptInformation>0</sixml:ReceiptInformation><sixml:TerminalId>12345678</sixml:TerminalId></sixml:Notification>
According to the manufacturer's website
https://six-tim.github.io/timapi/doc/c/ ... ResultCode this protocol is called SIXml, but I can't find it anywhere on the Internet. Search results for the SIXml protocol redirected me to six-payment-services. In turn, searching their resources, I came across the MPD (Multi Protocol Driver) Manual - Technical Specification:
https://www.six-payment-services.com/da ... ion-en.pdf
From the content of this document, it appears that COM/OLE could be used to communicate with EFT, which is called "Telekurs EFT/MPD Library", but I can't find that online either. This would probably be the simplest solution to be implemented in HMG.
In conclusion, try to contact the manufacturer and find out:
- do they have and can provide COM/OLE to communicate with their EFT?
or
- can they provide documentation for the SIXml protocol
or
- do their devices support the ECR-EFT protocol required in Poland (is there any simulator that supports this protocol?)