Skip to content

Commit 4fd64a7

Browse files
Merge branch 'getTableListV3' into 'master'
Added support for getTableListV3, which does not require a terminal See merge request mpluskassa/mplus-api-client!31
2 parents b308544 + a964cac commit 4fd64a7

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

Mplusqapiclient.php

+42-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class MplusQAPIclient
44
{
5-
const CLIENT_VERSION = '1.29.2';
5+
const CLIENT_VERSION = '1.30.0';
66
const WSDL_TTL = 300;
77

88
var $MIN_API_VERSION_MAJOR = 0;
@@ -1047,6 +1047,29 @@ public function getTableListV2($terminal, $attempts=0)
10471047

10481048
//----------------------------------------------------------------------------
10491049

1050+
public function getTableListV3($request, $attempts=0)
1051+
{
1052+
try {
1053+
$result = $this->client->getTableListV3($this->parser->convertGetTableListV3Request($request));
1054+
if ($this->returnRawResult) {
1055+
return $result;
1056+
}
1057+
return $this->parser->parseTableListV3($result);
1058+
} catch (SoapFault $e) {
1059+
$msg = $e->getMessage();
1060+
if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) {
1061+
sleep(1);
1062+
return $this->getTableListV3($request, $attempts+1);
1063+
} else {
1064+
throw new MplusQAPIException('SoapFault occurred: '.$msg, 0, $e);
1065+
}
1066+
} catch (Exception $e) {
1067+
throw new MplusQAPIException('Exception occurred: '.$e->getMessage(), 0, $e);
1068+
}
1069+
}
1070+
1071+
//----------------------------------------------------------------------------
1072+
10501073
public function getCurrentTableOrders($request=null, $attempts=0)
10511074
{
10521075
try {
@@ -4521,6 +4544,13 @@ public function parseTableListV2($soapTableListV2)
45214544

45224545
//----------------------------------------------------------------------------
45234546

4547+
public function parseTableListV3($soapTableListV3)
4548+
{
4549+
return parseTableListV2($soapTableListV3);
4550+
}
4551+
4552+
//----------------------------------------------------------------------------
4553+
45244554
public function parseAvailablePaymentMethods($soapAvailablePaymentMethods)
45254555
{
45264556
if (isset($soapAvailablePaymentMethods->paymentMethodList->paymentMethod)) {
@@ -8500,6 +8530,17 @@ public function convertTerminal($terminal)
85008530

85018531
//----------------------------------------------------------------------------
85028532

8533+
public function convertGetTableListV3Request($request)
8534+
{
8535+
if (is_null($request)) {
8536+
$request = [];
8537+
}
8538+
$object = arrayToObject(['request'=>$request]);
8539+
return $object;
8540+
}
8541+
8542+
//----------------------------------------------------------------------------
8543+
85038544
public function convertGetCurrentTableOrdersRequest($request)
85048545
{
85058546
if (is_null($request)) {

0 commit comments

Comments
 (0)