Skip to content

Commit

Permalink
Merge pull request #227 from Yanol-Market/feature/225-chat-message-of…
Browse files Browse the repository at this point in the history
…-time-out

feat: 시간초과 관련 재결제 시스템 메세지 생성
  • Loading branch information
dldmldlsy authored Jan 25, 2024
2 parents 7034d21 + 6303005 commit 27e4baf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ private String createNegoStartMessage(Product product) {
+ "원에 팝니다. 가격 협의 가능합니다.";
}

/***
* 시간초과 관련 시스템 메세지 생성
* @param productId 상품 ID
* @param sellerId 판매자 ID
* @param buyerId 구매자 ID
*/
public void createSystemMessageOfTimeOut(Long productId, Long sellerId, Long buyerId) {
ChatRoom chatRoom = getChatRoomByBuyerIdAndProductId(buyerId, productId);
createChat(new ChatRequest(chatRoom.getId(), "SYSTEM", sellerId,
"구매자가 20분 이내에 결제를 완료하지 않아 거래가 이루어지지 않았습니다."));
createChat(new ChatRequest(chatRoom.getId(), "SYSTEM", buyerId,
"20분이 초과되었습니다. 아직 구매를 원하신다면 재결제 버튼을 눌러 결제해주세요."));
}

/***
* 채팅방 ID를 통한 채팅방 조회
* @param chatRoomId 채팅방 ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import site.goldenticket.common.exception.CustomException;
import site.goldenticket.common.response.ErrorCode;
import site.goldenticket.domain.alert.service.AlertService;
import site.goldenticket.domain.chat.service.ChatService;
import site.goldenticket.domain.nego.entity.Nego;
import site.goldenticket.domain.nego.repository.NegoRepository;
import site.goldenticket.domain.payment.model.Order;
Expand All @@ -31,6 +32,7 @@ public class NegoSchedulerService {
private final NegoRepository negoRepository;
private final ProductService productService;
private final AlertService alertService;
private final ChatService chatService;
private final UserRepository userRepository;
private final OrderRepository orderRepository;

Expand Down Expand Up @@ -62,6 +64,9 @@ public void changeStatus() {
alertService.createAlertOfWishProductToSelling(product.getId(),
product.getAccommodationName(), product.getRoomName());
}
//타임오버 관련 시스템 메세지 전송
chatService.createSystemMessageOfTimeOut(product.getId(), product.getUserId(),
nego.getUser().getId());
}
} //상품 상태 판매중

Expand Down

0 comments on commit 27e4baf

Please sign in to comment.