-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix : 정산 완료 요청을 본인의 정산 요청에 대해서만 수행가능하도록 코드 수정
- Loading branch information
1 parent
b4a2863
commit 5fad8ec
Showing
3 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package space.space_spring.util.pay; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import space.space_spring.dao.PayDao; | ||
import space.space_spring.entity.PayRequest; | ||
import space.space_spring.entity.PayRequestTarget; | ||
import space.space_spring.exception.CustomException; | ||
|
||
import static space.space_spring.response.status.BaseExceptionResponseStatus.PAY_REQUEST_NOT_FOUND; | ||
import static space.space_spring.response.status.BaseExceptionResponseStatus.PAY_REQUEST_TARGET_NOT_FOUND; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class PayUtils { | ||
|
||
private final PayDao payDao; | ||
|
||
@Transactional | ||
public PayRequest findPayRequestById(Long id) { | ||
PayRequest payRequestById = payDao.findPayRequestById(id); | ||
if (payRequestById == null) { | ||
throw new CustomException(PAY_REQUEST_NOT_FOUND); | ||
} | ||
return payRequestById; | ||
} | ||
|
||
@Transactional | ||
public PayRequestTarget findPayRequestTargetById(Long id) { | ||
PayRequestTarget payRequestTargetById = payDao.findPayRequestTargetById(id); | ||
if (payRequestTargetById == null) { | ||
throw new CustomException(PAY_REQUEST_TARGET_NOT_FOUND); | ||
} | ||
return payRequestTargetById; | ||
} | ||
} |