2 namespace Valuation\Controller;
7 class XmlRpcController extends \Zend\Mvc\Controller\AbstractActionController
11 * @var \Zend\Session\Container
23 * @var \Zend\ServiceManager\ServiceManager
31 protected $authenticated = false;
33 * @var \User\Service\Authentication
35 protected $authDetails;
38 public function xmlRpcServerAction()
40 ini_set('memory_limit','512M');
41 \Utility\Registry::setServiceManager($this->serviceLocator);
42 \Utility\Registry::addDynamicConfig(
43 \Utility\Cache::fetchEntity(
44 'Config\Entity\Config', 1, \Utility\Registry::getEntityManager(), 600
47 $server = new \Zend\XmlRpc\Server();
48 $server->setClass('Valuation\Service\XmlRpc');
49 echo $server->handle();
50 $response = $this->getResponse();
51 $response->setStatusCode(200);
55 public function callbackAction()
61 ini_set('memory_limit','512M');
62 \Utility\Registry::setServiceManager($this->serviceLocator);
63 \Utility\Registry::addDynamicConfig(
64 \Utility\Cache::fetchEntity(
65 'Config\Entity\Config', 1, \Utility\Registry::getEntityManager(), 600
70 $server = new \Zend\XmlRpc\Server();
71 $server->setClass('Valuation\Service\XmlRpcCallback');
72 echo $server->handle();
73 $response = $this->getResponse();
74 $response->setStatusCode(200);
75 } catch (\Exception $e)
82 public function xmlRpcClientAction()
88 ini_set('memory_limit','512M');
91 ? 'http://bid4cars.local/xmlrpc/1.0'
92 : 'http://bid4cars.nirph.com/xmlrpc/1.0';
93 $client = new \Zend\XmlRpc\Client($url);
94 //$client = new \Zend\XmlRpc\Client($url . '/callback');
95 $arg1 = '4afb4a290f971186654f18dd6a13a7d7';
97 $authToken = $client->call('Authenticate', array($arg1, $arg2));
98 /* $arg1 = 'b@imperial.com';
99 $arg2 = array('freakin' => 'moo');
100 var_dump($client->call('SentToSales', array($arg1, $arg2))); */
101 //$authToken = '80f6de496cac332ab704a52bd427bab4';
104 'ItemId' => '123qweasdzxc!QAZ',
105 'CustomerName' => 'Qwerty i10',
106 'CustomerSurname' => 'Poiuytre',
107 'CustomerMobile' => '27112223333',
109 'VehicleYearId' => 41,
110 'VehicleTypeId' => 6085,
111 'VehicleFuelTypeId' => 2,
112 'VehicleTransmissionTypeId' => 2,
113 'RegistrationNumber' => 'SomeRegNr',
114 'VehiclePhoto1URL' => 'http://bid4cars.nirph.com/img/bin/235785.jpg',
115 'VehiclePhoto2URL' => 'http://bid4cars.nirph.com/img/bin/235786.jpg',
117 array('VehicleComponentId' => 1, 'Amount' => 2000),
118 array('VehicleComponentId' => 3, 'Amount' => 2500)
120 'Accessories' => array(
121 array('VehicleAccessoryId' => 2),
122 array('VehicleAccessoryId' => 3),
123 array('VehicleAccessoryId' => 4)
127 var_dump($client->call('CreateValuation', array($authToken, $email, $valuation)));
129 } catch (\Zend\XmlRpc\Client\Exception\HttpException $e) {
130 echo $e->getCode() . ":" . $e->getMessage();
134 $response = $this->getResponse();
135 $response->setStatusCode(200);
139 public function triggerSentToSalesAction()
141 \Utility\Registry::setServiceManager($this->serviceLocator);
142 \Utility\Registry::addDynamicConfig(
143 \Utility\Cache::fetchEntity(
144 'Config\Entity\Config', 1, \Utility\Registry::getEntityManager(), 600
147 $service = new \Valuation\Service\XmlRpcCallback();
148 $valuationId = $this->getRequest()->getParam('valuationId');
149 $service->triggerSentToSales($valuationId);
153 public function retryCallbacksAction()
155 \Utility\Registry::setServiceManager($this->serviceLocator);
156 \Utility\Registry::addDynamicConfig(
157 \Utility\Cache::fetchEntity(
158 'Config\Entity\Config', 1, \Utility\Registry::getEntityManager(), 600
161 $service = new \Valuation\Service\XmlRpcCallback();
162 $service->retryCallbacks();