public function __construct(SimpleXMLElement $xml, Request $request) { $this->validate($xml, $request); $this->request = $request; $this->reference = MerchantReference::createFromString((string) $xml->merchantreference); $this->mode = (string) $xml->mode; $this->status = (int) $xml->status; $this->reason = (string) $xml->reason; if (!empty((string) $xml->time)) { $this->responseTime = new DateTime("@{$xml->time}"); } }
public function innerCreateElement(SimpleXMLElement $xml) { $xml->addChild('merchantreference', $this->reference->getReference()); }