Retrieve Magento tax rates for
Merchant API to pick up

@return array
761729
public function getTaxRates()
    {
        $rates = [];
        /** @var \Magento\Tax\Model\Calculation\Rate $rate */
        foreach ($this->taxRates as $rate) {
            $zipCodeType      = self::ZIP_CODE_TYPE_ALL;
            $zipCodePattern   = '';
            $zipCodeRangeFrom = '';
            $zipCodeRangeTo   = '';

            if ($rate->getZipIsRange()) {
                $zipCodeType      = self::ZIP_CODE_TYPE_RANGE;
                $zipCodeRangeFrom = $rate->getZipFrom();
                $zipCodeRangeTo   = $rate->getZipTo();
            } elseif ($rate->getTaxPostcode() && $rate->getTaxPostcode() != '*') {
                $zipCodeType    = self::ZIP_CODE_TYPE_PATTERN;
                $zipCodePattern = $rate->getTaxPostcode();
            }

            $state    = '';
            $regionId = $rate->getTaxRegionId();

            if ($regionId) {
                /** @var \Magento\Directory\Model\Region $region */
                $region = $this->regionCollection->getItemById($regionId);
                $state  = $this->regionHelper->getIsoStateByMagentoRegion(
                    new DataObject(
                        [
                            'region_code' => $region->getCode(),
                            'country_id'  => $rate->getTaxCountryId()
                        ]
                    )
                );
            }

            $rates[] = [
                'id'                 => $rate->getId(),
                'key'                => $rate->getId(),
                'display_name'       => $rate->getCode(),
                'tax_percent'        => round($rate->getRate(), 4),
                'country'            => $rate->getTaxCountryId(),
                'state'              => $state,
                'zipcode_type'       => $zipCodeType,
                'zipcode_pattern'    => $zipCodePattern,
                'zipcode_range_from' => $zipCodeRangeFrom,
                'zipcode_range_to'   => $zipCodeRangeTo
            ];
        }

        return $rates;
    }
485455
public function loadConvertedPrices()
    {
        $product_sale_element_id  = \intval($this->getRequest()->get('product_sale_element_id', 0));
        $currency_id = \intval($this->getRequest()->get('currency_id', 0));

        $price_with_tax = $price_without_tax = $sale_price_with_tax = $sale_price_without_tax = 0;

        if (null !== $pse = ProductSaleElementsQuery::create()->findPk($product_sale_element_id)) {
            if ($currency_id > 0
                &&
                $currency_id != Currency::getDefaultCurrency()->getId()
                &&
                null !== $currency = CurrencyQuery::create()->findPk($currency_id)) {
                // Get the default currency price
                $productPrice = ProductPriceQuery::create()
                    ->filterByCurrency(Currency::getDefaultCurrency())
                    ->filterByProductSaleElementsId($product_sale_element_id)
                    ->findOne()
                ;

                // Calculate the converted price
                if (null !== $productPrice) {
                    $price_without_tax = $productPrice->getPrice() * $currency->getRate();
                    $sale_price_without_tax = $productPrice->getPromoPrice() * $currency->getRate();
                }
            }

            if (null !== $product = $pse->getProduct()) {
                $price_with_tax = $this->computePrice($price_without_tax, 'with_tax', $product);
                $sale_price_with_tax = $this->computePrice($sale_price_without_tax, 'with_tax', $product);
            }
        }

        return new JsonResponse(array(
            'price_with_tax'         => $this->formatPrice($price_with_tax),
            'price_without_tax'      => $this->formatPrice($price_without_tax),
            'sale_price_with_tax'    => $this->formatPrice($sale_price_with_tax),
            'sale_price_without_tax' => $this->formatPrice($sale_price_without_tax)
        ));
    }
