the the value map for one article (order item).

@param TdbShopOrderStatusItem        $oPosition
@param IMapperCacheTriggerRestricted $oCacheTriggerManager
@param $bCachingEnabled

@return array
553382
protected function getArticle(
        TdbShopOrderStatusItem $oPosition,
        IMapperCacheTriggerRestricted $oCacheTriggerManager,
        $bCachingEnabled
    ) {
        $oOrderItem = $oPosition->GetFieldShopOrderItem();
        $aArticle = array();
        /** @var $oArticle TdbShopArticle */
        $oArticle = &$oOrderItem->GetFieldShopArticle();

        $aArticle['iAmount'] = number_format((float) $oOrderItem->fieldOrderAmount, 0, ',', '');
        $aArticle['iUsedAmount'] = number_format($oPosition->fieldAmount, 0, ',', '');
        $aArticle['sManufacturer'] = $oOrderItem->fieldShopManufacturerName;
        $aArticle['sArticleName'] = $oOrderItem->fieldName;
        $aArticle['sArticleVariantName'] = $oOrderItem->fieldNameVariantInfo;
        $aArticle['sPrice'] = $oOrderItem->fieldOrderPriceFormated;
        $aArticle['sPriceTotal'] = $oOrderItem->fieldOrderPriceTotalFormated;
        $aArticle['sUsedPriceTotal'] = $oOrderItem->fieldPrice * $oPosition->fieldAmount;

        if ($oArticle) {
            $aArticle['sImageId'] = $this->getArticleImageId($oArticle, $oCacheTriggerManager, $bCachingEnabled);
            $aArticle = $this->GetVariantInfo($oArticle, $aArticle, $oCacheTriggerManager, $bCachingEnabled);
            $aArticle['sArticleDetailURL'] = $oArticle->getLink(true);
            if ($bCachingEnabled) {
                $oCacheTriggerManager->addTrigger($oArticle->table, $oArticle->id);
            }
        }

        return $aArticle;
    }
1122337
protected function _getItemBundles($oBasketItem, $aBundles = [])
    {
        if ($oBasketItem->isBundle()) {
            return [];
        }

        // does this object still exists ?
        if ($oArticle = $oBasketItem->getArticle()) {
            $aDiscounts = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class)->getBasketItemBundleDiscounts($oArticle, $this, $this->getBasketUser());

            foreach ($aDiscounts as $oDiscount) {
                $iAmnt = $oDiscount->getBundleAmount($oBasketItem->getAmount());
                if ($iAmnt) {
                    //init array element
                    if (!isset($aBundles[$oDiscount->oxdiscount__oxitmartid->value])) {
                        $aBundles[$oDiscount->oxdiscount__oxitmartid->value] = 0;
                    }

                    if ($oDiscount->oxdiscount__oxitmmultiple->value) {
                        $aBundles[$oDiscount->oxdiscount__oxitmartid->value] += $iAmnt;
                    } else {
                        $aBundles[$oDiscount->oxdiscount__oxitmartid->value] = $iAmnt;
                    }
                }
            }
        }

        return $aBundles;
    }
947332
private function getManufacturerList(TdbShopManufacturerList $oManufacturerList)
    {
        $navigationKeyList = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0-9');
        $manufacturerList = array();

        foreach ($navigationKeyList as $sNavigationItem) {
            $manufacturerList[$sNavigationItem] = array(
                'sTitle' => $sNavigationItem,
                'bShowMinimizer' => true,
                'aItemList' => array(),
            );
        }

        while ($manufacturer = $oManufacturerList->Next()) {
            $manufacturerName = $manufacturer->GetName();
            $normalizedManufacturerName = $this->urlNormalizationUtil->normalizeUrl($manufacturerName);
            $firstLetter = strtoupper(mb_substr($normalizedManufacturerName, 0, 1));

            $aItem = array();
            $aItem['sLink'] = $manufacturer->GetLinkProducts();
            $aItem['sTitle'] = $manufacturerName;

            $key = $firstLetter;
            if (is_numeric($firstLetter)) {
                $key = '0-9';
            }

            $manufacturerList[$key]['aItemList'][] = $aItem;
        }

        $oManufacturerList->GoToStart();

        return $manufacturerList;
    }
