Skip to content

Commit

Permalink
Api-v1.0.2-5
Browse files Browse the repository at this point in the history
Api-v1.0.2-5
  • Loading branch information
ImNM authored Mar 13, 2023
2 parents 40ee07e + f961975 commit a6d040f
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public NcpHelper(
}

// 주문 취소 알림톡 (아이템리스트+버튼)
public void sendItemButtonNcpAlimTalk(
public void sendCancelOrderAlimTalk(
String to,
String templateCode,
String content,
Expand All @@ -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);
}
Expand All @@ -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,
Expand All @@ -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);
}

// 주문서 전송 알림톡 (아이템리스트)
Expand Down Expand Up @@ -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<MessageDto.AlimTalkButton> alimTalkButtons = makeWithdrawButtons();
List<MessageDto.AlimTalkButton> alimTalkButtons = makeDoneOrderButtons();

MessageDto.AlimTalkItemButtonMessage alimTalkItemButtonMessage =
MessageDto.AlimTalkItemButtonMessage.builder()
.to(to)
.content(content)
.headerContent(headerContent)
.item(alimTalkItem)
.buttons(alimTalkButtons)
.build();

List<MessageDto.AlimTalkItemButtonMessage> 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<MessageDto.AlimTalkButton> alimTalkButtons = makeCancelOrderButtons();

MessageDto.AlimTalkItemButtonMessage alimTalkItemButtonMessage =
MessageDto.AlimTalkItemButtonMessage.builder()
Expand Down Expand Up @@ -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<MessageDto.AlimTalkButton> makeSignUpButtons() {
MessageDto.AlimTalkButton alimTalkButton1 = makeAddChannelButton();
MessageDto.AlimTalkButton alimTalkButton2 = makeHomePageButton();
Expand All @@ -291,7 +329,14 @@ public List<MessageDto.AlimTalkButton> makeSignUpButtons() {
return alimTalkButtons;
}

public List<MessageDto.AlimTalkButton> makeWithdrawButtons() {
public List<MessageDto.AlimTalkButton> makeDoneOrderButtons() {
MessageDto.AlimTalkButton alimTalkButton = makeMyPageButton();
List<MessageDto.AlimTalkButton> alimTalkButtons = new ArrayList<>();
alimTalkButtons.add(alimTalkButton);
return alimTalkButtons;
}

public List<MessageDto.AlimTalkButton> makeCancelOrderButtons() {
MessageDto.AlimTalkButton alimTalkButton = makeHomePageButton();
List<MessageDto.AlimTalkButton> alimTalkButtons = new ArrayList<>();
alimTalkButtons.add(alimTalkButton);
Expand Down

0 comments on commit a6d040f

Please sign in to comment.