Пример #1
0
 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;
 }
Пример #2
0
 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;
 }