Basic operation
#
Initial stepInitially, Commercial Automation must execute the command ConfiguraIntSiTefInterativo, passing the necessary information to so that the Sales Terminal can communicate with SiTef, such as Address SiTef IP, Company Code (in SiTef Demo this code is 00000000) and the terminal identification.
This function should only be called when CliSiTef is
loaded i.e. it is not necessary to call it with each new transaction (unless there is a specific need to change
company parameters, terminal or SiTef server IP).
The routine returns a value indicating whether the configuration occurred with success or not. If 0 (zero) returns, the process occurred in a correct.
#
Transaction itselfThe next step is then to call the IniciaFuncaoSiTefInterativo function, passing the described parameters to it.
Upon return, it returns the value 10000 to continue the transaction or other value to close.
If the return is 10000, you must call the function ContinuaFuncaoSiTefInterativo, with the parameters also described for her we next topics.
While CliSiTef returns the value when calling this function 10000, the automation must keep repeating the call to this function as many times as necessary until the return value of the function be 0 (zero), indicating that everything went well, or different from 0 and 10000 indicating that an abnormal interruption occurred.
#
Confirmation (or non-confirmation) of the transactionIf the return was 0 (zero), the automation closes the loop and if there was TEF coupon printing, the automation must print them and call another function, the FinalizaFuncaoSiTefInterativo, confirming or not the transaction depending, respectively, on whether the coupon was printed correctly or not.
If the return was different from 10000 and 0 then the automation simply exits the loop and, at the programmer's option, may or may not display a message according to the return of the called function. For example, if returned -2, it means that the transaction was canceled by the operator. These negative returns are described in this document.
Graphically exemplifying the flow described in this topic, we would have the Following: