From a964cac8ab28fc2e3654342c0352c319cddb73bb Mon Sep 17 00:00:00 2001 From: Freerk Minnema Date: Wed, 22 Apr 2020 15:25:22 +0200 Subject: [PATCH] Added support for getTableListV3, which does not require a terminal --- Mplusqapiclient.php | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/Mplusqapiclient.php b/Mplusqapiclient.php index ac0b1a5..45d9abb 100755 --- a/Mplusqapiclient.php +++ b/Mplusqapiclient.php @@ -2,7 +2,7 @@ class MplusQAPIclient { - const CLIENT_VERSION = '1.29.2'; + const CLIENT_VERSION = '1.30.0'; const WSDL_TTL = 300; var $MIN_API_VERSION_MAJOR = 0; @@ -1047,6 +1047,29 @@ public function getTableListV2($terminal, $attempts=0) //---------------------------------------------------------------------------- + public function getTableListV3($request, $attempts=0) + { + try { + $result = $this->client->getTableListV3($this->parser->convertGetTableListV3Request($request)); + if ($this->returnRawResult) { + return $result; + } + return $this->parser->parseTableListV3($result); + } catch (SoapFault $e) { + $msg = $e->getMessage(); + if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) { + sleep(1); + return $this->getTableListV3($request, $attempts+1); + } else { + throw new MplusQAPIException('SoapFault occurred: '.$msg, 0, $e); + } + } catch (Exception $e) { + throw new MplusQAPIException('Exception occurred: '.$e->getMessage(), 0, $e); + } + } + + //---------------------------------------------------------------------------- + public function getCurrentTableOrders($request=null, $attempts=0) { try { @@ -4521,6 +4544,13 @@ public function parseTableListV2($soapTableListV2) //---------------------------------------------------------------------------- + public function parseTableListV3($soapTableListV3) + { + return parseTableListV2($soapTableListV3); + } + + //---------------------------------------------------------------------------- + public function parseAvailablePaymentMethods($soapAvailablePaymentMethods) { if (isset($soapAvailablePaymentMethods->paymentMethodList->paymentMethod)) { @@ -8500,6 +8530,17 @@ public function convertTerminal($terminal) //---------------------------------------------------------------------------- + public function convertGetTableListV3Request($request) + { + if (is_null($request)) { + $request = []; + } + $object = arrayToObject(['request'=>$request]); + return $object; + } + + //---------------------------------------------------------------------------- + public function convertGetCurrentTableOrdersRequest($request) { if (is_null($request)) {