<?php

declare(strict_types=1);

namespace App\Actions\Merchant;

use App\Models\Merchant;
use Generator;

final class GetAmountOfTransactionsPerPaymentMethodAction
{
    public function handle(Merchant $merchant): Generator
    {
        foreach ($merchant->transactions()->where('invoiced', '=', false)->get()->groupBy('payment_method_id') as $key => $transactions) {
            yield $key => $transactions;
        }
    }
}
