refactor:E-Sign 외부 API 호출을 MNG 내부 라우트로 전환
- Finance 패턴과 동일하게 MNG 직접 DB 접근 방식으로 변경
- MNG 모델 4개 추가: EsignContract, EsignSigner, EsignSignField, EsignAuditLog
- EsignApiController 추가: stats, index, show, store, cancel, configureFields, send, download
- 모든 뷰(dashboard, create, detail, fields, send)에서 외부 API URL 제거
- 기존 X-API-Key/Bearer 인증 대신 MNG 세션 인증(CSRF) 사용
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 10:24:09 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models\ESign;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
|
|
|
|
|
class EsignSigner extends Model
|
|
|
|
|
{
|
|
|
|
|
protected $table = 'esign_signers';
|
|
|
|
|
|
2026-02-26 23:15:17 +09:00
|
|
|
// 역할 상수
|
|
|
|
|
public const ROLE_CREATOR = 'creator';
|
|
|
|
|
|
|
|
|
|
public const ROLE_COUNTERPART = 'counterpart';
|
|
|
|
|
|
|
|
|
|
// 상태 상수
|
|
|
|
|
public const STATUS_WAITING = 'waiting';
|
|
|
|
|
|
|
|
|
|
public const STATUS_NOTIFIED = 'notified';
|
|
|
|
|
|
|
|
|
|
public const STATUS_AUTHENTICATED = 'authenticated';
|
|
|
|
|
|
|
|
|
|
public const STATUS_SIGNED = 'signed';
|
|
|
|
|
|
|
|
|
|
public const STATUS_REJECTED = 'rejected';
|
|
|
|
|
|
refactor:E-Sign 외부 API 호출을 MNG 내부 라우트로 전환
- Finance 패턴과 동일하게 MNG 직접 DB 접근 방식으로 변경
- MNG 모델 4개 추가: EsignContract, EsignSigner, EsignSignField, EsignAuditLog
- EsignApiController 추가: stats, index, show, store, cancel, configureFields, send, download
- 모든 뷰(dashboard, create, detail, fields, send)에서 외부 API URL 제거
- 기존 X-API-Key/Bearer 인증 대신 MNG 세션 인증(CSRF) 사용
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 10:24:09 +09:00
|
|
|
protected $fillable = [
|
|
|
|
|
'tenant_id',
|
|
|
|
|
'contract_id',
|
|
|
|
|
'role',
|
|
|
|
|
'sign_order',
|
|
|
|
|
'name',
|
|
|
|
|
'email',
|
|
|
|
|
'phone',
|
|
|
|
|
'access_token',
|
|
|
|
|
'token_expires_at',
|
|
|
|
|
'otp_code',
|
|
|
|
|
'otp_expires_at',
|
|
|
|
|
'otp_attempts',
|
|
|
|
|
'auth_verified_at',
|
|
|
|
|
'signature_image_path',
|
|
|
|
|
'signed_at',
|
|
|
|
|
'consent_agreed_at',
|
|
|
|
|
'sign_ip_address',
|
|
|
|
|
'sign_user_agent',
|
|
|
|
|
'status',
|
|
|
|
|
'rejected_reason',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'sign_order' => 'integer',
|
|
|
|
|
'otp_attempts' => 'integer',
|
|
|
|
|
'token_expires_at' => 'datetime',
|
|
|
|
|
'otp_expires_at' => 'datetime',
|
|
|
|
|
'auth_verified_at' => 'datetime',
|
|
|
|
|
'signed_at' => 'datetime',
|
|
|
|
|
'consent_agreed_at' => 'datetime',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
protected $hidden = [
|
|
|
|
|
'access_token',
|
|
|
|
|
'otp_code',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public function contract(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(EsignContract::class, 'contract_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function signFields(): HasMany
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(EsignSignField::class, 'signer_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function scopeForTenant($query, $tenantId)
|
|
|
|
|
{
|
|
|
|
|
return $query->where('tenant_id', $tenantId);
|
|
|
|
|
}
|
|
|
|
|
}
|