feat:서명 완료 시 계약서 이메일 발송 및 감사 로그 추가

- EsignCompletedMail Mailable 생성 (완료 알림 + PDF 다운로드 링크)
- completed.blade.php 이메일 뷰 템플릿 생성 (초록색 테마)
- submitSignature에 contract_completed 감사 로그 추가
- 모든 서명자에게 완료 이메일 발송 + completion_email_sent 감사 로그
- 이메일 발송 실패 시 try-catch로 계약 완료 보호

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-13 06:25:01 +09:00
parent f050be52fe
commit 8f7a441900
3 changed files with 176 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Mail;
use App\Models\ESign\EsignContract;
use App\Models\ESign\EsignSigner;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
class EsignCompletedMail extends Mailable
{
use Queueable, SerializesModels;
public function __construct(
public EsignContract $contract,
public EsignSigner $signer,
public Collection $allSigners,
) {}
public function envelope(): Envelope
{
return new Envelope(
subject: "[SAM] 전자계약 서명 완료 - {$this->contract->title}",
);
}
public function content(): Content
{
$downloadUrl = config('app.url') . '/esign/sign/' . $this->signer->access_token . '/api/document';
return new Content(
html: 'emails.esign.completed',
with: [
'contractTitle' => $this->contract->title,
'signerName' => $this->signer->name,
'completedAt' => $this->contract->completed_at?->format('Y-m-d H:i'),
'allSigners' => $this->allSigners,
'downloadUrl' => $downloadUrl,
],
);
}
}