-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from pzs/update-v013
Frissítés az Online számla 0.13-as verzióra
- Loading branch information
Showing
10 changed files
with
317 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace NavOnlineInvoice; | ||
use Exception; | ||
|
||
|
||
abstract class BaseExceptionResponse extends Exception { | ||
|
||
protected $xml; | ||
|
||
|
||
function __construct($xml) { | ||
$this->xml = $xml; | ||
$message = $this->getResultMessage(); | ||
|
||
parent::__construct($message); | ||
} | ||
|
||
|
||
public function getXml() { | ||
return $this->xml; | ||
} | ||
|
||
|
||
/** | ||
* Return the result field of the XML in array format | ||
* @return Array | ||
*/ | ||
abstract public function getResult(); | ||
|
||
|
||
public function getResultMessage() { | ||
$result = $this->getResult(); | ||
|
||
if (empty($result["message"])) { | ||
$message = $result["errorCode"]; | ||
} elseif (empty($result["errorCode"])) { | ||
$message = $result["message"]; | ||
} else { | ||
$message = "$result[message] ($result[errorCode])"; | ||
} | ||
|
||
return $message; | ||
} | ||
|
||
|
||
public function getErrorCode() { | ||
$result = $this->getResult(); | ||
|
||
if (isset($result["errorCode"])) { | ||
return (string)$result["errorCode"]; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace NavOnlineInvoice; | ||
use Exception; | ||
|
||
|
||
class GeneralExceptionResponse extends BaseExceptionResponse { | ||
|
||
public function getResult() { | ||
return (array)$this->xml; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.