public function process()
 {
     $sql = 'INSERT INTO finance_transactions (amount, description, timestamp, account) VALUES (:amount, :title, now(), :account) ';
     $stmt = DatabaseFactory::getInstance()->prepare($sql);
     foreach (Basket::getContents() as $basketItem) {
         $stmt->bindValue(':amount', $basketItem['cost']);
         $stmt->bindValue(':title', '(given cash) ' . $basketItem['title'] . ' ticket for ' . $basketItem['username']);
         $stmt->bindValue(':account', $this->getElementValue('username'));
         $stmt->execute();
         Events::setSignupStatus($basketItem['userId'], $basketItem['eventId'], 'CASH_IN_POST');
     }
 }
Пример #2
0
    switch ($action) {
        case 'addPersonal':
            Basket::addEvent($event);
            redirect('basket.php', 'Ticked added', false, 1);
        case 'delete':
            Basket::removeEvent($event, $_REQUEST['user']);
            redirect('basket.php', 'Ticket removed', false, -1);
    }
}
$signupableEvents = Events::getSignupableEvents();
$tpl->assign('signupableEvents', $signupableEvents);
$formAddToBasket = new FormAddToBasket($signupableEvents);
if ($formAddToBasket->validate()) {
    $formAddToBasket->process();
    redirect('basket.php', 'Ticket added to basket');
}
$tpl->assign('addToBasketHasEvents', $formAddToBasket->hasEvents);
$tpl->assignForm($formAddToBasket, 'addToBasket');
$formPayForFriend = new FormPayForFriend($signupableEvents);
if ($formPayForFriend->validate()) {
    $formPayForFriend->process();
    redirect('basket.php', 'Ticked added for friend.');
}
$tpl->assignForm($formPayForFriend, 'payForFriend');
$tpl->assign('basketItems', Basket::getContents());
$tpl->assign('basketTotal', Basket::getTotal());
$tpl->assign('basketIsEmpty', Basket::isEmpty());
require_once 'includes/widgets/header.php';
require_once 'includes/widgets/sidebar.php';
$tpl->display('basket.tpl');
require_once 'includes/widgets/footer.php';
Пример #3
0
        break;
    case 'paypalFail':
        logAndRedirect('account.php', 'Paypal transaction failed.');
        break;
    case 'paypalComplete':
        logActivity('Started processing PayPal payment notification');
        foreach (Basket::getContents() as $ticket) {
            logActivity('PayPal transaction processing - setting status to PAID for event. Ticket owner _u_, event _e_', $ticket['userId'], array('event' => $ticket['eventId'], 'user' => Session::getUser()->getId()));
            Events::setSignupStatus($ticket['userId'], $ticket['eventId'], 'PAID');
        }
        logActivity('Finished processing PayPal payment notification.');
        Basket::clear();
        redirect('account.php', 'Thanks, payment complete!');
        break;
    default:
        require_once 'includes/widgets/header.php';
        require_once 'includes/widgets/sidebar.php';
        startBox();
        echo str_replace('%BASKETTOTAL%', doubleToGbp($cost), getContent('selectPaymentMethod'));
        $tpl->assign('cost', $cost);
        $tpl->assign('costPaypal', getPaypalCommission($cost));
        $tpl->assign('paypalEmail', getSiteSetting('paypalEmail'));
        $tpl->assign('listBasketContents', Basket::getContents());
        $tpl->assign('baseUrl', getSiteSetting('baseUrl'));
        $tpl->assign('currency', getSiteSetting('currency'));
        $tpl->display('checkout.tpl');
        echo getContent('commissionDisclaimer');
        stopBox('Checkout');
}
box('If you are not yet finished, pop back to your <a href = "basket.php">basket</a>.', 'Agh, no!');
require_once 'includes/widgets/footer.php';
Пример #4
0
 /**
  * Gathers and assigns to new oxOrder object customer data, payment, delivery
  * and shipping info, customer order remark, currency, voucher, language data.
  * Additionally stores general discount and wrapping. Sets order status to "error"
  * and creates oxOrderArticle objects and assigns to them basket articles.
  *
  * @param Basket $oBasket Shopping basket object
  */
 protected function _loadFromBasket(Basket $oBasket)
 {
     $myConfig = $this->getConfig();
     // store IP Address - default must be FALSE as it is illegal to store
     if ($myConfig->getConfigParam('blStoreIPs') && $this->oxorder__oxip->value === null) {
         $this->oxorder__oxip = new oxField(oxRegistry::get("oxUtilsServer")->getRemoteAddress(), oxField::T_RAW);
     }
     //setting view mode
     $this->oxorder__oxisnettomode = new oxField($oBasket->isCalculationModeNetto());
     // copying main price info
     $this->oxorder__oxtotalnetsum = new oxField($oBasket->getNettoSum());
     $this->oxorder__oxtotalbrutsum = new oxField($oBasket->getBruttoSum());
     $this->oxorder__oxtotalordersum = new oxField($oBasket->getPrice()->getBruttoPrice(), oxField::T_RAW);
     // copying discounted VAT info
     $this->_resetVats();
     $iVatIndex = 1;
     foreach ($oBasket->getProductVats(false) as $iVat => $dPrice) {
         $this->{"oxorder__oxartvat{$iVatIndex}"} = new oxField($this->_convertVat($iVat), oxField::T_RAW);
         $this->{"oxorder__oxartvatprice{$iVatIndex}"} = new oxField($dPrice, oxField::T_RAW);
         $iVatIndex++;
     }
     // payment costs if available
     if ($oPaymentCost = $oBasket->getCosts('oxpayment')) {
         $this->oxorder__oxpaycost = new oxField($oPaymentCost->getBruttoPrice(), oxField::T_RAW);
         $this->oxorder__oxpayvat = new oxField($oPaymentCost->getVAT(), oxField::T_RAW);
     }
     // delivery info
     if ($oDeliveryCost = $oBasket->getCosts('oxdelivery')) {
         $this->oxorder__oxdelcost = new oxField($oDeliveryCost->getBruttoPrice(), oxField::T_RAW);
         //V #M382: Save VAT, not VAT value for delivery costs
         $this->oxorder__oxdelvat = new oxField($oDeliveryCost->getVAT(), oxField::T_RAW);
         //V #M382
         $this->oxorder__oxdeltype = new oxField($oBasket->getShippingId(), oxField::T_RAW);
     }
     // user remark
     if (!isset($this->oxorder__oxremark) || $this->oxorder__oxremark->value === null) {
         $this->oxorder__oxremark = new oxField(oxRegistry::getSession()->getVariable('ordrem'), oxField::T_RAW);
     }
     // currency
     $oCur = $myConfig->getActShopCurrencyObject();
     $this->oxorder__oxcurrency = new oxField($oCur->name);
     $this->oxorder__oxcurrate = new oxField($oCur->rate, oxField::T_RAW);
     // store voucher discount
     if ($oVoucherDiscount = $oBasket->getVoucherDiscount()) {
         $this->oxorder__oxvoucherdiscount = new oxField($oVoucherDiscount->getBruttoPrice(), oxField::T_RAW);
     }
     // general discount
     if ($this->_blReloadDiscount) {
         $dDiscount = 0;
         $aDiscounts = $oBasket->getDiscounts();
         if (count($aDiscounts) > 0) {
             foreach ($aDiscounts as $oDiscount) {
                 $dDiscount += $oDiscount->dDiscount;
             }
         }
         $this->oxorder__oxdiscount = new oxField($dDiscount, oxField::T_RAW);
     }
     //order language
     $this->oxorder__oxlang = new oxField($this->getOrderLanguage());
     // initial status - 'ERROR'
     $this->oxorder__oxtransstatus = new oxField('ERROR', oxField::T_RAW);
     // copies basket product info ...
     $this->_setOrderArticles($oBasket->getContents());
     // copies wrapping info
     $this->_setWrapping($oBasket);
 }