<?php

namespace traits;

use classes\stripe;
use Exception;
use Stripe\StripeClient;

trait stripe_endpoint_t
{
    /**
     * Stripe
     * @var stripe $stripe
     */
    protected stripe $stripe;

    /**
     * Get the Stripe client
     * @return StripeClient
     * @throws Exception
     */
    public function getClient(): StripeClient
    {
        return $this->Stripe()->getClient();
    }

    /**
     * Get the stripe class
     * @return stripe
     */
    public function Stripe(): stripe
    {
        if (!isset($this->stripe)) {
            $this->stripe = new stripe();
        }
        return $this->stripe;
    }
}