diff --git a/DuDoong-Api/src/main/java/band/gosrock/api/alimTalk/service/SendDoneOrderAlimTalkService.java b/DuDoong-Api/src/main/java/band/gosrock/api/alimTalk/service/SendDoneOrderAlimTalkService.java index 52726001..5fcb89c3 100644 --- a/DuDoong-Api/src/main/java/band/gosrock/api/alimTalk/service/SendDoneOrderAlimTalkService.java +++ b/DuDoong-Api/src/main/java/band/gosrock/api/alimTalk/service/SendDoneOrderAlimTalkService.java @@ -25,7 +25,7 @@ public void execute(OrderAlimTalkDto orderAlimTalkDto) { userInfo.getUserName(), eventInfo.getHostName(), eventInfo.getEventName()); String headerContent = OrderKakaoTalkAlarm.creationHeaderOf(); - ncpHelper.sendItemNcpAlimTalk( + ncpHelper.sendDoneOrderAlimTalk( userInfo.getPhoneNum(), OrderKakaoTalkAlarm.creationTemplateCode(), content, diff --git a/DuDoong-Api/src/main/java/band/gosrock/api/alimTalk/service/SendWithdrawOrderAlimTalkService.java b/DuDoong-Api/src/main/java/band/gosrock/api/alimTalk/service/SendWithdrawOrderAlimTalkService.java index b8a01c48..57f6faf2 100644 --- a/DuDoong-Api/src/main/java/band/gosrock/api/alimTalk/service/SendWithdrawOrderAlimTalkService.java +++ b/DuDoong-Api/src/main/java/band/gosrock/api/alimTalk/service/SendWithdrawOrderAlimTalkService.java @@ -25,7 +25,7 @@ public void execute(OrderAlimTalkDto orderAlimTalkDto) { userInfo.getUserName(), eventInfo.getHostName(), eventInfo.getEventName()); String headerContent = OrderKakaoTalkAlarm.deletionHeaderOf(); - ncpHelper.sendItemButtonNcpAlimTalk( + ncpHelper.sendCancelOrderAlimTalk( userInfo.getPhoneNum(), OrderKakaoTalkAlarm.deletionTemplateCode(), content, diff --git a/DuDoong-Domain/src/main/java/band/gosrock/domain/common/alarm/OrderKakaoTalkAlarm.java b/DuDoong-Domain/src/main/java/band/gosrock/domain/common/alarm/OrderKakaoTalkAlarm.java index 9a3905de..5a5641ab 100644 --- a/DuDoong-Domain/src/main/java/band/gosrock/domain/common/alarm/OrderKakaoTalkAlarm.java +++ b/DuDoong-Domain/src/main/java/band/gosrock/domain/common/alarm/OrderKakaoTalkAlarm.java @@ -25,7 +25,7 @@ public static String creationHeaderOf() { } public static String creationTemplateCode() { - return "doneorder"; + return "doneorderv2"; } public static String deletionOf(String userName, String hostName, String eventName) { diff --git a/DuDoong-Infrastructure/src/main/java/band/gosrock/infrastructure/config/alilmTalk/NcpHelper.java b/DuDoong-Infrastructure/src/main/java/band/gosrock/infrastructure/config/alilmTalk/NcpHelper.java index 183497f6..a7715e5f 100644 --- a/DuDoong-Infrastructure/src/main/java/band/gosrock/infrastructure/config/alilmTalk/NcpHelper.java +++ b/DuDoong-Infrastructure/src/main/java/band/gosrock/infrastructure/config/alilmTalk/NcpHelper.java @@ -45,7 +45,7 @@ public NcpHelper( } // 주문 취소 알림톡 (아이템리스트+버튼) - public void sendItemButtonNcpAlimTalk( + public void sendCancelOrderAlimTalk( String to, String templateCode, String content, @@ -64,7 +64,7 @@ public void sendItemButtonNcpAlimTalk( ncpAccessKey, ncpSecretKey, alimTalkSignatureRequestUrl, timeStamp); // 바디 생성 MessageDto.AlimTalkItemButtonBody alimTalkItemButtonBody = - makeItemButtonBody(templateCode, to, content, headerContent, orderInfo); + makeCancelOrderBody(templateCode, to, content, headerContent, orderInfo); ncpClient.sendItemButtonAlimTalk( serviceID, ncpAccessKey, timeStamp, signature, alimTalkItemButtonBody); } @@ -87,8 +87,8 @@ public void sendButtonNcpAlimTalk(String to, String templateCode, String content ncpClient.sendButtonAlimTalk(serviceID, ncpAccessKey, timeStamp, signature, body); } - // 주문 성공 알림톡 (아이템리스트) - public void sendItemNcpAlimTalk( + // 주문 성공 알림톡 (아이템리스트+버튼) + public void sendDoneOrderAlimTalk( String to, String templateCode, String content, @@ -106,9 +106,10 @@ public void sendItemNcpAlimTalk( makePostSignature( ncpAccessKey, ncpSecretKey, alimTalkSignatureRequestUrl, timeStamp); // 바디 생성 - MessageDto.AlimTalkItemBody alimTalkItemBody = - makeItemBody(templateCode, to, content, headerContent, orderInfo); - ncpClient.sendItemAlimTalk(serviceID, ncpAccessKey, timeStamp, signature, alimTalkItemBody); + MessageDto.AlimTalkItemButtonBody alimTalkItemButtonBody = + makeDoneOrderBody(templateCode, to, content, headerContent, orderInfo); + ncpClient.sendItemButtonAlimTalk( + serviceID, ncpAccessKey, timeStamp, signature, alimTalkItemButtonBody); } // 주문서 전송 알림톡 (아이템리스트) @@ -136,14 +137,42 @@ public void sendSettlementNcpAlimTalk( ncpClient.sendItemAlimTalk(serviceID, ncpAccessKey, timeStamp, signature, alimTalkItemBody); } - public MessageDto.AlimTalkItemButtonBody makeItemButtonBody( + public MessageDto.AlimTalkItemButtonBody makeDoneOrderBody( String templateCode, String to, String content, String headerContent, AlimTalkOrderInfo orderInfo) { MessageDto.AlimTalkItem alimTalkItem = makeOrderItem(orderInfo); - List alimTalkButtons = makeWithdrawButtons(); + List alimTalkButtons = makeDoneOrderButtons(); + + MessageDto.AlimTalkItemButtonMessage alimTalkItemButtonMessage = + MessageDto.AlimTalkItemButtonMessage.builder() + .to(to) + .content(content) + .headerContent(headerContent) + .item(alimTalkItem) + .buttons(alimTalkButtons) + .build(); + + List alimTalkItemButtonMessages = new ArrayList<>(); + alimTalkItemButtonMessages.add(alimTalkItemButtonMessage); + + return MessageDto.AlimTalkItemButtonBody.builder() + .plusFriendId(plusFriendId) + .templateCode(templateCode) + .messages(alimTalkItemButtonMessages) + .build(); + } + + public MessageDto.AlimTalkItemButtonBody makeCancelOrderBody( + String templateCode, + String to, + String content, + String headerContent, + AlimTalkOrderInfo orderInfo) { + MessageDto.AlimTalkItem alimTalkItem = makeOrderItem(orderInfo); + List alimTalkButtons = makeCancelOrderButtons(); MessageDto.AlimTalkItemButtonMessage alimTalkItemButtonMessage = MessageDto.AlimTalkItemButtonMessage.builder() @@ -282,6 +311,15 @@ public MessageDto.AlimTalkButton makeAddChannelButton() { return MessageDto.AlimTalkButton.builder().type("AC").name("채널 추가").build(); } + public MessageDto.AlimTalkButton makeMyPageButton() { + return MessageDto.AlimTalkButton.builder() + .type("WL") + .name("마이페이지 바로가기") + .linkMobile("https://dudoong.com/mypage") + .linkPc("https://dudoong.com/mypage") + .build(); + } + public List makeSignUpButtons() { MessageDto.AlimTalkButton alimTalkButton1 = makeAddChannelButton(); MessageDto.AlimTalkButton alimTalkButton2 = makeHomePageButton(); @@ -291,7 +329,14 @@ public List makeSignUpButtons() { return alimTalkButtons; } - public List makeWithdrawButtons() { + public List makeDoneOrderButtons() { + MessageDto.AlimTalkButton alimTalkButton = makeMyPageButton(); + List alimTalkButtons = new ArrayList<>(); + alimTalkButtons.add(alimTalkButton); + return alimTalkButtons; + } + + public List makeCancelOrderButtons() { MessageDto.AlimTalkButton alimTalkButton = makeHomePageButton(); List alimTalkButtons = new ArrayList<>(); alimTalkButtons.add(alimTalkButton);