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/cartforge.co/app/code/StripeIntegration/Tax/Helper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/cartforge.co/app/code/StripeIntegration/Tax/Helper/Creditmemo.php
<?php

namespace StripeIntegration\Tax\Helper;

class Creditmemo
{
    private $currencyHelper;

    public function __construct(
        Currency $currencyHelper
    )
    {
        $this->currencyHelper = $currencyHelper;
    }

    public function hasAdjustments($creditmemo)
    {
        if ($creditmemo->getAdjustmentPositive() != 0 || $creditmemo->getAdjustmentNegative() != 0) {
            return true;
        }

        return false;
    }

    public function hasShippingToRevert($creditmemo)
    {
        return $creditmemo->getShippingAmount() > 0 && $creditmemo->getShippingTaxAmount() > 0;
    }

    /**
     * Adds the amount which will be in the revert request.
     * This will help to stop looping through invoices or other items if the amount to be reverted reaches the
     * credit memo grand total.
     *
     * @param $creditmemo
     * @param $amount
     * @param $taxAmount
     * @param $taxExclusive
     * @return void
     */
    public function updateAmountToRevert($creditmemo, $amount, $taxAmount, $taxExclusive = true)
    {
        $creditmemo->setAmountToRevert(
            $creditmemo->getAmountToRevert() + $this->currencyHelper->stripeAmountToMagentoAmount(abs($amount), $creditmemo->getOrderCurrencyCode())
        );
        if ($taxExclusive) {
            $creditmemo->setAmountToRevert(
                $creditmemo->getAmountToRevert() + $this->currencyHelper->stripeAmountToMagentoAmount(abs($taxAmount), $creditmemo->getOrderCurrencyCode())
            );
        }
    }
}

Spamworldpro Mini