AfterbuyXmlResponseValidator
in package
Class AfterbuyXmlResponseValidator
Table of Contents
- CALL_STATUS_SUCCESS = 'Success'
- $logger : AfterbuyLogger
- __construct() : mixed
- AfterbuyXmlResponseValidator constructor.
- validate() : void
- collectErrorsFromXML() : array<string|int, mixed>
- Collects errors from the Afterbuy response xml if available.
- getCallStatus() : string
- isSuccessful() : bool
- Checks if call status matches 'success'.
- tryGetXmlElement() : SimpleXMLElement|null
- Tries to get a xml element's property as xml element.
- tryGetXmlString() : string|null
- Tries to get a xml element's property as string.
Constants
CALL_STATUS_SUCCESS
private
mixed
CALL_STATUS_SUCCESS
= 'Success'
Properties
$logger
private
AfterbuyLogger
$logger
Methods
__construct()
AfterbuyXmlResponseValidator constructor.
public
__construct(AfterbuyLogger $logger) : mixed
Parameters
- $logger : AfterbuyLogger
Return values
mixed —validate()
public
validate(string $responseBody) : void
Parameters
- $responseBody : string
Tags
Return values
void —collectErrorsFromXML()
Collects errors from the Afterbuy response xml if available.
private
collectErrorsFromXML(SimpleXMLElement $xmlResponse) : array<string|int, mixed>
Parameters
- $xmlResponse : SimpleXMLElement
Return values
array<string|int, mixed> —getCallStatus()
private
getCallStatus(SimpleXMLElement $xmlResponse) : string
Parameters
- $xmlResponse : SimpleXMLElement
Tags
Return values
string —isSuccessful()
Checks if call status matches 'success'.
private
isSuccessful(string $callStatus) : bool
Parameters
- $callStatus : string
Return values
bool —tryGetXmlElement()
Tries to get a xml element's property as xml element.
private
tryGetXmlElement(SimpleXMLElement $xml, string $property) : SimpleXMLElement|null
Parameters
- $xml : SimpleXMLElement
- $property : string
Return values
SimpleXMLElement|null —tryGetXmlString()
Tries to get a xml element's property as string.
private
tryGetXmlString(SimpleXMLElement $xml, string $property) : string|null
Parameters
- $xml : SimpleXMLElement
- $property : string