Add Payment-Service

This commit is contained in:
Ali CANLI
2022-07-13 14:59:27 +03:00
parent ef9c18bfbd
commit bed8d4d858
33 changed files with 757 additions and 226 deletions

View File

@@ -2,7 +2,6 @@ package com.food.order.system.payment.data.access.credithistory.adapter;
import com.food.order.system.payment.application.service.ports.output.repository.CreditHistoryRepository;
import com.food.order.system.payment.data.access.credithistory.entity.CreditHistoryEntity;
import com.food.order.system.payment.data.access.credithistory.mapper.CreditHistoryDataAccessMapper;
import com.food.order.system.payment.data.access.credithistory.repository.CreditHistoryJpaRepository;
import com.food.order.system.payment.service.domain.entity.CreditHistory;
@@ -11,7 +10,6 @@ import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Component
public class CreditHistoryRepositoryImpl implements CreditHistoryRepository {
@@ -33,12 +31,11 @@ public class CreditHistoryRepositoryImpl implements CreditHistoryRepository {
@Override
public Optional<List<CreditHistory>> findByCustomerId(CustomerId customerId) {
Optional<List<CreditHistoryEntity>> creditHistory =
creditHistoryJpaRepository.findByCustomerId(customerId.getValue());
return creditHistory
return creditHistoryJpaRepository.findByCustomerId(customerId.getValue())
.map(creditHistoryList ->
creditHistoryList.stream()
.map(creditHistoryDataAccessMapper::creditHistoryEntityToCreditHistory)
.collect(Collectors.toList()));
.toList());
}
}