[#56] 예약 & 결제 프로세스 및 패키지 구조 재정의 #57

Merged
pricelees merged 45 commits from refactor/#56 into main 2025-10-09 09:33:29 +00:00
2 changed files with 13 additions and 7 deletions
Showing only changes of commit 0a7bd85dc9 - Show all commits

View File

@ -31,12 +31,10 @@ class IncompletedReservationSchedulerTest(
init {
test("예약이 없고, hold_expired_at 시간이 지난 ${ScheduleStatus.HOLD} 일정을 ${ScheduleStatus.AVAILABLE} 상태로 바꾼다.") {
val schedule: ScheduleEntity = dummyInitializer.createSchedule().apply {
this.status = ScheduleStatus.HOLD
this.holdExpiredAt = Instant.now().minusSeconds(1)
}.also {
scheduleRepository.saveAndFlush(it)
}
val schedule: ScheduleEntity = dummyInitializer.createSchedule(
status = ScheduleStatus.HOLD,
isHoldExpired = true
)
transactionExecutionUtil.withNewTransaction(isReadOnly = false) {
incompletedReservationScheduler.processExpiredHoldSchedule()

View File

@ -76,7 +76,8 @@ class DummyInitializer(
fun createSchedule(
storeId: Long = IDGenerator.create(),
request: ScheduleCreateRequest = ScheduleFixture.createRequest,
status: ScheduleStatus = ScheduleStatus.AVAILABLE
status: ScheduleStatus = ScheduleStatus.AVAILABLE,
isHoldExpired: Boolean = false
): ScheduleEntity {
val themeId: Long = if (themeRepository.existsById(request.themeId)) {
request.themeId
@ -94,6 +95,13 @@ class DummyInitializer(
date = request.date, time = request.time, storeId = storeId, themeId = themeId,
).apply {
this.status = status
if (status == ScheduleStatus.HOLD) {
if (isHoldExpired) {
this.holdExpiredAt = Instant.now().minusSeconds(1 * 60)
} else {
this.holdExpiredAt = Instant.now().plusSeconds(1 * 60)
}
}
}
return scheduleRepository.save(schedule)