<?php

namespace App\Helpers\FirstParty\Stripe;

use App\Models\User;
use Laravel\Cashier\Events\WebhookReceived;

class StripeHelper
{
    public static function getUserByStripeID($customer_id)
    {
        return User::where('stripe_id', $customer_id)->first();
    }

    public static function getEventObject(WebhookReceived $event)
    {
        return $event->payload['data']['object'];
    }

    public static function getEventType(WebhookReceived $event)
    {
        return $event->payload['type'];
    }

    public static function setStripeApiKey()
    {
        \Stripe\Stripe::setApiKey(config('services.stripe.secret'));
    }
}
