Skip to content

Commit

Permalink
Merge pull request #214 from WE-ARE-RACCOONS/develop
Browse files Browse the repository at this point in the history
RAC-335 refactor : ๊ฒฐ์ œ ์Šฌ๋ž™ ๋ฉ”์‹œ์ง€ ๋‚ด์šฉ ๋ณ€๊ฒฝ
  • Loading branch information
ywj9811 authored Apr 5, 2024
2 parents 349a374 + b1cce4c commit ffd9b76
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.postgraduate.global.slack;

import com.postgraduate.domain.payment.domain.entity.Payment;
import com.postgraduate.domain.senior.domain.entity.Senior;
import com.postgraduate.domain.user.domain.entity.User;
import com.slack.api.Slack;
import com.slack.api.model.Attachment;
import com.slack.api.webhook.Payload;
Expand Down Expand Up @@ -40,6 +42,9 @@ public void sendPayment(Payment payment) {

private Attachment generatePaymentAttachment(Payment payment) {
LocalDateTime createdAt = payment.getPaidAt();
User user = payment.getUser();
Senior senior = payment.getSenior();
User seniorUser = senior.getUser();
return Attachment.builder()
.color("2FC4B2")
.title("๊ฒฐ์ œ์ •๋ณด")
Expand All @@ -49,7 +54,10 @@ private Attachment generatePaymentAttachment(Payment payment) {
+ createdAt.getDayOfMonth() + "์ผ "
+ createdAt.getHour() + "์‹œ "
+ createdAt.getMinute() + "๋ถ„ "
+ createdAt.getSecond() + "์ดˆ", null)
+ createdAt.getSecond() + "์ดˆ", null),
generateSlackField("๊ฒฐ์ œ ๊ธˆ์•ก : " + payment.getPay(), null),
generateSlackField("ํ›„๋ฐฐ ๋‹‰๋„ค์ž„ : " + user.getNickName() , null),
generateSlackField("์„ ๋ฐฐ ๋‹‰๋„ค์ž„ : " + seniorUser.getNickName(), null)
))
.build();
}
Expand Down

0 comments on commit ffd9b76

Please sign in to comment.