869112
private function getStores()
    {
        $collection = $this->getRetailerCollection();
        $cacheKey   = sprintf("%s_%s", 'checkout_storedelivery', $collection->getStoreId());

        $markers = $this->cache->load($cacheKey);
        if (!$markers) {
            $markers = [];
            /** @var RetailerInterface $retailer */
            foreach ($collection as $retailer) {
                $address    = $retailer->getExtensionAttributes()->getAddress();
                $coords     = $address->getCoordinates();
                $markerData = [
                    'id'           => $retailer->getId(),
                    'latitude'     => $coords->getLatitude(),
                    'longitude'    => $coords->getLongitude(),
                    'name'         => $retailer->getName(),
                    'address'      => $this->addressFormatter->formatAddress($address, AddressFormatter::FORMAT_ONELINE),
                    'url'          => $this->storeLocatorHelper->getRetailerUrl($retailer),
                    'directionUrl' => $this->map->getDirectionUrl($address->getCoordinates()),
                    'setStoreData' => $this->getSetStorePostData($retailer),
                    'addressData'  => $address->getData(),
                ];

                $markerData['schedule'] = array_merge(
                    $this->scheduleHelper->getConfig(),
                    [
                        'calendar'            => $this->scheduleManager->getCalendar($retailer),
                        'openingHours'        => $this->scheduleManager->getWeekOpeningHours($retailer),
                        'specialOpeningHours' => $retailer->getExtensionAttributes()->getSpecialOpeningHours(),
                    ]
                );

                $markers[] = $markerData;
            }

            $markers = json_encode($markers);
            $this->cache->save(
                $markers,
                $cacheKey,
                $collection->getNewEmptyItem()->getCacheTags()
            );
        }

        return json_decode($markers);
    }
269958
public function getData()
    {
        parent::getData();

        $this->validate('amount', 'currency', 'description', 'transactionId');

        return array(
            'amount' => $this->getAmountInteger(),
            'currency' => $this->getCurrency(),
            'description' => $this->getDescription(),
            'id' => $this->getTransactionId(),
            'type' => 'refund',
        );
    }
626039
public function loadAmountPriceInfo()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        if (!$myConfig->getConfigParam('bl_perfLoadPrice') || !$this->_blLoadPrice || !$this->_blCalcPrice || !$this->hasAmountPrice()) {
            return [];
        }

        if ($this->_oAmountPriceInfo === null) {
            $this->_oAmountPriceInfo = [];
            if (count(($aAmPriceList = $this->_getAmountPriceList()->getArray()))) {
                $this->_oAmountPriceInfo = $this->_fillAmountPriceList($aAmPriceList);
            }
        }

        return $this->_oAmountPriceInfo;
    }
944803
protected function getPaymentTransactionStructure()
    {
        return [
            'amount'             => $this->transformAmount($this->amount, $this->currency),
            'currency'           => $this->currency,
            'bank_code'          => $this->bank_code,
            'return_success_url' => $this->return_success_url,
            'return_failure_url' => $this->return_failure_url,
            'customer_email'     => $this->customer_email,
            'customer_phone'     => $this->customer_phone,
            'payment_type'       => $this->payment_type,
            'document_id'        => $this->document_id,
            'billing_address'    => $this->getBillingAddressParamsStructure(),
            'shipping_address'   => $this->getShippingAddressParamsStructure()
        ];
    }
789922
public function getPaymentCurrencyOptions()
    { 
        // Create the base options
        $options = [
            [
                'value' => self::BASE_CURRENCY,
                'label' => __('Use Magento default')
            ],
            [
                'value' => self::ORDER_CURRENCY,
                'label' => __('Order currency')
            ],
            [
                'value' => self::CUSTOM_CURRENCY,
                'label' => __('Custom currency')
            ],
        ];

        // Return the options as array
        return $options;
    }
427493
protected function getPaymentTransactionStructure()
    {
        return [
            'amount'              => $this->transformAmount($this->amount, $this->currency),
            'currency'            => $this->currency,
            'customer_account_id' => $this->customer_account_id,
            'return_url'          => $this->return_url,
            'customer_email'      => $this->customer_email,
            'customer_phone'      => $this->customer_phone,
            'billing_address'     => $this->getBillingAddressParamsStructure(),
            'shipping_address'    => $this->getShippingAddressParamsStructure()
        ];
    }
542550
public function getAddonPrices()
    {
        $addonPrices = [];
        if ($this->addonPrices) {
            foreach ($this->addonPrices as $addonPrice) {
                $addonPrices[] = new AddonPrice($addonPrice, $this->locale, $this->priceFormatter);
            }
        }

        return $addonPrices;
    }
