/** * @param PayPal $payPal * @param Session $session */ public function __construct(PayPal $payPal, Session $session) { parent::__construct(); $this->payPal = $payPal; $this->session = $session->getSection('PayPalExpress'); $this->session->setExpiration('+10 minutes'); if (empty($this->session->token)) { $this->session->token = $this->_ec = Strings::random(6); } }
/** * Optional, if you set Session than enable automatic language dection. * * @param Http\Session $session * @return self */ public function setSession(Http\Session $session, $live = '+1 week') { $this->section = $session->getSection(__CLASS__); if (!isset($this->section->language)) { $this->setLanguage($this->detectLanguage()); $this->section->setExpiration($live); } return $this; }
/** * Closes the window * @param string $location * @return void */ public function close($location = NULL) { $this->storage->remove(); $this->open = FALSE; if (!$this->presenter->isAjax()) { if (isset($location)) { $this->presenter->redirect($location); } else { $this->presenter->redirect('this'); } } }
/** * @param Form $form * @return void Zpracovani formulare - pridani noveho komentare */ public function formSucceeded(Form $form) { //nacteni a smazani session $values = \Nette\Utils\ArrayHash::from($this->commentSession->content); $this->commentSession->remove(); //ulozit novy prispevek ke clanku $this->article = $this->articleRepository->getById($values->articleId); if (isset($this->myUser)) { $values->user = $this->myUser; $values->name = NULL; } else { $values->user = NULL; } //vytvoreni komentu, prirazeni ke clanku a ulozeni $newComment = new \App\Model\Entities\Comment($this->article, $values->user, $values->name, $values->content); $this->articleRepository->getEntityManager()->persist($newComment); $this->article->addComment($newComment); $this->articleRepository->getEntityManager()->flush(); $this->redirect('this'); }
/** * Confirmation of paypal payment */ public function confirmExpressCheckout(SessionSection $ses) { $query = array('amount' => $ses->amount, 'payerID' => $ses->payerID, 'token' => $ses->token, 'paymentAction' => $ses->paymentType, 'currencyCode' => $ses->currencyCodeType, 'ipAdress' => urlencode($_SERVER['SERVER_NAME'])); $request = new Request($query); $request->setMethod('DoExpressCheckoutPayment'); // Same as $request->addQuery(array('method', '...')); $response = $this->call($request); if ($response->success) { $ses->remove(); } return $response; }
/** * Clear all data from the persistent storage * * @return void */ public function clearAll() { $this->session->remove(); }
/** * */ public function cartClear() { $this->shopCart->remove(); }
/** * @param string * @return self */ public function remove($name) { $this->session->offsetUnset($name); return $this; }
protected function getSessionSection() { $ns = $this->namespace ?: 'default'; return $this->session->getSection("LT-{$ns}"); }
public function remove() { $this->sessionSection->remove(); }