コード例 #1
0
    function testToXmlWithNull()
    {
        $data = null;
        $t = new PaymentMethods();
        $parent = XmlSerializer::createDocument('payment_methods');
        $t->toXml($data, $parent);
        $this->assertEqual($parent->ownerDocument->saveXml(), '<?xml version="1.0" encoding="UTF-8"?>
<payment_methods/>
');
    }
コード例 #2
0
    function testToXmlWithNull()
    {
        $data = null;
        $t = new TransactionTypes();
        $parent = XmlSerializer::createDocument('transaction_types');
        $t->toXml($data, $parent);
        $this->assertEqual($parent->ownerDocument->saveXml(), '<?xml version="1.0" encoding="UTF-8"?>
<transaction_types/>
');
    }
コード例 #3
0
    function testSerializeXmlShouldHandleNull()
    {
        $o = new SerializableImpl(array('leer' => null));
        $root = XmlSerializer::createDocument('r');
        XmlSerializer::_toXml($o, $root);
        $str = $root->ownerDocument->saveXML();
        $this->assertEqual('<?xml version="1.0" encoding="UTF-8"?>
<r>
  <leer/>
</r>
', $str);
    }
コード例 #4
0
    function test_toXmlRecursiveSorted()
    {
        $a = new Address($this->fixture('address.json'));
        $a->foo = new MpiParams(array('x' => '1', 'a' => '2', 'k' => '3'));
        XmlSerializer::$sort = true;
        $root = XmlSerializer::createDocument('r');
        XmlSerializer::_toXml($a, $root);
        $str = $root->ownerDocument->saveXML();
        $this->assertEqual($str, '<?xml version="1.0" encoding="UTF-8"?>
<r>
  <address1>Kurfürstendamm 123</address1>
  <city>Berlin</city>
  <country>DE</country>
  <first_name>Hans</first_name>
  <foo>
    <a>2</a>
    <k>3</k>
    <x>1</x>
  </foo>
  <last_name>Johanson</last_name>
  <zip_code>10624</zip_code>
</r>
');
    }
コード例 #5
0
 /**
  * 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();
 }