/** * @param null $seriesId * @return bool */ public function cleanUpReservations($seriesId = null) { if (isset($seriesId)) { return OnlineShop_Framework_VoucherService_Reservation::cleanUpReservations($this->sysConfig->reservations->duration, $seriesId); } else { return OnlineShop_Framework_VoucherService_Reservation::cleanUpReservations($this->sysConfig->reservations->duration); } }
/** * @return bool * * @param OnlineShop_Framework_ICart $cart */ public function isReserved($cart = null) { $reservation = OnlineShop_Framework_VoucherService_Reservation::get($this->model->getToken(), $cart); if (!$reservation->exists()) { return false; } return true; }
public function create($code, $cart) { if (OnlineShop_Framework_VoucherService_Reservation::reservationExists($code, $cart)) { return true; } try { // Single Type Token --> only one token per Cart! --> Update on duplicate key! $this->db->query("INSERT INTO " . self::TABLE_NAME . " (token,cart_id,timestamp) VALUES (?,?,NOW())", [$code, $cart->getId()]); return true; } catch (Exception $e) { return false; } }
public function release($cart) { return OnlineShop_Framework_VoucherService_Reservation::releaseToken($this, $cart); }
/** * Checks if checkout data voucher tokens are valid reservations */ protected function validateVoucherTokenReservations() { foreach ($this->getVoucherTokenCodes() as $code) { $reservation = OnlineShop_Framework_VoucherService_Reservation::get($code, $this); if (!$reservation->check($this->getId())) { unset($this->checkoutData["voucher_" . $code]); } } }
/** * Removes reservations * * @param int $duration * @return bool */ public function cleanUpReservations($duration = 0) { return OnlineShop_Framework_VoucherService_Reservation::cleanUpReservations($duration, $this->seriesId); }