AW: O$ interface with Credit Card machine

Rudolf Bargholz rudolf at bargholz.ch
Fri Nov 9 23:40:11 EST 2018


Hi Michael,

I cannot help with the HTTPGet directly, but regarding the passing of parameters in the URL with base64 encoding, the result of base64 encoding can contain characters that are not valid for use in a URL, and need to be URL encoded before actual use in the URL. Valid base64 characters are "+", "=" and "/", amongst others, but these cannot be used in a URL without changing the meaning of the URL, so you might need to encode these values to "%2B", "%3D" and "%2F" respectively.

https://www.w3schools.com/tags/ref_urlencode.asp

Perhaps this is causing you problem.

If I read the documentation correctly, I would interpret the URL as"?AkEwMBwxLjI4A0s="

Regards

Rudolf Bargholz

-----Ursprüngliche Nachricht-----
Von: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] Im Auftrag von Michael Houlberg
Gesendet: Samstag, 10. November 2018 01:54
An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Betreff: O$ interface with Credit Card machine

I’m trying to communicate with a credit card machine.  This one is made by PAX, but my problem isn’t necessarily bound to any particular manufacturer.  My problem is how to correctly use the HTTPGet command in Omnis.

The way you talk to this machine is via HTTP using GET on the local area network.  The manual makes it look easy enough.  For instance to initialize the device they show this example:

Assume the destination of Terminal “IP: Port” is “192.168.2.100:10009”. [02] as STX, [03] as ETX, [1c] as field separator.
3.3.2.1. Initialize (A00) (A01)
http://192.168.2.100:10009?AkEwMBwxLjI4A0s=
Message before base64 encoded: http://192.168.2.100:10009?[02]A00[1c]1.28[03]K

What’s going on here, is the actual content you are sending are the strings “A00” and “1.28”.  It uses control characters shown in HEX to mark the start (02), a field separators (1c), and the end (03).  The ‘K’ on the end is a check character, and I’ve figured out how to generate that.  I have the part working where I use the Omnis functions bintobase64() and utf8tochar() to translate the message to base 64 including the check character then turn it into the string “AkEwMBwxLjI4A0s=“ as shown in the example, so I think that part is right.

If I type the above http string into a browser, it returns a good response.  But how do I format that for the Omnis HTTPGet?

HTTPGet (host,uri[,cgilist,hdrlist,service|port,secure {Default kFalse},verify {Default kTrue},map+ {Default kFalse}]) Returns socket

HTTPGet wants a uri, but there really isn’t one here.  And then it wants to send any parameters as part of a cgilist.  How do I translate "http://192.168.2.100:10009?AkEwMBwxLjI4A0s=“ into Omnis HTTPGet?

Thanks,
Michael Houlberg
Houlberg Development, LLC
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 


More information about the omnisdev-en mailing list