-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathPaymentService.java
More file actions
32 lines (24 loc) · 1.03 KB
/
PaymentService.java
File metadata and controls
32 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.bravo.user.service;
import com.bravo.user.dao.model.Payment;
import com.bravo.user.dao.model.mapper.ResourceMapper;
import com.bravo.user.dao.repository.PaymentRepository;
import com.bravo.user.model.dto.PaymentDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PaymentService {
private static final Logger LOGGER = LoggerFactory.getLogger(PaymentService.class);
private final PaymentRepository paymentRepository;
private final ResourceMapper resourceMapper;
public PaymentService(PaymentRepository paymentRepository, ResourceMapper resourceMapper) {
this.paymentRepository = paymentRepository;
this.resourceMapper = resourceMapper;
}
public List<PaymentDto> retrieveByUserId(final String id) {
final List<Payment> payments = paymentRepository.findByUserId(id);
LOGGER.info("found {} payment(s)", payments.size());
return resourceMapper.convertPayments(payments);
}
}