1216967
public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '')
    {
        $bPaymentOk = parent::ExecutePayment($oOrder);

        if ($bPaymentOk && $this->TransactionMatchesCurrentBasketState()) {
            $bPaymentOk = $this->UpdateTransaction('SAS'); //capture
        } else {
            $bPaymentOk = false;
        }

        return $bPaymentOk;
    }
1021247
private function getIPNIdentifierFromOrder(TdbShopOrder $oOrder)
    {
        $sIdentifier = null;
        $query = "SELECT `shop_payment_handler_group`.*
                    FROM `shop_payment_handler_group`
              INNER JOIN `shop_payment_handler` on `shop_payment_handler_group`.`id` = `shop_payment_handler`.`shop_payment_handler_group_id`
              INNER JOIN `shop_payment_method` on `shop_payment_handler`.`id` = `shop_payment_method`.`shop_payment_handler_id`
              INNER JOIN `shop_order` on `shop_payment_method`.`id` = `shop_order`.`shop_payment_method_id`
                   WHERE `shop_order`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."'
        ";
        if ($aGroup = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
            $sIdentifier = trim($aGroup['ipn_group_identifier']);
            if ('' === $sIdentifier) {
                $sIdentifier = trim($aGroup['system_name']);
            }
        }

        return $sIdentifier;
    }
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;
    }
1073873
public function getBillableProducts($bIncludeUnconfirmedTransactions = true)
    {
        $aProductList = array();
        $oOrderItemList = $this->order->GetFieldShopOrderItemList();
        $oOrderItemList->GoToStart();
        while ($oOrderItem = $oOrderItemList->Next()) {
            $iBilled = $this->getProductAmountWithTransactionType(
                $oOrderItem->id,
                self::TRANSACTION_TYPE_PAYMENT,
                $bIncludeUnconfirmedTransactions
            );
            $iRemaining = round($oOrderItem->fieldOrderAmount - $iBilled);
            if ($iRemaining > 0) {
                $aProductList[$oOrderItem->id] = $iRemaining;
            }
        }
        $oOrderItemList->GoToStart();

        return $aProductList;
    }
