Skip to content

Commit

Permalink
Merge branch 'getEmployeeBranchAuthorizations' into 'master'
Browse files Browse the repository at this point in the history
getEmployeeBranchAuthorizations call added

See merge request mpluskassa/mplus-api-client!18
  • Loading branch information
dennismpluskassa committed Mar 17, 2020
2 parents eb63632 + e5b885d commit c0b1cf9
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 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.28.1';
const CLIENT_VERSION = '1.28.2';
const WSDL_TTL = 300;

var $MIN_API_VERSION_MAJOR = 0;
Expand Down Expand Up @@ -3685,6 +3685,26 @@ public function reloadGiftcard($cardNumber, $branchNumber, $employeeNumber, $amo
}
}
// END reloadGiftcard()

//----------------------------------------------------------------------------
public function getEmployeeBranchAuthorizations($employeeNumber, $attempts = 0) {
try {
$request = $this->parser->convertGetEmployeeBranchAuthorizationsRequest($employeeNumber);
$result = $this->client->getEmployeeBranchAuthorizations($request);
return $this->parser->parseGetEmployeeBranchAuthorizationsResult($result);
} catch (SoapFault $e) {
$msg = $e->getMessage();
if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) {
sleep(1);
return $this->getEmployeeBranchAuthorizations($employeeNumber, $attempts + 1);
} else {
throw new MplusQAPIException('SoapFault occurred: ' . $msg, 0, $e);
}
} catch (Exception $e) {
throw new MplusQAPIException('Exception occurred: ' . $e->getMessage(), 0, $e);
}
}
// END getEmployeeBranchAuthorizations()
}

//==============================================================================
Expand Down Expand Up @@ -6321,6 +6341,17 @@ public function parseGetGiftcardHistoryResult($soapGetGiftcardHistoryResult) {
}
}
// END parseGetGiftcardHistoryResult()

//----------------------------------------------------------------------------
public function parseGetEmployeeBranchAuthorizationsResult($soapGetEmployeeBranchAuthorizationsResult) {
if (property_exists($soapGetEmployeeBranchAuthorizationsResult, "branchAuthorizationsList") &&
property_exists($soapGetEmployeeBranchAuthorizationsResult->branchAuthorizationsList, "branchAuthorizations")) {
return $soapGetEmployeeBranchAuthorizationsResult->branchAuthorizationsList->branchAuthorizations;
} else {
return false;
}
}
// END parseGetEmployeeBranchAuthorizationsResult()

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

Expand Down Expand Up @@ -9159,6 +9190,15 @@ public function convertGetGiftcardHistoryRequest($cardNumber, $cardId) {
return $request;
}
// END convertGetGiftcardHistoryRequest()

//----------------------------------------------------------------------------
public function convertGetEmployeeBranchAuthorizationsRequest($employeeNumber) {
$request = new stdClass();
$request->request = new stdClass();
$request->request->employeeNumber = $employeeNumber;
return $request;
}
// END convertGetEmployeeBranchAuthorizationsRequest()

}

Expand Down

0 comments on commit c0b1cf9

Please sign in to comment.