How to program/script SambaPOS to communicate with an external service

Hello,

I would like to know if it is possible (and how) to make SambaPOS5 communicate with a running service.

The windows service takes a bunch of preformated values (from TICKET), generate a XML file, hash it and give back the error code + the hash code of the XML file.

In order of using that service, I am thinking of something like a new action in a Payment processed rule that would do:

  1. Sending that information (like below) to a service listening on 192.168.0.x:yyy

    0101|2019-10-25|18:42:47|-|0000|1|00000000|Cliente vario|PEN|0.00|9.00|9.00|0.00|0|0|9.00|2.1|2.0
    NIU|1|CODE|-|Cristal|9.00|0|9997|0|9.00|EXO|VAT|20|0.0|-|0.00|||||0|-|0|0.00|||0|9.00|9.00|0

  2. Receive the result (error code + hash) from the service.

In the action, I can extract the information I need to send but I don’t know how (and if it is possible) to send it to a windows service in a client/server way.

Imports System.Net.Sockets         It can be used?
Imports System.Net          

(Btw, is it VB script that is used by SambaPOS script?)

Thanks,

Marc

Sounds like your ovwrcomplicating, have you looked at going this within samba? Know it’s pretty easy to generate XML in samba script.

It would help if you can explain what you are trying to do. What are you attempting to integrate? Is it one of those government receipt things or is it a payment processor? IF you can let us know what your integrating we can suggest better solutions.

Hi Jesse,

Thanks for your answer.

It’s a governement receipt thing.
XML in U(niversal) B(usiness) L(anguage) taylored for Peru.
It’s a mess, poor documentation, they try to force every business to pay a third party company that would do the job for you and these companies charge you per ticket.
The worst is that they don’t know what they do so there is no plan and they change their format 2 a year, which is a pita, I’am running a restaurant, not a IT departement.

That’s why I wanted a separate program (that will follow the gov’s changes) while SambaPOS remains almost unchanged (easier update).
Also the XML needs to be sent to the gov, which would implied including also in Samba all the tramsmission/retransmission process.

Here is an example of XML files

For the “factura F001-3675”, Samba currently send these info:

0101|2019-10-24|22:47:45|-|0000|6|20600674146|A y B La Mona Amzonica SAC|PEN|0.00|67.00|67.00|0.00|0|0|67.00|2.1|2.0
NIU|1|CODE|-|Pilsen|9.50|0|9997|0|9.50|EXO|VAT|20|0.0|-|0.00|||||0|-|0|0.00|||0|9.50|9.50|0
NIU|1|CODE|-|Sprite|4.00|0|9997|0|4.00|EXO|VAT|20|0.0|-|0.00|||||0|-|0|0.00|||0|4.00|4.00|0
NIU|1|CODE|-|Club.Sandwich|22.00|0|9997|0|22.00|EXO|VAT|20|0.0|-|0.00|||||0|-|0|0.00|||0|22.00|22.00|0
NIU|1|CODE|-|Pan|3.00|0|9997|0|3.00|EXO|VAT|20|0.0|-|0.00|||||0|-|0|0.00|||0|3.00|3.00|0
NIU|3|CODE|-|Pilsen|9.50|0|9997|0|28.50|EXO|VAT|20|0.0|-|0.00|||||0|-|0|0.00|||0|9.50|28.50|0

Here the generated XML file (signed with digital certificate)

20603159170-01-F001-3675.zip (4.8 KB)

And the answer from gov’servers:

R-20603159170-01-F001-3675.zip (3.8 KB)

Marc