Skip to content

Commit

Permalink
chore: temporary type casting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kang1221 committed Aug 19, 2024
1 parent 9989f39 commit ad4780b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Getter
@Builder
public class CreatePaymentResponseDto {
private Long paymentId;
private String paymentId;
private PayStatus payStatus;
private LocalDateTime startedAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

@Getter
public class UpdatePaymentRequestDto {
private Long paymentId;
private String paymentId;
private PayStatus payStatus;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Getter
@Builder
public class UpdatePaymentResponseDto {
private Long paymentId;
private String paymentId;
private PayStatus payStatus;
private LocalDateTime endedAt;
}
14 changes: 9 additions & 5 deletions src/main/java/co/orange/ddanzi/service/PaymentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ public ApiResponse<?> startPayment(CreatePaymentRequestDto requestDto){
product.updateStock(product.getStock() - 1);
log.info("Update stock of product, product_id: {}", product.getId());

///////////////////////////////////////////////////////////////////////////////////////////
// 형변환 해놨음 다시 수정필요
CreatePaymentResponseDto responseDto = CreatePaymentResponseDto.builder()
.paymentId(payment.getId())
.paymentId(payment.getId().toString())
.payStatus(payment.getPayStatus())
.startedAt(payment.getStartedAt())
.build();
Expand All @@ -61,8 +63,9 @@ public ApiResponse<?> startPayment(CreatePaymentRequestDto requestDto){

@Transactional
public ApiResponse<?> endPayment(UpdatePaymentRequestDto requestDto){

Payment payment = paymentRepository.findById(requestDto.getPaymentId()).orElseThrow(()-> new PaymentNotFoundException());
///////////////////////////////////////////////////////////////////////////////////////////
// 형변환 해놨음 다시 수정필요
Payment payment = paymentRepository.findById(Long.parseLong(requestDto.getPaymentId())).orElseThrow(()-> new PaymentNotFoundException());
Item item = payment.getItem();
Product product = item.getProduct();

Expand All @@ -79,9 +82,10 @@ public ApiResponse<?> endPayment(UpdatePaymentRequestDto requestDto){
product.updateStock(product.getStock() + 1);
}


///////////////////////////////////////////////////////////////////////////////////////////
// 형변환 해놨음 다시 수정필요
UpdatePaymentResponseDto responseDto = UpdatePaymentResponseDto.builder()
.paymentId(payment.getId())
.paymentId(payment.getId().toString())
.payStatus(payment.getPayStatus())
.endedAt(payment.getEndedAt())
.build();
Expand Down

0 comments on commit ad4780b

Please sign in to comment.