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/vendor/paypal/module-braintree-core/Gateway/Request/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/vendor/paypal/module-braintree-core/Gateway/Request/FraudDataBuilder.php
<?php
declare(strict_types=1);

namespace PayPal\Braintree\Gateway\Request;

use Magento\Framework\App\Area;
use Magento\Framework\App\State;
use Magento\Framework\Exception\LocalizedException;
use Magento\Payment\Gateway\Request\BuilderInterface;
use PayPal\Braintree\Gateway\Config\Config;
use PayPal\Braintree\Gateway\Helper\SubjectReader;
use Magento\Payment\Helper\Formatter;

/**
 * Add logical checks to enable/disable fraud checks.
 */
class FraudDataBuilder implements BuilderInterface
{
    use Formatter;

    const SKIP_ADVANCED_FRAUD_CHECKING = 'skipAdvancedFraudChecking';

    /**
     * @var Config $config
     */
    private $config;

    /**
     * @var SubjectReader $subjectReader
     */
    private $subjectReader;
    /**
     * @var State
     */
    private $state;

    /**
     * FraudDataBuilder constructor.
     *
     * @param Config $config
     * @param SubjectReader $subjectReader
     * @param State $state
     */
    public function __construct(
        Config $config,
        SubjectReader $subjectReader,
        State $state
    ) {
        $this->config = $config;
        $this->subjectReader = $subjectReader;
        $this->state = $state;
    }

    /**
     * @inheritdoc
     * @throws LocalizedException
     */
    public function build(array $buildSubject): array
    {
        $threshold = $this->config->getFraudProtectionThreshold();
        $amount = $this->formatPrice($this->subjectReader->readAmount($buildSubject));

        if (($threshold && $amount >= $threshold) ||
            ($this->state->getAreaCode() === Area::AREA_ADMINHTML && $this->config->canSkipAdminFraudProtection())
        ) {
            return [
                'options' => [self::SKIP_ADVANCED_FRAUD_CHECKING => true]
            ];
        }

        return [
            'options' => [self::SKIP_ADVANCED_FRAUD_CHECKING => false]
        ];
    }
}

Spamworldpro Mini