Пример #1
0
 /**
  * Passes valuta-model conversion amount to response
  * @return String|Json
  */
 public function convertValutaAction()
 {
     $result = ["ConversionAmountResult" => 0];
     $dateTime = new DateTime();
     $parameters = ['CurrencyFrom' => $this->request->get("CurrencyFrom"), 'CurrencyTo' => $this->request->get("CurrencyTo"), 'RateDate' => $dateTime->format("Y-m-d"), 'Amount' => $this->request->get("Amount")];
     try {
         $soapClientService = new App\SoapClientService();
         $soapClientService->addProvider(new Kowabunga());
         $soapClientService->addProvider(new Webservicex());
         $result["ConversionAmountResult"] = $soapClientService->getConversionAmount($parameters);
         $response = new JsonResponse($result);
     } catch (Exception $e) {
         $response = new JsonResponse(["error" => $e->getMessage()]);
     }
     return $response->send();
 }
Пример #2
0
 /**
  * Sets the URL values
  *
  * @param Symfony\Component\HttpFoundation\Request $request
  */
 private function setURLFromSymfony($request)
 {
     $this->setQueryVar('acid', null);
     $this->m_publication = $this->_getPublication();
     $language = $request->get('language', 'en');
     $this->m_language = $this->_getLanguage($language, $this->m_publication);
     $this->m_issue = $this->_getIssue($request->get('issue'), $this->m_language, $this->m_publication);
     $this->m_section = $this->_getSection($request->get('section'), $this->m_issue, $this->m_language, $this->m_publication);
     $this->m_article = $this->_getArticle($request->get('articleNo'), $this->m_language);
     $this->m_template = $this->_getTemplate();
 }