feat: [esign] 알림톡 템플릿명 환경별 분기 (운영: 원본, 개발: _DEV)

- resolveTemplateName() 헬퍼 메서드 추가 (두 컨트롤러)
- production 환경: 전자계약_서명요청, 전자계약_완료, 전자계약_리마인드
- 개발 환경: 전자계약_서명요청_DEV, 전자계약_완료_DEV, 전자계약_리마인드_DEV
- config('app.url')은 이미 환경별 도메인 자동 사용
This commit is contained in:
김보곤
2026-02-27 08:15:54 +09:00
parent 8ec45c85ae
commit 6b5a20e857
2 changed files with 21 additions and 4 deletions

View File

@@ -1047,7 +1047,7 @@ private function sendAlimtalk(
$expires = $contract->expires_at?->format('Y-m-d H:i') ?? '없음';
if (! $templateName) {
$templateName = $isReminder ? '전자계약_리마인드' : '전자계약_서명요청';
$templateName = $this->resolveTemplateName($isReminder ? '전자계약_리마인드' : '전자계약_서명요청');
}
// 등록된 템플릿 본문 + 버튼 정보 조회 (정확한 포맷 유지)
@@ -1208,6 +1208,14 @@ private function getKakaotalkChannelId(BarobillService $barobill, string $bizNo)
*
* @return array{content: string|null, buttons: array}
*/
/**
* 환경별 알림톡 템플릿명 반환 (운영: 원본, 개발: _DEV 접미사)
*/
private function resolveTemplateName(string $baseName): string
{
return $baseName.(app()->environment('production') ? '' : '_DEV');
}
private function getTemplateData(BarobillService $barobill, string $bizNo, string $channelId, string $templateName): array
{
$empty = ['content' => null, 'buttons' => []];

View File

@@ -483,7 +483,8 @@ public function submitSignature(Request $request, string $token): JsonResponse
if ($channelId) {
// 템플릿 본문 + 버튼 조회
$tplData = $this->getTemplateData($barobill, $member->biz_no, $channelId, '전자계약_서명요청');
$nextTemplateName = $this->resolveTemplateName('전자계약_서명요청');
$tplData = $this->getTemplateData($barobill, $member->biz_no, $channelId, $nextTemplateName);
$tplMessage = $tplData['content']
? str_replace(
['#{이름}', '#{계약명}', '#{기한}'],
@@ -513,7 +514,7 @@ public function submitSignature(Request $request, string $token): JsonResponse
corpNum: $member->biz_no,
senderId: $member->barobill_id,
yellowId: $channelId,
templateName: '전자계약_서명요청',
templateName: $nextTemplateName,
receiverName: $nextSigner->name,
receiverNum: preg_replace('/[^0-9]/', '', $nextSigner->phone),
title: '',
@@ -753,7 +754,7 @@ private function sendCompletionAlimtalk(EsignContract $contract, EsignSigner $si
return ['success' => false, 'channel' => 'alimtalk', 'error' => '등록된 카카오톡 채널이 없습니다'];
}
$templateName = '전자계약_완료';
$templateName = $this->resolveTemplateName('전자계약_완료');
$documentUrl = config('app.url').'/esign/sign/'.$signer->access_token.'/api/document';
$signUrl = config('app.url').'/esign/sign/'.$signer->access_token;
$completedAt = $contract->completed_at?->format('Y-m-d H:i') ?? now()->format('Y-m-d H:i');
@@ -974,6 +975,14 @@ private function getTemplateData(BarobillService $barobill, string $bizNo, strin
return $empty;
}
/**
* 환경별 알림톡 템플릿명 반환 (운영: 원본, 개발: _DEV 접미사)
*/
private function resolveTemplateName(string $baseName): string
{
return $baseName.(app()->environment('production') ? '' : '_DEV');
}
private function findSigner(string $token): ?EsignSigner
{
$signer = EsignSigner::withoutGlobalScopes()