Skip to content

Commit 7b1d902

Browse files
author
Mplus Software
committed
Update to client v0.9.8
Support for API protocol v0.9.8 Added function adjustPoints
1 parent 484b429 commit 7b1d902

1 file changed

Lines changed: 45 additions & 4 deletions

File tree

Mplusqapiclient.php

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
class MplusQAPIclient
44
{
5-
const CLIENT_VERSION = '0.9.7';
5+
const CLIENT_VERSION = '0.9.8';
66

77
var $MIN_API_VERSION_MAJOR = 0;
88
var $MIN_API_VERSION_MINOR = 9;
9-
var $MIN_API_VERSION_REVIS = 1;
9+
var $MIN_API_VERSION_REVIS = 8;
1010

1111
var $MAX_API_VERSION_MAJOR = 0;
1212
var $MAX_API_VERSION_MINOR = 9;
13-
var $MAX_API_VERSION_REVIS = 1;
13+
var $MAX_API_VERSION_REVIS = 8;
1414

1515
var $debug = false;
1616

@@ -963,6 +963,20 @@ public function getRelation($relationNumber)
963963

964964
//----------------------------------------------------------------------------
965965

966+
public function adjustPoints($relationNumber, $pointsAdjustment)
967+
{
968+
try {
969+
$result = $this->client->adjustPoints($this->parser->convertAdjustPointsRequest($relationNumber, $pointsAdjustment));
970+
return $this->parser->parseAdjustPointsResult($result);
971+
} catch (SoapFault $e) {
972+
throw new MplusQAPIException('SoapFault occurred: '.$e->getMessage(), 0, $e);
973+
} catch (Exception $e) {
974+
throw new MplusQAPIException('Exception occurred: '.$e->getMessage(), 0, $e);
975+
}
976+
} // END adjustPoints()
977+
978+
//----------------------------------------------------------------------------
979+
966980
public function registerTerminal($terminal, $forceRegistration)
967981
{
968982
try {
@@ -1770,7 +1784,8 @@ public function parseFindRelationResult($soapFindRelationResult) {
17701784

17711785
//----------------------------------------------------------------------------
17721786

1773-
public function parseGetRelationResult($soapGetRelationResult) {
1787+
public function parseGetRelationResult($soapGetRelationResult)
1788+
{
17741789
if (isset($soapGetRelationResult->result) and $soapGetRelationResult->result == 'GET-RELATION-RESULT-OK') {
17751790
if (isset($soapGetRelationResult->relation)) {
17761791
return objectToArray($soapGetRelationResult->relation);
@@ -1781,6 +1796,20 @@ public function parseGetRelationResult($soapGetRelationResult) {
17811796

17821797
//----------------------------------------------------------------------------
17831798

1799+
public function parseAdjustPointsResult($soapAdjustPointsResult)
1800+
{
1801+
if (isset($soapAdjustPointsResult->result) and $soapAdjustPointsResult->result == 'ADJUST-POINTS-RESULT-OK') {
1802+
if (isset($soapAdjustPointsResult->relation)) {
1803+
return objectToArray($soapAdjustPointsResult->relation);
1804+
} else {
1805+
return true;
1806+
}
1807+
}
1808+
return false;
1809+
} // END parseAdjustPointsResult()
1810+
1811+
//----------------------------------------------------------------------------
1812+
17841813
public function parseRegisterTerminalResult($soapRegisterTerminalResult)
17851814
{
17861815
if (isset($soapRegisterTerminalResult->result)) {
@@ -2923,6 +2952,18 @@ public function convertForceRegistration($forceRegistration)
29232952

29242953
//----------------------------------------------------------------------------
29252954

2955+
public function convertAdjustPointsRequest($relationNumber, $pointsAdjustment)
2956+
{
2957+
$array = array('request'=>array(
2958+
'relationNumber'=>$relationNumber,
2959+
'pointsAdjustment'=>$pointsAdjustment,
2960+
));
2961+
$object = arrayToObject($array);
2962+
return $object;
2963+
} // END convertAdjustPointsRequest()
2964+
2965+
//----------------------------------------------------------------------------
2966+
29262967
public function convertRegisterTerminalRequest($terminal, $forceRegistration)
29272968
{
29282969
$terminal = $this->convertTerminal($terminal);

0 commit comments

Comments
 (0)