protected function _getEntrypointUrl($xmlResponse, PriceLookupVo $priceLookupVo) { $entrypointUrl = ''; $xml = new \DOMDocument(); $xml->loadXML($xmlResponse); $items = $xml->getElementsByTagName("items"); foreach ($items as $item) { $params = $item->getElementsByTagName("item"); foreach ($params as $param) { $workingPrice = floatval($param->getAttribute('workingPrice')); if ($priceLookupVo->getAmount() == $workingPrice) { foreach ($param->getElementsByTagName("entrypointUrl") as $url) { return $url->nodeValue; } } } } return false; }
protected function _getXmlPriceLookupUri(PriceLookupVo $priceLookupVo) { $xml = new \DOMDocument(); $xml->encoding = 'utf-8'; $xml->xmlVersion = '1.0'; $requestMobilePaymentProcessEntrypoints = $xml->createElement('requestMobilePaymentProcessEntrypoints'); $xmlns = new \DOMAttr('xmlns', 'http://pay01.zong.com/zongpay'); $requestMobilePaymentProcessEntrypoints->setAttributeNode($xmlns); $xmlns_xsi = new \DOMAttr('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $requestMobilePaymentProcessEntrypoints->setAttributeNode($xmlns_xsi); $xsi_schemeLocation = new \DOMAttr('xsi:schemaLocation', 'http://pay01.zong.com/zongpay/zongpay.xsd'); $requestMobilePaymentProcessEntrypoints->setAttributeNode($xsi_schemeLocation); $customerKey = $xml->createElement('customerKey', $this->_customerKey); $requestMobilePaymentProcessEntrypoints->appendChild($customerKey); $countryCode = $xml->createElement('countryCode', $priceLookupVo->getCountryCode()); $requestMobilePaymentProcessEntrypoints->appendChild($countryCode); $items = $xml->createElement('items'); $currency = new \DOMAttr('currency', $priceLookupVo->getCurrecyCode()); $items->setAttributeNode($currency); $requestMobilePaymentProcessEntrypoints->appendChild($items); $xml->appendChild($requestMobilePaymentProcessEntrypoints); return $xml->saveXML(); }