<?php

declare(strict_types=1);

if (!class_exists('TwistoPay')) {
    require_once 'class.TwistoPay.php';
}

class TwistoPayIn3 extends TwistoPay
{
    public static $name = 'Twisto Pay in three';

    public $class = 'TwistoPayIn3';

    protected ?string $defaultIcon = '../../common/static/payments/twisto_payin3.svg';

    protected function getCheckoutType(): string
    {
        return 'pay-in-three';
    }

    public function accept($totalPrice, $freeDelivery)
    {
        $price = $totalPrice->getPriceWithVat()->asFloat();
        if ($price <= 0 && $this->order) {
            $price = $this->order->total_price;
        }

        return parent::accept($totalPrice, $freeDelivery) && $price >= 1500;
    }
}
