82 lines
2.3 KiB
PHP
82 lines
2.3 KiB
PHP
<?php
|
|
|
|
class App_Service_SoapFeInviate extends Zend_Soap_Client
|
|
{
|
|
const TEST_URL = "https://testfe.solutiondocondemand.com/solutiondoc_hub.asmx?wsdl";
|
|
const PROD_URL = "https://hubfe.solutiondocondemand.com/solutiondoc_hub.asmx?wsdl";
|
|
|
|
const TEST_CRED = array(
|
|
'CustomerCode'=>'0000001Test0000463',
|
|
'Password'=>'B13144FA3D9E11D70079B2C929B549D2'
|
|
);
|
|
|
|
protected $_configs;
|
|
protected $_ipManager;
|
|
|
|
private $_credenziali;
|
|
private $_testSDK;
|
|
|
|
public function __construct(array $credenziali = null)
|
|
{
|
|
$this->_configs = new App_Service_ConfigManager();
|
|
$this->_ipManager = new App_Service_IpManager();
|
|
|
|
if($this->_ipManager->allowedDevMode())
|
|
$this->_testSDK = true;
|
|
else
|
|
$this->_testSDK = false;
|
|
|
|
if($this->_testSDK){
|
|
parent::__construct(self::TEST_URL);
|
|
if(!$credenziali)
|
|
$this->_credenziali = self::TEST_CRED;
|
|
else
|
|
$this->_credenziali = $credenziali;
|
|
}else{
|
|
parent::__construct(self::PROD_URL);
|
|
if(!$credenziali){
|
|
throw new Zend_Exception("Errore credenziali non presenti nell'inizializzione del SOAP FEInviate");
|
|
}
|
|
|
|
$this->_credenziali = $credenziali;
|
|
}
|
|
}
|
|
|
|
public function getCredenziali()
|
|
{
|
|
return $this->_credenziali;
|
|
}
|
|
|
|
public function getOldCredenziali()
|
|
{
|
|
return array(
|
|
'codiceCliente'=>$this->_credenziali['CustomerCode'],
|
|
'passwordServizi'=>$this->_credenziali['Password']
|
|
);
|
|
}
|
|
|
|
public function mergeParamsCredenziali($params = array()){
|
|
return array_merge_recursive(array('paramAuth'=>$this->_credenziali),$params);
|
|
}
|
|
|
|
public function mergeParamsOldCredenziali($params = array()){
|
|
return array_merge_recursive(array(
|
|
'codiceCliente'=>$this->_credenziali['CustomerCode'],
|
|
'passwordServizi'=>$this->_credenziali['Password']
|
|
),$params);
|
|
}
|
|
|
|
public static function strToBytesArray($str){
|
|
$tmp = array();
|
|
for($i = 0; $i < mb_strlen($str, 'ASCII'); $i++) {
|
|
$tmp[$i] = ord($str[$i]);
|
|
}
|
|
return $tmp;
|
|
}
|
|
|
|
public static function BytesArrayToStr($arrayOfBytes){
|
|
return implode(array_map("chr", $arrayOfBytes));
|
|
}
|
|
|
|
}
|