Email quick sale receipts and send them again from the sales list
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -11,6 +11,8 @@ use App\Modules\Sales\Domain\ValueObjects\VatTotal;
|
||||
* A quick sale as listed: amounts with VAT, negative on a credit.
|
||||
* $soldAt is "Y-m-d H:i" in the company's time zone. $creditsSaleId is set
|
||||
* on a credit, $creditedBySaleId on a sale that has been credited.
|
||||
* $receiptEmail is the address the receipt was emailed to; it is shown
|
||||
* only on the sales list, never in reports.
|
||||
*/
|
||||
final readonly class QuickSaleSummary
|
||||
{
|
||||
@@ -28,8 +30,25 @@ final readonly class QuickSaleSummary
|
||||
public array $lines,
|
||||
public ?int $creditsSaleId,
|
||||
public ?int $creditedBySaleId,
|
||||
public ?string $receiptEmail = null,
|
||||
public ?string $receiptSentAt = null,
|
||||
public bool $receiptFailed = false,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* The emailed receipt's state: null without an address, otherwise
|
||||
* 'sent', 'failed' or 'pending' (still in the queue).
|
||||
*/
|
||||
public function receiptStatus(): ?string
|
||||
{
|
||||
return match (true) {
|
||||
$this->receiptEmail === null => null,
|
||||
$this->receiptFailed => 'failed',
|
||||
$this->receiptSentAt !== null => 'sent',
|
||||
default => 'pending',
|
||||
};
|
||||
}
|
||||
|
||||
public function isCredit(): bool
|
||||
{
|
||||
return $this->creditsSaleId !== null;
|
||||
|
||||
Reference in New Issue
Block a user