public function configure() { if (null !== ($response = $this->checkAuth(array(AdminResources::MODULE), array('Paypal'), AccessManager::UPDATE))) { return $response; } $conf = new PaypalConfig(); $one_is_done = 0; $tab = ""; // Case form is paypal.configure $form = new \Paypal\Form\ConfigurePaypal($this->getRequest()); try { $vform = $this->validateForm($form); $conf->setLogin($vform->get('login')->getData())->setPassword($vform->get('password')->getData())->setSignature($vform->get('signature')->getData())->write(); $one_is_done = 1; $tab = "configure_account"; } catch (\Exception $e) { } // Case form is paypal.configure.sandbox $form = new \Paypal\Form\ConfigureSandboxPaypal($this->getRequest()); try { $vform = $this->validateForm($form); $tab = "configure_sandbox"; $conf->setLoginSandbox($vform->get('login')->getData())->setPasswordSandbox($vform->get('password')->getData())->setSignatureSandbox($vform->get('signature')->getData())->setSandbox($vform->get('sandbox')->getData() ? "true" : ""); $conf->write(); } catch (\Exception $e) { } //Redirect to module configuration page $this->redirectToRoute("admin.module.configure", array(), array('module_code' => Paypal::getModCode(true), 'current_tab' => $tab, '_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction')); }
public function update_status(OrderEvent $event) { if ($event->getOrder()->getPaymentModuleId() === Paypal::getModCode()) { if ($event->getOrder()->isPaid()) { $contact_email = ConfigQuery::read('store_email'); if ($contact_email) { $message = MessageQuery::create()->filterByName('payment_confirmation_paypal')->findOne(); if (false === $message) { throw new \Exception("Failed to load message 'payment_confirmation_paypal'."); } $order = $event->getOrder(); $customer = $order->getCustomer(); $this->parser->assign('order_id', $order->getId()); $this->parser->assign('order_ref', $order->getRef()); $message->setLocale($order->getLang()->getLocale()); $instance = \Swift_Message::newInstance()->addTo($customer->getEmail(), $customer->getFirstname() . " " . $customer->getLastname())->addFrom($contact_email, ConfigQuery::read('store_name')); // Build subject and body $message->buildMessage($this->parser, $instance); $this->getMailer()->send($instance); } } } }