/** * @param array $all array of string * @param DOMNode $parent the xml node receiving items of $all <transaction_type>ITEM</transaction_type> * @return void */ function toXml($all, \DOMNode $parent) { if (!sizeof($all)) { return; } foreach ($all as $t) { XmlSerializer::addChild($parent, 'transaction_type', $t); } }
function toXml($all, \DOMNode $parent) { if (!sizeof($all)) { return; } foreach ($all as $m) { XmlSerializer::addChild($parent, 'payment_method', $m); } }
function testAddChildValueString() { $root = XmlSerializer::createDocument('wurzel'); XmlSerializer::addChild($root, 'str', 'the String'); $this->assertEqual($root->ownerDocument->saveXml(), '<?xml version="1.0" encoding="UTF-8"?> <wurzel> <str>the String</str> </wurzel> '); }
/** * In order hypercharge knows the notification has been received and processed successfully by your server * you have to respond with an ack message. * <pre> * die($notifiction->ack()) * </pre> * * If you do not do so, hypercharge will send the notification again later (up to 10 times at increasing intervals). * This also applies to accidentally polluting the output with php error-, warning- or notice-messages (invalid xml). * * * fyi: ack() returns an xml string e.g. * * <?xml version="1.0" encoding="UTF-8"?> * <notification_echo> * <unique_id>26aa150ee68b1b2d6758a0e6c44fce4c</unique_id> * </notification_echo> * * @return string xml */ function ack() { $root = XmlSerializer::createDocument('notification_echo'); XmlSerializer::addChild($root, 'unique_id', $this->payment_unique_id); return $root->ownerDocument->saveXml(); }