fix: [card] CSV(CVC) 복호화 값을 API 응답에 포함

- $appends에 csv 추가, getCsvAttribute accessor 생성
- cvc_encrypted는 $hidden 유지 (암호문 노출 방지)
This commit is contained in:
김보곤
2026-02-21 00:56:50 +09:00
parent 03e3e84066
commit 295f7b7ee9

View File

@@ -73,6 +73,10 @@ class Card extends Model
'cvc_encrypted',
];
protected $appends = [
'csv',
];
protected $attributes = [
'status' => 'active',
'is_manual' => false,
@@ -178,6 +182,18 @@ public function getDecryptedCvc(): ?string
: null;
}
// =========================================================================
// Accessor (JSON 직렬화용)
// =========================================================================
/**
* CSV(CVC) 복호화 값 — $appends로 JSON 응답에 포함
*/
public function getCsvAttribute(): ?string
{
return $this->getDecryptedCvc();
}
// =========================================================================
// 헬퍼 메서드
// =========================================================================