Returns base basket price for payment cost calculations. Price depends on
payment setup (payment administration)

@param \OxidEsales\Eshop\Application\Model\Basket $oBasket oxBasket object

@return double
183
public function getBaseBasketPriceForPaymentCostCalc($oBasket)
    {
        $dBasketPrice = 0;
        $iRules = $this->oxpayments__oxaddsumrules->value;

        // products brutto price
        if (!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_ALLGOODS)) {
            $dBasketPrice += $oBasket->getProductsPrice()->getSum($oBasket->isCalculationModeNetto());
        }

        // discounts
        if ((!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_DISCOUNTS)) &&
            ($oCosts = $oBasket->getTotalDiscount())
        ) {
            $dBasketPrice -= $oCosts->getPrice();
        }

        // vouchers
        if (!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_VOUCHERS)) {
            $dBasketPrice -= $oBasket->getVoucherDiscValue();
        }

        // delivery
        if ((!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_SHIPCOSTS)) &&
            ($oCosts = $oBasket->getCosts('oxdelivery'))
        ) {
            if ($oBasket->isCalculationModeNetto()) {
                $dBasketPrice += $oCosts->getNettoPrice();
            } else {
                $dBasketPrice += $oCosts->getBruttoPrice();
            }
        }

        // wrapping
        if (($iRules & self::PAYMENT_ADDSUMRULE_GIFTS) &&
            ($oCosts = $oBasket->getCosts('oxwrapping'))
        ) {
            if ($oBasket->isCalculationModeNetto()) {
                $dBasketPrice += $oCosts->getNettoPrice();
            } else {
                $dBasketPrice += $oCosts->getBruttoPrice();
            }
        }

        // gift card
        if (($iRules & self::PAYMENT_ADDSUMRULE_GIFTS) &&
            ($oCosts = $oBasket->getCosts('oxgiftcard'))
        ) {
            if ($oBasket->isCalculationModeNetto()) {
                $dBasketPrice += $oCosts->getNettoPrice();
            } else {
                $dBasketPrice += $oCosts->getBruttoPrice();
            }
        }

        return $dBasketPrice;
    }
361220
public function GetBasketSumForVoucher(TShopVoucher &$oVoucher)
    {
        $value = $this->GetBasketArticles()->GetBasketSumForVoucher($oVoucher);
        if (true === $oVoucher->IsSponsored()) {
            $value += $this->dCostShipping;
        }

        return $value;
    }
68938
public function getPrice()
    {
        $price = $this->BasePrice;
                
        // Check for customisations that modify price
        foreach ($this->getCustomisations() as $item) {
            $price += ($item->Price) ? $item->Price : 0;
        }
        
        return $price;
    }
1036168
public function getBasketCost()
    {
        $this->loadProducts();

        $cost = 0;
        foreach($this->basketProducts as $bp) {
            $cost += $bp['count'] * $bp['price'];
        }

        return $cost;
    }
1006515
public function getPaymorrowTotalVatAmount()
    {
        /** @var OxpsPaymorrowOxBasket|oxBasket $this */

        // Products VAT
        $dTotalVat = (double) array_sum( (array) $this->getProductVats( false ) );

        // Get cost and add costs VATs
        $aCosts = (array) $this->getCosts();

        foreach ( $aCosts as $oPrice ) {
            $dTotalVat += (double) $this->_getVatForValidPrice( $oPrice );
        }

        // Add surcharge VAT amount in case it is not yet included in basket
        $dTotalVat += (double) $this->_getVatForValidPrice( $this->_getPaymentMethodSurcharge() );

        return $dTotalVat;
    }
1321947
public function getBasketCost()
    {
        $cost = $this->find()
            ->where([
                'id_user' => $this->idUser,
                'storage' => $this->owner->storageName
            ])
            ->sum('price*count');

        return ($cost) ? $cost : 0;
    }
925843
public function getDiscountSumPayPalBasket()
    {
        // collect discounts
        $discount = 0.0;

        $totalDiscount = $this->getTotalDiscount();

        if ($totalDiscount) {
            $discount += $totalDiscount->getBruttoPrice();
        }

        //if payment costs are negative, adding them to discount
        if (($costs = $this->getPaymentCosts()) < 0) {
            $discount += ($costs * -1);
        }

        // vouchers..
        $vouchers = (array) $this->getVouchers();
        foreach ($vouchers as $voucher) {
            $discount += round($voucher->dVoucherdiscount, 2);
        }

        return $discount;
    }
