Skip to content

Commit

Permalink
Merge pull request #24 from lotteon2/fix/develop
Browse files Browse the repository at this point in the history
🐛 Feign 통신 반환 타입 List->Map으로 수정
  • Loading branch information
qwerty1434 authored Jan 19, 2024
2 parents 5a74237 + c23aaa2 commit a08ef77
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import bloomingblooms.response.CommonResponse;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import kr.bb.payment.dto.request.KakaopayCancelRequestDto;
import kr.bb.payment.service.KakaopayService;
import kr.bb.payment.service.PaymentService;
Expand Down Expand Up @@ -41,7 +42,7 @@ public CommonResponse<LocalDateTime> payApprove(
}

@PostMapping("/paymentInfo")
CommonResponse<List<PaymentInfoDto>> getPaymentInfo(@RequestBody List<String> orderGroupIds){
CommonResponse<Map<String, PaymentInfoDto>> getPaymentInfo(@RequestBody List<String> orderGroupIds){
return CommonResponse.success(paymentService.getPaymentInfo(orderGroupIds));
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/kr/bb/payment/service/PaymentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void saveDeliveryIds(Map<Long, Long> oldDeliveryIdsMap, List<Long> newDel
}

@Transactional
public List<PaymentInfoDto> getPaymentInfo(List<String> orderGroupIds) {
public Map<String, PaymentInfoDto> getPaymentInfo(List<String> orderGroupIds) {
List<Payment> allPaymentsByOrderIds = paymentRepository.findAllByOrderIds(orderGroupIds);
return allPaymentsByOrderIds.stream()
.map(
Expand All @@ -93,7 +93,7 @@ public List<PaymentInfoDto> getPaymentInfo(List<String> orderGroupIds) {
.createdAt(payment.getCreatedAt())
.build();
})
.collect(Collectors.toList());
.collect(Collectors.toMap(PaymentInfoDto::getOrderGroupId, dto -> dto));
}

@Transactional
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/kr/bb/payment/service/PaymentServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import bloomingblooms.domain.payment.PaymentInfoDto;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
Expand All @@ -15,7 +16,7 @@ public class PaymentServiceTest {
@Autowired private PaymentService paymentService;
@Test
void getPaymentInfoTest(){
List<PaymentInfoDto> paymentInfo = paymentService.getPaymentInfo(List.of("임시주문번호"));
Map<String, PaymentInfoDto> paymentInfo = paymentService.getPaymentInfo(List.of("임시주문번호"));
assertThat(paymentInfo.size()).isEqualTo(0);
}

Expand Down

0 comments on commit a08ef77

Please sign in to comment.