fix: [barobill] 알림톡 발송 파라미터 구조 전면 수정
- SenderID: 바로빌 계정 ID (barobill_id) 사용 - YellowId: 카카오톡 채널 ID 필수 전달 (기존에 빈값) - SmsReply: 'N' (대체문자 미발송) 또는 'S' (발송) 명시 - 템플릿 본문: API에서 조회 후 변수 치환 (정확한 포맷 유지) - getKakaotalkSenderId → getKakaotalkChannelId 이름 변경 - EsignPublicController: 잘못된 필드명(corp_num, is_test_mode) 수정
This commit is contained in:
@@ -387,17 +387,51 @@ public function submitSignature(Request $request, string $token): JsonResponse
|
||||
$member = BarobillMember::where('tenant_id', $contract->tenant_id)->first();
|
||||
if ($member) {
|
||||
$barobill = app(BarobillService::class);
|
||||
$barobill->setServerMode($member->is_test_mode ? 'test' : 'production');
|
||||
$barobill->setServerMode($member->server_mode ?? 'production');
|
||||
$nextSignUrl = config('app.url').'/esign/sign/'.$nextSigner->access_token;
|
||||
$nextExpires = $contract->expires_at?->format('Y-m-d H:i') ?? '없음';
|
||||
|
||||
// 채널 ID 조회
|
||||
$channelResult = $barobill->getKakaotalkChannels($member->biz_no);
|
||||
$yellowId = '';
|
||||
if ($channelResult['success'] ?? false) {
|
||||
$chData = $channelResult['data'];
|
||||
if (is_object($chData) && isset($chData->KakaotalkChannel)) {
|
||||
$ch = is_array($chData->KakaotalkChannel) ? $chData->KakaotalkChannel[0] : $chData->KakaotalkChannel;
|
||||
$yellowId = $ch->ChannelId ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
// 템플릿 본문 조회하여 변수 치환
|
||||
$tplResult = $barobill->getKakaotalkTemplates($member->biz_no, $yellowId);
|
||||
$tplMessage = null;
|
||||
if ($tplResult['success'] ?? false) {
|
||||
$tplData = $tplResult['data'];
|
||||
$tplItems = [];
|
||||
if (is_object($tplData) && isset($tplData->KakaotalkTemplate)) {
|
||||
$tplItems = is_array($tplData->KakaotalkTemplate) ? $tplData->KakaotalkTemplate : [$tplData->KakaotalkTemplate];
|
||||
}
|
||||
foreach ($tplItems as $t) {
|
||||
if (($t->TemplateName ?? '') === '전자계약_서명요청') {
|
||||
$tplMessage = str_replace(
|
||||
['#{이름}', '#{계약명}', '#{기한}'],
|
||||
[$nextSigner->name, $contract->title, $nextExpires],
|
||||
$t->TemplateContent
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$atResult = $barobill->sendATKakaotalkEx(
|
||||
corpNum: $member->corp_num,
|
||||
senderId: $member->kakaotalk_sender_id ?? '',
|
||||
corpNum: $member->biz_no,
|
||||
senderId: $member->barobill_id,
|
||||
yellowId: $yellowId,
|
||||
templateName: '전자계약_서명요청',
|
||||
receiverName: $nextSigner->name,
|
||||
receiverNum: preg_replace('/[^0-9]/', '', $nextSigner->phone),
|
||||
title: '전자계약 서명 요청',
|
||||
message: "안녕하세요, {$nextSigner->name}님.\n전자계약 서명 요청이 도착했습니다.\n\n■ 계약명: {$contract->title}\n■ 서명 기한: {$nextExpires}\n\n아래 버튼을 눌러 계약서를 확인하고 서명해 주세요.",
|
||||
title: '',
|
||||
message: $tplMessage ?? "안녕하세요, {$nextSigner->name}님.\n전자계약 서명 요청이 도착했습니다.\n\n■ 계약명: {$contract->title}\n■ 서명 기한: {$nextExpires}\n\n아래 버튼을 눌러 계약서를 확인하고 서명해 주세요.",
|
||||
buttons: [['Name' => '계약서 확인하기', 'ButtonType' => 'WL', 'Url1' => $nextSignUrl, 'Url2' => $nextSignUrl]],
|
||||
smsMessage: $nextSmsFallback ? "[SAM] {$nextSigner->name}님, 전자계약 서명 요청이 도착했습니다. {$nextSignUrl}" : '',
|
||||
);
|
||||
@@ -536,18 +570,30 @@ private function sendCompletionAlimtalk(EsignContract $contract, EsignSigner $si
|
||||
}
|
||||
|
||||
$barobill = app(BarobillService::class);
|
||||
$barobill->setServerMode($member->is_test_mode ? 'test' : 'production');
|
||||
$barobill->setServerMode($member->server_mode ?? 'production');
|
||||
|
||||
// 채널 ID 조회
|
||||
$channelResult = $barobill->getKakaotalkChannels($member->biz_no);
|
||||
$yellowId = '';
|
||||
if ($channelResult['success'] ?? false) {
|
||||
$chData = $channelResult['data'];
|
||||
if (is_object($chData) && isset($chData->KakaotalkChannel)) {
|
||||
$ch = is_array($chData->KakaotalkChannel) ? $chData->KakaotalkChannel[0] : $chData->KakaotalkChannel;
|
||||
$yellowId = $ch->ChannelId ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
$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');
|
||||
|
||||
$result = $barobill->sendATKakaotalkEx(
|
||||
corpNum: $member->corp_num,
|
||||
senderId: $member->kakaotalk_sender_id ?? '',
|
||||
corpNum: $member->biz_no,
|
||||
senderId: $member->barobill_id,
|
||||
yellowId: $yellowId,
|
||||
templateName: '전자계약_완료',
|
||||
receiverName: $signer->name,
|
||||
receiverNum: preg_replace('/[^0-9]/', '', $signer->phone),
|
||||
title: '전자계약 완료',
|
||||
title: '',
|
||||
message: "안녕하세요, {$signer->name}님.\n전자계약이 모든 서명자의 서명 완료로 확정되었습니다.\n\n■ 계약명: {$contract->title}\n■ 완료일: {$completedAt}\n\n아래 버튼에서 서명 완료된 계약서를 확인할 수 있습니다.",
|
||||
buttons: [
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user