protected function getResponse($value, $type, $login = false) { $valueObject = \Zend\XmlRpc\AbstractValue::getXmlRpcValue($value, $type); $content = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param>' . $valueObject->saveXml() . '</param></params></methodResponse>'; $this->debug("XML: " . $content); $response = new \Symfony\Component\HttpFoundation\Response(); $response->headers->set('Content-Type', 'text/xml'); $response->setContent($content); $response->setPrivate(); $response->setMaxAge(100); $user = $this->userManager->getCurrentUser(); if ($user->getSymbbType() === 'user') { $response->headers->set('Mobiquo_is_login', "true"); } else { $response->headers->set('Mobiquo_is_login', false); } return $response; }
/** * {@inheritdoc} */ public function sendbank(OrderInterface $order) { $params = array('order' => $order->getReference(), 'bank' => $this->getCode(), 'check' => $this->generateUrlCheck($order)); $fields = array('cmd' => '_xclick', 'charset' => 'utf-8', 'business' => $this->getOption('account'), 'cert_id' => $this->getOption('cert_id'), 'no_shipping' => '1', 'lc' => 'EN', 'no_note' => '1', 'invoice' => $order->getReference(), 'amount' => $order->getTotalInc(), 'currency_code' => $order->getCurrency(), 'item_name' => 'Order ' . $order->getReference(), 'bn' => 'Sonata/1.0', 'first_name' => $order->getBillingName(), 'last_name' => '', 'address1' => $order->getBillingAddress1(), 'address2' => $order->getBillingAddress2(), 'city' => $order->getBillingCity(), 'zip' => $order->getBillingPostcode(), 'country' => $order->getBillingCountryCode(), 'custom' => $this->generateUrlCheck($order), 'notify_url' => $this->router->generate($this->getOption('url_callback'), $params, UrlGeneratorInterface::ABSOLUTE_URL), 'cancel_return' => $this->router->generate($this->getOption('url_return_ko'), $params, UrlGeneratorInterface::ABSOLUTE_URL), 'return' => $this->router->generate($this->getOption('url_return_ok'), $params, UrlGeneratorInterface::ABSOLUTE_URL)); if ($this->getOption('debug', false)) { $html = '<html><body>' . "\n"; } else { $html = '<html><body onload="document.getElementById(\'submit_button\').disabled = \'disabled\'; document.getElementById(\'formPaiement\').submit();">' . "\n"; } $method = $this->getOption('method', 'encrypt'); $html .= sprintf('<form action="%s" method="%s" id="formPaiement" >' . "\n", $this->getOption('url_action'), 'POST'); $html .= '<input type="hidden" name="cmd" value="_s-xclick">' . "\n"; $html .= sprintf('<input type="hidden" name="encrypted" value="%s" />', call_user_func(array($this, $method), $fields)); $html .= '<p>' . $this->translator->trans('process_to_paiement_bank_page', array(), 'PaymentBundle') . '</p>'; $html .= '<input type="submit" id="submit_button" value="' . $this->translator->trans('process_to_paiement_btn', array(), 'PaymentBundle') . '" />'; $html .= '</form>'; $html .= '</body></html>'; if ($this->getOption('debug', false)) { echo "<!-- Encrypted Array : \n" . print_r($fields, 1) . '-->'; } $response = new \Symfony\Component\HttpFoundation\Response($html, 200, array('Content-Type' => 'text/html')); $response->setPrivate(true); return $response; }