File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,6 +100,26 @@ public function getProducts($options = array())
100100
101101 return $ this ->apiGetProducts ($ path );
102102 }
103+
104+ /**
105+ * Get all active registers
106+ *
107+ * @param array $options .. optional
108+ * @return array
109+ */
110+ public function getRegisters ($ options = array ())
111+ {
112+ $ path = '' ;
113+ if (count ($ options )) {
114+ foreach ($ options as $ k => $ v ) {
115+ $ v = urlencode ($ v ); // ensure values with spaces etc are encoded properly
116+ $ path .= '/ ' .$ k .'/ ' .$ v ;
117+ }
118+ }
119+
120+ return $ this ->apiGetRegisters ($ path );
121+ }
122+
103123 /**
104124 * Get all sales
105125 *
@@ -213,6 +233,25 @@ private function apiGetSales($path)
213233
214234 return $ sales ;
215235 }
236+ /**
237+ * @param $path
238+ * @return array
239+ * @throws Exception
240+ */
241+ private function apiGetRegisters ($ path )
242+ {
243+ $ result = $ this ->_request ('/api/registers ' .$ path );
244+ if (!isset ($ result ->registers ) || !is_array ($ result ->registers )) {
245+ throw new Exception ("Error: Unexpected result for request " );
246+ }
247+ $ sales = array ();
248+ foreach ($ result ->register_sales as $ s ) {
249+ $ sales [] = new VendSale ($ s , $ this );
250+ }
251+
252+ return $ sales ;
253+ }
254+
216255 /**
217256 * Save vendproduct object to vend
218257 * @param object $product
You can’t perform that action at this time.
0 commit comments