387644
public static function getTaxQueryTerms()
    {
        if (!get_query_var('tax_query') || !is_array(get_query_var('tax_query')) || empty(get_query_var('tax_query'))) {
            return false;
        }

        $taxonomies = array();
        foreach (get_query_var('tax_query') as $key => $query) {
            if (is_numeric($key)) {
                $taxonomies[$query['taxonomy']] = $query['terms'];
            }
        }

        if (!isset($taxonomies) || !is_array($taxonomies) || empty($taxonomies)) {
            return false;
        }

        $terms = array();
        foreach ($taxonomies as $taxonomy => $taxTerm) {
            foreach ($taxTerm as $slug) {
                $terms[] = get_term_by('slug', $slug, $taxonomy);
            }
        }

        if (!isset($terms) || !is_array($terms) || empty($terms)) {
            return false;
        }

        return $terms;
    }
160561
public function toWebDriver()
    {
        return [
            'type' => 'receipt',
            'recipient_name' => $this->recipient_name,
            'merchant_name' => $this->merchant_name,
            'order_number' => $this->order_number,
            'currency' => $this->currency,
            'payment_method' => $this->payment_method,
            'order_url' => $this->order_url,
            'timestamp' => $this->timestamp,
            'elements' => $this->elements,
            'address' => $this->address,
            'summary' => $this->summary,
            'adjustments' => $this->adjustments,
        ];
    }
772303
protected function getByPriceTypeASC() : array
    {
        $obPriceType = $this->getPriceTypeObject();
        if (empty($obPriceType)) {
            return $this->getByPriceASC();
        }

        $arElementIDList = (array) Price::getByItemType(Offer::class)
            ->getByPriceType($obPriceType->id)
            ->orderBy('price', 'asc')
            ->lists('item_id');

        return $arElementIDList;
    }
1172946
protected function extractCharging()
    {
        $result = [];
        $trailer = $this->registries[2];

        foreach (static::CHARGING_TYPES as $type) {
            $count = "${type}_count";
            $total = "${type}_total";
            $warning = "${type}_warning";

            $result = array_merge(
                $result,
                [
                    $count => (int) $trailer->{$count},
                    $total => (float) ($trailer->{$total} / 100.0),
                    $warning => (int) $trailer->{$warning},
                ]
            );
        }

        return $result;
    }
216602
public function getCurrencyList()
    {
        $currency = Site::getCurrencyList();

        $return = array();
        foreach (array_keys(Site::getCurrencyList()) as $currencyCode) {
            $return[$currencyCode] = Piwik::translate('Intl_Currency_' . $currencyCode) .
              ' (' . Piwik::translate('Intl_CurrencySymbol_' . $currencyCode) . ')';
        }

        asort($return);

        return $return;
    }
353212
public function availableCurrencies() {
		if (!isset($this->CurrencyLib)) {
			$this->CurrencyLib = new CurrencyLib();
		}
		$base = $this->baseCurrency();
		$res = $this->CurrencyLib->table($base['code'], 4);
		if ($res) {
			return $res;
		}
		return [];
	}
591996
public function collectCommonData()
    {
        /** @var OxpsPaymorrowSettings $oPmSettings */
        $oPmSettings = oxNew( 'OxpsPaymorrowSettings' );

        /** @var oxUser|OxpsPaymorrowOxUser $oUser */
        $oUser = $this->getUser();

        return array(
            'merchantId'           => $oPmSettings->getMerchantId(),
            'mpiSignature'         => $oPmSettings->getMpiSignature(),
            'request_languageCode' => $oUser->getUserPaymorrowRequestLanguage(),
            'request_id'           => $this->getUniqueString(),
        );
    }
1126329
protected function getPaymentTransactionStructure()
    {
        return [
            'card_type'                 => $this->card_type,
            'redeem_type'               => $this->redeem_type,
            'amount'                    => $this->transformAmount($this->amount, $this->currency),
            'currency'                  => $this->currency,
            'card_holder'               => $this->card_holder,
            'card_number'               => $this->card_number,
            'cvv'                       => $this->cvv,
            'expiration_month'          => $this->expiration_month,
            'expiration_year'           => $this->expiration_year,
            'customer_email'            => $this->customer_email,
            'customer_phone'            => $this->customer_phone,
            'birth_date'                => $this->birth_date,
            'billing_address'           => $this->getBillingAddressParamsStructure(),
            'shipping_address'          => $this->getShippingAddressParamsStructure(),
            'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
        ];
    }