499257
public function getBasketDiscounts($oBasket, $oUser = null)
    {
        $aList = [];
        $aDiscList = $this->_getList($oUser)->getArray();
        /** @var \OxidEsales\Eshop\Application\Model\Discount $oDiscount */
        foreach ($aDiscList as $oDiscount) {
            if ($oDiscount->isForBasket($oBasket)) {
                $aList[$oDiscount->getId()] = $oDiscount;
            }
        }

        return $aList;
    }
1175452
public function getBasePrice($dAmount = 1)
    {
        // override this function if you want e.g. different prices
        // for diff. user groups.

        // Performance
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        if (!$myConfig->getConfigParam('bl_perfLoadPrice') || !$this->_blLoadPrice) {
            return;
        }

        // GroupPrice or DB price ajusted by AmountPrice
        $dPrice = $this->_getModifiedAmountPrice($dAmount);

        return $dPrice;
    }
231548
public function validateDelivery($oBasket)
    {
        // proceed with no delivery
        // used for other countries
        if ($oBasket->getPaymentId() == 'oxempty') {
            return;
        }
        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        $masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();

        $oDelSet = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class);
        $sTable = $oDelSet->getViewName();

        $sQ = "select 1 from {$sTable} where {$sTable}.oxid=" .
              $masterDb->quote($oBasket->getShippingId()) . " and " . $oDelSet->getSqlActiveSnippet();

        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        if (!$masterDb->getOne($sQ)) {
            // throwing exception
            return self::ORDER_STATE_INVALIDDELIVERY;
        }
    }
1205638
public function getPayment()
    {
        if (!$this->isPayPal()) {
            // removing PayPal payment type from session
            $this->getSession()->deleteVariable('oepaypal');
            $this->getSession()->deleteVariable('oepaypal-basketAmount');

            return parent::getPayment();
        }

        if ($this->payment === null) {
            // payment is set ?
            $payment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
            if ($payment->load('oxidpaypal')) {
                $this->payment = $payment;
            }
        }

        return $this->payment;
    }
1078277
public function onOrderExecute($oBasket, $iSuccess)
    {

        if (is_numeric($iSuccess) && $iSuccess != 2 && $iSuccess <= 3) {
            //adding user to particular customer groups
            $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
            $dMidlleCustPrice = (float) $myConfig->getConfigParam('sMidlleCustPrice');
            $dLargeCustPrice = (float) $myConfig->getConfigParam('sLargeCustPrice');

            $this->addToGroup('oxidcustomer');
            $dBasketPrice = $oBasket->getPrice()->getBruttoPrice();
            if ($dBasketPrice < $dMidlleCustPrice) {
                $this->addToGroup('oxidsmallcust');
            }
            if ($dBasketPrice >= $dMidlleCustPrice && $dBasketPrice < $dLargeCustPrice) {
                $this->addToGroup('oxidmiddlecust');
            }
            if ($dBasketPrice >= $dLargeCustPrice) {
                $this->addToGroup('oxidgoodcust');
            }

            if ($this->inGroup('oxidnotyetordered')) {
                $this->removeFromGroup('oxidnotyetordered');
            }
        }
    }
763089
protected function GetBasketStatistics($oBasket)
    {
        $sBasketstatistics = '';
        $sBasketstatistics .= "------------------------------------\r\n\r\n";
        $sBasketstatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.basket_content')."\r\n";
        $sBasketstatistics .= "------------------------------------\r\n";
        $oArticleList = $oBasket->GetBasketContents();
        $oArticleList->GoToStart();
        while ($oArticle = $oArticleList->Next()) {
            $sBasketstatistics .= TGlobal::Translate(
                    'chameleon_system_shop.cron_send_basket_stats.basket_content_line',
                    array(
                        '%amount%' => '',
                        '%name%' => '',
                        '%price%' => '',
                        '%totalPrice%' => '',
                    )
                )."\r\n";
        }
        $sBasketstatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.basket_content_total', array('%basketTotal%' => $oBasket->dCostArticlesTotal))."\r\n";
        $this->sTotalMoneyCanceled = $this->sTotalMoneyCanceled + $oBasket->dCostArticlesTotal;
        $sBasketstatistics .= "------------------------------------\r\n";

        return $sBasketstatistics;
    }
