Skip to content

Commit

Permalink
Merged in update-old-version (pull request #6)
Browse files Browse the repository at this point in the history
update-old-version: update code
  • Loading branch information
Martin Nguyen authored and JaJuMa committed Feb 16, 2023
2 parents 4816e54 + e8fdfc6 commit 37f021b
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 355 deletions.
41 changes: 41 additions & 0 deletions Helper/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* @author JaJuMa GmbH <info@jajuma.de>
* @copyright Copyright (c) 2022-present JaJuMa GmbH <https://www.jajuma.de>. All rights reserved.
* @license http://opensource.org/licenses/mit-license.php MIT License
*/

namespace Jajuma\DynamicShippingTax\Helper;

use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Store\Model\ScopeInterface;

class Config extends AbstractHelper
{
public const CONFIG_PATH_DYNAMIC_SHIPPING_TAX_CLASS = 'tax/classes/dynamic_shipping_tax_class';

/**
* Get dynamic shipping tax class type
*
* @return mixed
*/
public function getDynamicShippingTaxType()
{
return $this->scopeConfig->getValue(self::CONFIG_PATH_DYNAMIC_SHIPPING_TAX_CLASS);
}

/**
* Get default tax class
*
* @param mixed $store
* @return int
*/
public function getDefaultTaxClass($store): int
{
return (int)$this->scopeConfig->getValue(
\Magento\Tax\Model\Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS,
ScopeInterface::SCOPE_STORE,
$store
);
}
}
8 changes: 5 additions & 3 deletions Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

class Config
{
const SHIPPING_TAX_TYPE_DEFAULT = 0;
const SHIPPING_TAX_TYPE_HIGHEST_PRODUCT_TAX = 1;
const SHIPPING_TAX_TYPE_HIGHEST_PRODUCT_PRICE_AMOUNT = 2;
public const SHIPPING_TAX_TYPE_DEFAULT = 0;

public const SHIPPING_TAX_TYPE_HIGHEST_PRODUCT_TAX = 1;

public const SHIPPING_TAX_TYPE_HIGHEST_PRODUCT_PRICE_AMOUNT = 2;
}
6 changes: 3 additions & 3 deletions Model/System/Config/Source/Tax/Dynamic.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ class Dynamic implements \Magento\Framework\Option\ArrayInterface
/**
* @var array
*/
protected $options;
protected array $options = [];

/**
* Option Dynamic Shipping Tax
*
* @return array
*/
public function toOptionArray()
public function toOptionArray(): array
{
if (!$this->options) {
$options = [
[
'value' => Config::SHIPPING_TAX_TYPE_DEFAULT,
'label' => __('No dynamic shipping tax caluclation')
'label' => __('No dynamic shipping tax calculation')
],
[
'value' => Config::SHIPPING_TAX_TYPE_HIGHEST_PRODUCT_TAX,
Expand Down
234 changes: 0 additions & 234 deletions Plugin/Tax/Config/AroundGetShippingTaxClassPlugin.php

This file was deleted.

Loading

0 comments on commit 37f021b

Please sign in to comment.