These are chat archives for CORE-POS/IS4C

17th
Jun 2016
Finn
@thefinn93
Jun 17 2016 23:05
alright, so, I ended up spending a good chunk of yesterday just figuring out how the system is supposed to work and what i'm doing wrong
i pretty much got it down i think
will need to adjust my ansible playbook
I'm not entirely clear where I should start with a plugin to do this
nor how to use the existing paycard plugin
Andy Theuninck
@gohanman
Jun 17 2016 23:28
Almost everything revolves around the AutoLoader. A Plugin is just a collection of classes in a directory. The AutoLoader slots them into appropriate places based on what non-plugin class they inherit from. The simplest approach IMO is to create a Parser class that accepts a command a returns a main_frame value that will redirect the browser to a page within the plugin. PriceCheckParser is a pretty minimalist example of such. It's not necessary by any stretch to use the existing Paycards plugin, but if it's enabled all its classes will be available via autoloading should any of them be useful.
Finn
@thefinn93
Jun 17 2016 23:36
okay
cool
so the main_frame value is a redirect?
but wouldn't an ajax call be preferred?
as best I can tell (and i'm new to a lot of this) you encode the price and like, what type of card to expect, send it to the pax terminal via an HTTP request, which it doesn't respond to until it either gets a card swipe or times out and responds with an error
Andy Theuninck
@gohanman
Jun 17 2016 23:59
Yep. The doc describes the parser return values in detail. Simple stuff, issue command => apply action, is mostly all AJAX. The redirects are more suited for when a command is going to require a few follow-up actions in a particular order. I think it winds up being simpler to tie completely new things into than a SPA (and historically it didn't hurt to periodically have a page load reset the whole javascript engine although that's less of an issue these days). The Datacap integration sounds kind of similar. Most of the HTTP request body gets generated in PHP but it's submitted to the device via ajax