39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Sales\Domain\Contracts;
|
|
|
|
use App\Modules\Sales\Domain\Entities\QuickSale;
|
|
use App\Modules\Shared\Domain\ValueObjects\EmailAddress;
|
|
use DateTimeImmutable;
|
|
|
|
interface QuickSaleRepository
|
|
{
|
|
public function findById(int $id): ?QuickSale;
|
|
|
|
/**
|
|
* Inserts a new sale with its lines and returns the stored sale.
|
|
*/
|
|
public function add(QuickSale $sale): QuickSale;
|
|
|
|
public function isCredited(int $saleId): bool;
|
|
|
|
/**
|
|
* The cash day's sales, credits included.
|
|
*
|
|
* @return list<QuickSale>
|
|
*/
|
|
public function forDay(DateTimeImmutable $day): array;
|
|
|
|
/**
|
|
* Sets the address the receipt is emailed to and clears the earlier
|
|
* sending result, before the receipt is sent again.
|
|
*/
|
|
public function changeReceiptEmail(int $saleId, EmailAddress $email): void;
|
|
|
|
public function markReceiptSent(int $saleId, DateTimeImmutable $at): void;
|
|
|
|
public function markReceiptFailed(int $saleId, DateTimeImmutable $at): void;
|
|
}
|