Skip to content

Commit

Permalink
Merge branch 'getTableListV3' into 'master'
Browse files Browse the repository at this point in the history
Added support for getTableListV3, which does not require a terminal

See merge request mpluskassa/mplus-api-client!31
  • Loading branch information
freerk-mpluskassa committed Apr 22, 2020
2 parents b308544 + a964cac commit 4fd64a7
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion Mplusqapiclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -4521,6 +4544,13 @@ public function parseTableListV2($soapTableListV2)

//----------------------------------------------------------------------------

public function parseTableListV3($soapTableListV3)
{
return parseTableListV2($soapTableListV3);
}

//----------------------------------------------------------------------------

public function parseAvailablePaymentMethods($soapAvailablePaymentMethods)
{
if (isset($soapAvailablePaymentMethods->paymentMethodList->paymentMethod)) {
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 4fd64a7

Please sign in to comment.