feat(API): 입금/출금 알림 Observer 추가 및 LoanController 수정
- DepositIssueObserver, WithdrawalIssueObserver 신규 추가 - TodayIssueObserverService에 입금/출금 핸들러 및 디버그 로그 추가 - TodayIssue 모델에 입금/출금 상수 추가 - AppServiceProvider에 Observer 등록 - ApprovalService에 기존 결재선 사용 시 수동 알림 트리거 추가 - LoanController ApiResponse::handle() → ApiResponse::success() 수정 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
43
app/Observers/TodayIssue/DepositIssueObserver.php
Normal file
43
app/Observers/TodayIssue/DepositIssueObserver.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers\TodayIssue;
|
||||
|
||||
use App\Models\Tenants\Deposit;
|
||||
use App\Services\TodayIssueObserverService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Deposit 모델의 TodayIssue Observer
|
||||
*/
|
||||
class DepositIssueObserver
|
||||
{
|
||||
public function __construct(
|
||||
protected TodayIssueObserverService $service
|
||||
) {}
|
||||
|
||||
public function created(Deposit $deposit): void
|
||||
{
|
||||
Log::info('DepositIssueObserver::created CALLED', [
|
||||
'deposit_id' => $deposit->id,
|
||||
'tenant_id' => $deposit->tenant_id,
|
||||
]);
|
||||
|
||||
$this->safeExecute(fn () => $this->service->handleDepositCreated($deposit));
|
||||
}
|
||||
|
||||
public function deleted(Deposit $deposit): void
|
||||
{
|
||||
$this->safeExecute(fn () => $this->service->handleDepositDeleted($deposit));
|
||||
}
|
||||
|
||||
protected function safeExecute(callable $callback): void
|
||||
{
|
||||
try {
|
||||
$callback();
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('TodayIssue DepositObserver failed', [
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user