fapi-cz/php-client

View on GitHub
src/Fapi/FapiClient/EndPoints/DiscountCodes.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php declare(strict_types = 1);

namespace Fapi\FapiClient\EndPoints;

use Fapi\FapiClient\EndPoints\Traits\Create;
use Fapi\FapiClient\EndPoints\Traits\Delete;
use Fapi\FapiClient\EndPoints\Traits\Find;
use Fapi\FapiClient\EndPoints\Traits\FindAll;
use Fapi\FapiClient\EndPoints\Traits\Update;
use Fapi\FapiClient\Rest\FapiRestClient;

final class DiscountCodes
{

    use FindAll;
    use Find;
    use Create;
    use Update;
    use Delete;

    public function __construct(FapiRestClient $client)
    {
        $this->client = $client;
        $this->path = '/discount-codes';
        $this->resources = 'discount_codes';
    }

    /**
     * @return array<mixed>
     */
    public function isValid(string $code, string $path): array
    {
        return $this->client->getSingularResource($this->path . '/is-valid', ['code' => $code, 'form' => $path]);
    }

}