1039622
public function calculateBasket($blForceUpdate = false)
    {
        /*
        //would be good to perform the reset of previous calculation
        //at least you can use it for the debug
        $this->_aDiscounts = array();
        $this->_aItemDiscounts = array();
        $this->_oTotalDiscount = null;
        $this->_dDiscountedProductNettoPrice = 0;
        $this->_aDiscountedVats = array();
        $this->_oPrice = null;
        $this->_oNotDiscountedProductsPriceList = null;
        $this->_oProductsPriceList = null;
        $this->_oDiscountProductsPriceList = null;*/

        if (!$this->isEnabled()) {
            return;
        }

        if ($blForceUpdate) {
            $this->onUpdate();
        }

        if (!($this->_blUpdateNeeded || $blForceUpdate)) {
            return;
        }

        $this->_aCosts = [];

        //  1. saving basket to the database
        $this->_save();

        //  2. remove all bundles
        $this->_clearBundles();

        //  3. generate bundle items
        $this->_addBundles();

        //  4. calculating item prices
        $this->_calcItemsPrice();

        //  5. calculating/applying discounts
        $this->_calcBasketDiscount();

        //  6. calculating basket total discount
        $this->_calcBasketTotalDiscount();

        //  7. check for vouchers
        $this->_calcVoucherDiscount();

        //  8. applies all discounts to pricelist
        $this->_applyDiscounts();

        //  9. calculating additional costs:
        //  9.1: delivery
        $this->setCost('oxdelivery', $this->_calcDeliveryCost());

        //  9.2: adding wrapping and gift card costs
        $this->setCost('oxwrapping', $this->_calcBasketWrapping());

        $this->setCost('oxgiftcard', $this->_calcBasketGiftCard());

        //  9.3: adding payment cost
        $this->setCost('oxpayment', $this->_calcPaymentCost());

        //  10. calculate total price
        $this->_calcTotalPrice();

        //  11. formatting discounts
        $this->formatDiscount();

        //  12.setting to up-to-date status
        $this->afterUpdate();
    }
1326593
public function getPayPalPayCostVat()
    {
        $paymentVAT = 0.0;

        $paymentCost = $this->getCosts('oxpayment');
        if ($paymentCost && $paymentCost->getVatValue()) {
            $paymentVAT = $paymentCost->getVatValue();
        }

        return $paymentVAT;
    }
1298205
protected function _getArticleBundles($oBasketItem)
    {
        $aBundles = [];

        if ($oBasketItem->isBundle()) {
            return $aBundles;
        }

        $oArticle = $oBasketItem->getArticle(true);
        if ($oArticle && $oArticle->oxarticles__oxbundleid->value) {
            $aBundles[$oArticle->oxarticles__oxbundleid->value] = 1;
        }

        return $aBundles;
    }
1063670
protected function GetExportRowFromDataObject(&$oDataObjct)
    {
        $aRow = parent::GetExportRowFromDataObject($oDataObjct);

        $oOrder = &$oDataObjct->GetFieldShopOrder();

        $aRow['ordernumber'] = $oOrder->fieldOrdernumber;
        $aRow['customer_number'] = $oOrder->fieldCustomerNumber;
        $aRow['orderdate'] = $oOrder->fieldDatecreated;
        $aRow['affiliate_code'] = $oOrder->fieldAffiliateCode;

        $oLocale = &TCMSLocal::GetActive();
        $aRow['price'] = $oLocale->FormatNumber($aRow['price'], 2);
        $aRow['price_reference'] = $oLocale->FormatNumber($aRow['price_reference'], 2);
        $aRow['vat_percent'] = $oLocale->FormatNumber($aRow['vat_percent'], 2);

        $aRow['order_price_total'] = $oLocale->FormatNumber($aRow['order_price_total'], 2);
        $aRow['order_price_after_discounts'] = $oLocale->FormatNumber($aRow['order_price_after_discounts'], 2);
        $aRow['order_total_weight'] = $oLocale->FormatNumber($aRow['order_total_weight'], 2);
        $aRow['order_total_volume'] = $oLocale->FormatNumber($aRow['order_total_volume'], 2);
        $aRow['order_price'] = $oLocale->FormatNumber($aRow['order_price'], 2);
        $aRow['order_amount'] = $oLocale->FormatNumber($aRow['order_amount'], 2);

        return $aRow;
    }