I need to open a POS terminal under ms windows xp. I am using python 2.7. The most important function in loading a DLL that performs payment accepts two pointers to structures, but it gives an error message 1 (Communication error), but without additional messages. Please note that when calling the payment function, not all elements of the POSData structure get a value. Another function I tried (GetVersion) works. Here are the specifications and my code:
typedef struct { char IPAddress[16];
from ctypes import * #da python 3.x sara' configparser import ConfigParser import logging from time import localtime, strftime #STRUTTURE DATI class TETHParameters(Structure): _fields_ = [("IPAddress" , c_char_p), ("Port" , c_int )] class TECRData(Structure): _fields_ = [("Amount" , c_char_p), ("ECRId", c_char_p), ("PaymentType", c_char_p), ("TerminalId", c_char_p), ("Contract", c_char_p), ("PreauthorizationCode", c_char_p), ("STAN", c_char_p), ("Ticket2Ecr", c_char_p)] class TPOSData(Structure): _fields_ = [ ("TerminalId" , c_char_p), ("AcquirerId" , c_char_p), ("TransactionType" , c_char_p), ("TransactionResult" , c_char_p), ("KODescription" , c_char_p), ("CardType" , c_char_p), ("STAN" , c_char_p), ("POSBalance" , c_char_p), ("BankBalance" , c_char_p), ("PAN" , c_char_p), ("AuthorizationCode" , c_char_p), ("OperationNumber" , c_char_p), ("AmountAuth" , c_char_p), ("PreauthorizationCode" , c_char_p), ("ActionCode" , c_char_p), ("DataTrs" , c_char_p), ("AmountEcho" , c_char_p), ("Ticket" , c_char_p) ] ECRData = TECRData( ECRId = c_char_p( '012345678' ), Amount = c_char_p( '00000000') , TerminalID = c_char_p( '01234567' ), PaymentType = c_char_p ("0") ) POSData = TPOSData( KODescription = c_char_p(' '), TerminalId = c_char_p(' '), AcquirerId = c_char_p(' '), TransactionType = c_char_p(' '), TransactionResult = c_char_p(' '), CardType = c_char_p(' '), STAN = c_char_p(' '), PAN = c_char_p(' '), AuthorizationCode = c_char_p(' '), OperationNumber = c_char_p(' '), DataTrs = c_char_p(' ') ) ETHParameters = TETHParameters( IPAddress = c_char_p( '192.168.127.190' ) , Port = c_int(45119)) iae17 = windll.LoadLibrary('iae17') iae17.IAE17_InitEth( byref( ETHParameters) ) result = iae17.IAE17_Payment( byref(ECRData), byref(POSData)) print result