32587
protected function getDataFromVoucher(TdbShopVoucherUse $oVoucherUse, TdbShopVoucher $oVoucher = null, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
    {
        $aVoucher = array(
            'sCode' => '',
            'sName' => '',
            'dValue' => $oVoucherUse->fieldValueUsed,
            'dValueInOrderCurrency' => $oVoucherUse->fieldValueUsedInOrderCurrency,
            'sValue' => TCMSLocal::GetActive()->FormatNumber($oVoucherUse->fieldValueUsed, 2),
            'sValueInOrderCurrency' => TCMSLocal::GetActive()->FormatNumber($oVoucherUse->fieldValueUsedInOrderCurrency, 2),
            'sRemoveFromBasketLink' => '#', );

        if (null !== $oVoucher) {
            $aVoucher['sCode'] = $oVoucher->fieldCode;
            $oVoucherSeries = &$oVoucher->GetFieldShopVoucherSeries();
            if (null !== $oVoucherSeries) {
                if ($bCachingEnabled) {
                    $oCacheTriggerManager->addTrigger($oVoucherSeries->table, $oVoucherSeries->id);
                }
                $aVoucher['sName'] = $oVoucherSeries->fieldName;
            }
        }

        return $aVoucher;
    }
816985
public function getOrderArticles($blExcludeCanceled = false)
    {
        // checking set value
        if ($blExcludeCanceled) {
            return $this->_getArticles(true);
        } elseif ($this->_oArticles === null) {
            $this->_oArticles = $this->_getArticles();
        }

        return $this->_oArticles;
    }
843133
protected function getArticleList(TdbShopOrder $oOrder, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
    {
        $aArticleList = array();
        $oOrderItemList = &$oOrder->GetFieldShopOrderItemList();
        while ($oOrderItem = &$oOrderItemList->Next()) {
            if ($bCachingEnabled) {
                $oCacheTriggerManager->addTrigger($oOrderItem->table, $oOrderItem->id);
            }
            $aArticleList[] = $this->getArticle($oOrderItem, $oCacheTriggerManager, $bCachingEnabled);
        }

        return $aArticleList;
    }
15438
protected function _initArticle($sHeapTable, $iCnt, & $blContinue)
    {
        $oRs = $this->getDb()->selectLimit("select oxid from $sHeapTable", 1, $iCnt);
        if ($oRs != false && $oRs->count() > 0) {
            $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
            $oArticle->setLoadParentData(true);

            $oArticle->setLanguage(\OxidEsales\Eshop\Core\Registry::getSession()->getVariable("iExportLanguage"));

            if ($oArticle->load($oRs->fields[0])) {
                // if article exists, do not stop export
                $blContinue = true;
                // check price
                $dMinPrice = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportMinPrice");
                if (!isset($dMinPrice) || (isset($dMinPrice) && ($oArticle->getPrice()->getBruttoPrice() >= $dMinPrice))) {
                    //Saulius: variant title added
                    $sTitle = $oArticle->oxarticles__oxvarselect->value ? " " . $oArticle->oxarticles__oxvarselect->value : "";
                    $oArticle->oxarticles__oxtitle->setValue($oArticle->oxarticles__oxtitle->value . $sTitle);

                    $oArticle = $this->updateArticle($oArticle);

                    return $oArticle;
                }
            }
        }
    }
780912
function _doCapt($oID, $amt = 0, $currency = 'USD') {
    global $db, $messageStack;

    //@TODO: Read current order status and determine best status to set this to
    $new_order_status = (int)MODULE_PAYMENT_AUTHORIZENET_AIM_ORDER_STATUS_ID;
    if ($new_order_status == 0) $new_order_status = 1;

    $proceedToCapture = true;
    $captureNote = strip_tags(zen_db_input($_POST['captnote']));
    if (isset($_POST['captconfirm']) && $_POST['captconfirm'] == 'on') {
    } else {
      $messageStack->add_session(MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CAPTURE_CONFIRM_ERROR, 'error');
      $proceedToCapture = false;
    }
    if (isset($_POST['btndocapture']) && $_POST['btndocapture'] == MODULE_PAYMENT_AUTHORIZENET_AIM_ENTRY_CAPTURE_BUTTON_TEXT) {
      $captureAmt = (float)$_POST['captamt'];
/*
      if ($captureAmt == 0) {
        $messageStack->add_session(MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_INVALID_CAPTURE_AMOUNT, 'error');
        $proceedToCapture = false;
      }
*/
    }
    if (isset($_POST['captauthid']) && trim($_POST['captauthid']) != '') {
      // okay to proceed
    } else {
      $messageStack->add_session(MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_TRANS_ID_REQUIRED_ERROR, 'error');
      $proceedToCapture = false;
    }
    /**
     * Submit capture request to Authorize.net
     */
    if ($proceedToCapture) {
      // Populate an array that contains all of the data to be sent to Authorize.net
      unset($submit_data);
      $submit_data = array(
                           'x_type' => 'PRIOR_AUTH_CAPTURE',
                           'x_amount' => number_format($captureAmt, 2),
                           'x_trans_id' => strip_tags(trim($_POST['captauthid'])),
//                         'x_invoice_num' => $new_order_id,
//                         'x_po_num' => $order->info['po_number'],
//                         'x_freight' => $order->info['shipping_cost'],
//                         'x_tax_exempt' => 'FALSE', /* 'TRUE' or 'FALSE' */
//                         'x_tax' => $order->info['tax'],
                           );

      $response = $this->_sendRequest($submit_data);
      $response_code = $response[0];
      $response_text = $response[3];
      $response_alert = $response_text . ($this->commError == '' ? '' : ' Communications Error - Please notify webmaster.');
      $this->reportable_submit_data['Note'] = $captureNote;
      $this->_debugActions($response);

      if ($response_code != '1' || ($response[0]==1 && $response[2] == 311) ) {
        $messageStack->add_session($response_alert, 'error');
      } else {
        // Success, so save the results
        $sql_data_array = array('orders_id' => (int)$oID,
                                'orders_status_id' => (int)$new_order_status,
                                'date_added' => 'now()',
                                'comments' => 'FUNDS COLLECTED. Auth Code: ' . $response[4] . "\n" . 'Trans ID: ' . $response[6] . "\n" . ' Amount: ' . ($response[9] == 0.00 ? 'Full Amount' : $response[9]) . "\n" . 'Time: ' . date('Y-m-D h:i:s') . "\n" . $captureNote,
                                'customer_notified' => 0
                             );
        zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
        $db->Execute("update " . TABLE_ORDERS  . "
                      set orders_status = '" . (int)$new_order_status . "'
                      where orders_id = '" . (int)$oID . "'");
        $messageStack->add_session(sprintf(MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CAPT_INITIATED, ($response[9] == 0.00 ? 'Full Amount' : $response[9]), $response[6], $response[4]), 'success');
        return true;
      }
    }
    return false;
  }
88949
public function handleSalesQuoteCollectTotalsAfter(Varien_Event_Observer $observer)
    {
        $event = $observer->getEvent();
        /** @var Mage_Sales_Model_Quote $quote */
        $quote = $event->getQuote();
        /** @var Mage_Sales_Model_Resource_Quote_Address_Collection */
        $addresses = $quote->getAddressesCollection();
        foreach ($addresses as $address) {
            $appliedRuleIds = $address->getAppliedRuleIds();
            if (is_array($appliedRuleIds)) {
                $appliedRuleIds = implode(',', $appliedRuleIds);
            }
            $data = (array) $address->getEbayEnterpriseOrderDiscountData();
            $data[$appliedRuleIds] = [
                'id' => $appliedRuleIds,
                'amount' => $address->getBaseShippingDiscountAmount(),
                'description' => $this->helper->__('Shipping Discount'),
            ];
            $address->setEbayEnterpriseOrderDiscountData($data);
        }
    }
969315
private function getOrder(TdbShopOrder $oOrder, $bCachingEnabled, IMapperCacheTriggerRestricted $oCacheTriggerManager)
    {
        $aOrder = array();

        $oLocal = TCMSLocal::GetActive();

        $aOrder['sOrderDate'] = $oLocal->FormatDate($oOrder->fieldDatecreated, TCMSLocal::DATEFORMAT_SHOW_DATE);
        $aOrder['sOrdernumber'] = $oOrder->fieldOrdernumber;
        $aOrder['sSumGrandTotal'] = $oOrder->fieldValueTotalFormated;
        $aOrder['sShippingAddress'] = $this->getShippingAddress($oOrder, $bCachingEnabled, $oCacheTriggerManager);
        $aOrder['sDetailLink'] = $this->getDetailLink($oOrder);
        $orderCurrency = $oOrder->GetFieldPkgShopCurrency();
        if (null !== $orderCurrency) {
            $aOrder['currencyIso'] = $orderCurrency->fieldIso4217;
            $aOrder['currencySymbol'] = $orderCurrency->fieldSymbol;
        }
        $aOrder['bActive'] = false;

        return $aOrder;
    }
1247212
public function GetBasketQuantityForVoucher(TdbShopVoucher &$oVoucher)
    {
        $iCurrentPosition = $this->getItemPointer();
        $this->GoToStart();
        $iAmount = 0;
        while ($oItem = &$this->Next()) {
            $bIncludeProduct = $oVoucher->AllowVoucherForArticle($oItem);
            if ($bIncludeProduct) {
                $iAmount = $iAmount + $oItem->dAmount;
            }
        }
        $this->setItemPointer($iCurrentPosition);

        return $iAmount;
    }
364816
function _doCapt($oID, $captureType = 'Complete', $amt = 0, $currency = 'USD', $note = '') {
    global $db, $doPayPal, $messageStack;
    $doPayPal = $this->paypal_init();

    //@TODO: Read current order status and determine best status to set this to
    $new_order_status = (int)MODULE_PAYMENT_PAYPALDP_ORDER_STATUS_ID;

    $orig_order_amount = 0;
    $doPayPal = $this->paypal_init();
    $proceedToCapture = false;
    $captureNote = strip_tags(zen_db_input($_POST['captnote']));
    if (isset($_POST['captfullconfirm']) && $_POST['captfullconfirm'] == 'on') {
      $proceedToCapture = true;
    } else {
      $messageStack->add_session(MODULE_PAYMENT_PAYPALDP_TEXT_CAPTURE_FULL_CONFIRM_ERROR, 'error');
    }
    if (isset($_POST['captfinal']) && $_POST['captfinal'] == 'on') {
      $captureType = 'Complete';
    } else {
      $captureType = 'NotComplete';
    }
    if (isset($_POST['btndocapture']) && $_POST['btndocapture'] == MODULE_PAYMENT_PAYPAL_ENTRY_CAPTURE_BUTTON_TEXT_FULL) {
      $captureAmt = (float)$_POST['captamt'];
      if ($captureAmt == 0) {
        $messageStack->add_session(MODULE_PAYMENT_PAYPALDP_TEXT_INVALID_CAPTURE_AMOUNT, 'error');
        $proceedToCapture = false;
      }
    }
    // look up history on this order from PayPal table
    $sql = "select * from " . TABLE_PAYPAL . " where order_id = :orderID  AND parent_txn_id = '' ";
    $sql = $db->bindVars($sql, ':orderID', $oID, 'integer');
    $zc_ppHist = $db->Execute($sql);
    if ($zc_ppHist->RecordCount() == 0) return false;
    $txnID = $zc_ppHist->fields['txn_id'];
    /**
     * Submit capture request to PayPal
     */
    if ($proceedToCapture) {
      $response = $doPayPal->DoCapture($txnID, $captureAmt, $currency, $captureType, '', $captureNote);
      $error = $this->_errorHandler($response, 'DoCapture');
      $new_order_status = ($new_order_status > 0 ? $new_order_status : 1);
      if (!$error) {
        if (isset($response['PNREF'])) {
          if (!isset($response['AMT'])) $response['AMT'] = $captureAmt;
          if (!isset($response['ORDERTIME'])) $response['ORDERTIME'] = date("M-d-Y h:i:s");
        }
        // Success, so save the results
        $sql_data_array = array('orders_id' => (int)$oID,
                                'orders_status_id' => (int)$new_order_status,
                                'date_added' => 'now()',
                                'comments' => 'FUNDS COLLECTED. Trans ID: ' . urldecode($response['TRANSACTIONID']) . $response['PNREF']. "\n" . ' Amount: ' . urldecode($response['AMT']) . ' ' . $currency . "\n" . 'Time: ' . urldecode($response['ORDERTIME']) . "\n" . (isset($response['RECEIPTID']) ? 'Receipt ID: ' . urldecode($response['RECEIPTID']) : 'Auth Code: ' . $response['AUTHCODE']) . (isset($response['PPREF']) ? "\nPPRef: " . $response['PPREF'] : '') . "\n" . $captureNote,
                                'customer_notified' => 0
                             );
        zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
        $db->Execute("update " . TABLE_ORDERS  . "
                      set orders_status = '" . (int)$new_order_status . "'
                      where orders_id = '" . (int)$oID . "'");
        $messageStack->add_session(sprintf(MODULE_PAYMENT_PAYPALDP_TEXT_CAPT_INITIATED, urldecode($response['AMT']), urldecode($response['RECEIPTID'] . $response['AUTHCODE']). $response['PNREF']), 'success');
        return true;
      }
    }
  }
421368
protected function _getSessionBasketItems($oDiscount = null)
    {
        if (is_null($oDiscount)) {
            $oDiscount = $this->_getSerieDiscount();
        }

        $oBasket = $this->getSession()->getBasket();
        $aItems = [];
        $iCount = 0;

        foreach ($oBasket->getContents() as $oBasketItem) {
            if (!$oBasketItem->isDiscountArticle() && ($oArticle = $oBasketItem->getArticle()) && !$oArticle->skipDiscounts() && $oDiscount->isForBasketItem($oArticle)) {
                $aItems[$iCount] = [
                    'oxid'     => $oArticle->getId(),
                    'price'    => $oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $oBasket)->getPrice(),
                    'discount' => $oDiscount->getAbsValue($oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $oBasket)->getPrice()),
                    'amount'   => $oBasketItem->getAmount(),
                ];

                $iCount++;
            }
        }

        return $aItems;
    }