File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,6 +107,26 @@ public function getProducts($options = array())
107107
108108 return $ this ->apiGetProducts ($ path );
109109 }
110+
111+ /**
112+ * Get all active registers
113+ *
114+ * @param array $options .. optional
115+ * @return array
116+ */
117+ public function getRegisters ($ options = array ())
118+ {
119+ $ path = '' ;
120+ if (count ($ options )) {
121+ foreach ($ options as $ k => $ v ) {
122+ $ v = urlencode ($ v ); // ensure values with spaces etc are encoded properly
123+ $ path .= '/ ' .$ k .'/ ' .$ v ;
124+ }
125+ }
126+
127+ return $ this ->apiGetRegisters ($ path );
128+ }
129+
110130 /**
111131 * Get all sales
112132 *
@@ -221,6 +241,25 @@ private function apiGetSales($path)
221241
222242 return $ sales ;
223243 }
244+ /**
245+ * @param $path
246+ * @return array
247+ * @throws Exception
248+ */
249+ private function apiGetRegisters ($ path )
250+ {
251+ $ result = $ this ->_request ('/api/registers ' .$ path );
252+ if (!isset ($ result ->registers ) || !is_array ($ result ->registers )) {
253+ throw new Exception ("Error: Unexpected result for request " );
254+ }
255+ $ sales = array ();
256+ foreach ($ result ->register_sales as $ s ) {
257+ $ sales [] = new VendSale ($ s , $ this );
258+ }
259+
260+ return $ sales ;
261+ }
262+
224263 /**
225264 * Save vendproduct object to vend
226265 * @param object $product
You can’t perform that action at this time.
0 commit comments