public function toXml() { $sb = ""; $sb .= "<mandateInfo>"; if ($this->mandateID != NULL) { $sb .= "<mandateID><![CDATA["; $sb .= $this->mandateID; $sb .= "]]></mandateID>"; } if ($this->contractID != NULL) { $sb .= "<contractID><![CDATA["; $sb .= $this->contractID; $sb .= "]]></contractID>"; } if ($this->sequenceType != NULL) { $sb .= "<sequenceType><![CDATA["; $sb .= $this->sequenceType; $sb .= "]]></sequenceType>"; } if ($this->frequency != NULL) { $sb .= "<frequency><![CDATA["; $sb .= $this->frequency; $sb .= "]]></frequency>"; } if ($this->durationStartDate != NULL) { $sb .= "<durationStartDate><![CDATA["; $sb .= IgfsUtils::formatXMLGregorianCalendar($this->durationStartDate); $sb .= "]]></durationStartDate>"; } if ($this->durationEndDate != NULL) { $sb .= "<durationEndDate><![CDATA["; $sb .= IgfsUtils::formatXMLGregorianCalendar($this->durationEndDate); $sb .= "]]></durationEndDate>"; } if ($this->firstCollectionDate != NULL) { $sb .= "<firstCollectionDate><![CDATA["; $sb .= IgfsUtils::formatXMLGregorianCalendar($this->firstCollectionDate); $sb .= "]]></firstCollectionDate>"; } if ($this->finalCollectionDate != NULL) { $sb .= "<finalCollectionDate><![CDATA["; $sb .= IgfsUtils::formatXMLGregorianCalendar($this->finalCollectionDate); $sb .= "]]></finalCollectionDate>"; } if ($this->maxAmount != NULL) { $sb .= "<maxAmount><![CDATA["; $sb .= $this->maxAmount; $sb .= "]]></maxAmount>"; } $sb .= "</mandateInfo>"; return $sb; }
public static function fromXml($xml) { if ($xml == "" || $xml == NULL) { return; } $dom = new \SimpleXMLElement($xml, LIBXML_NOERROR, false); if (count($dom) == 0) { return; } $response = IgfsUtils::parseResponseFields($dom); $product = NULL; if (isset($response) && count($response) > 0) { $product = new Level3InfoProduct(); $product->productCode = IgfsUtils::getValue($response, "productCode"); $product->productDescription = IgfsUtils::getValue($response, "productDescription"); $product->items = IgfsUtils::getValue($response, "items"); $product->amount = IgfsUtils::getValue($response, "amount"); $product->imgURL = IgfsUtils::getValue($response, "imgURL"); } return $product; }
public static function fromXml($xml) { if ($xml == "" || $xml == NULL) { return; } $dom = new \SimpleXMLElement($xml, LIBXML_NOERROR, false); if (count($dom) == 0) { return; } $response = IgfsUtils::parseResponseFields($dom); $level3Info = NULL; if (isset($response) && count($response) > 0) { $level3Info = new Level3Info(); $level3Info->invoiceNumber = IgfsUtils::getValue($response, "invoiceNumber"); $level3Info->senderPostalCode = IgfsUtils::getValue($response, "senderPostalCode"); $level3Info->senderCountryCode = IgfsUtils::getValue($response, "senderCountryCode"); $level3Info->destinationName = IgfsUtils::getValue($response, "destinationName"); $level3Info->destinationStreet = IgfsUtils::getValue($response, "destinationStreet"); $level3Info->destinationStreet2 = IgfsUtils::getValue($response, "destinationStreet2"); $level3Info->destinationStreet3 = IgfsUtils::getValue($response, "destinationStreet3"); $level3Info->destinationCity = IgfsUtils::getValue($response, "destinationCity"); $level3Info->destinationState = IgfsUtils::getValue($response, "destinationState"); $level3Info->destinationPostalCode = IgfsUtils::getValue($response, "destinationPostalCode"); $level3Info->destinationCountryCode = IgfsUtils::getValue($response, "destinationCountryCode"); $level3Info->billingName = IgfsUtils::getValue($response, "billingName"); $level3Info->billingStreet = IgfsUtils::getValue($response, "billingStreet"); $level3Info->billingStreet2 = IgfsUtils::getValue($response, "billingStreet2"); $level3Info->billingStreet3 = IgfsUtils::getValue($response, "billingStreet3"); $level3Info->billingCity = IgfsUtils::getValue($response, "billingCity"); $level3Info->billingState = IgfsUtils::getValue($response, "billingState"); $level3Info->billingPostalCode = IgfsUtils::getValue($response, "billingPostalCode"); $level3Info->billingCountryCode = IgfsUtils::getValue($response, "billingCountryCode"); $level3Info->freightAmount = IgfsUtils::getValue($response, "freightAmount"); $level3Info->taxAmount = IgfsUtils::getValue($response, "taxAmount"); $level3Info->vat = IgfsUtils::getValue($response, "vat"); $level3Info->note = IgfsUtils::getValue($response, "note"); if (isset($response["product"])) { $product = array(); foreach ($dom->children() as $item) { if ($item->getName() == "product") { $product[] = Level3InfoProduct::fromXml($item->asXML()); } } $level3Info->product = $product; } } return $level3Info; }