Compare commits
9 Commits
refactor-a
...
edeb36cb8c
| Author | SHA1 | Date | |
|---|---|---|---|
| edeb36cb8c | |||
| bacfd529aa | |||
| 8656ececf1 | |||
| 1d104493b5 | |||
| d51161221c | |||
|
|
422daeb99e | ||
|
|
3204b921c4 | ||
| f56ffacec3 | |||
|
|
1ec6e62c04 |
@@ -26,7 +26,7 @@ public class SecurityConfig {
|
|||||||
.cors(cors -> cors.configure(http))
|
.cors(cors -> cors.configure(http))
|
||||||
.csrf(AbstractHttpConfigurer::disable)
|
.csrf(AbstractHttpConfigurer::disable)
|
||||||
.authorizeHttpRequests(auth -> auth
|
.authorizeHttpRequests(auth -> auth
|
||||||
.requestMatchers("/api/v1/auth/**").permitAll()
|
.requestMatchers("/api/v1/auth/**", "/api/v1/payments/notification").permitAll()
|
||||||
.anyRequest().authenticated())
|
.anyRequest().authenticated())
|
||||||
.sessionManagement(session -> session
|
.sessionManagement(session -> session
|
||||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
|
.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package _11.asktpk.artisanconnectbackend.controller;
|
package _11.asktpk.artisanconnectbackend.controller;
|
||||||
|
|
||||||
import _11.asktpk.artisanconnectbackend.dto.*;
|
import _11.asktpk.artisanconnectbackend.dto.*;
|
||||||
|
import _11.asktpk.artisanconnectbackend.entities.Client;
|
||||||
import _11.asktpk.artisanconnectbackend.entities.Order;
|
import _11.asktpk.artisanconnectbackend.entities.Order;
|
||||||
|
import _11.asktpk.artisanconnectbackend.entities.Payment;
|
||||||
import _11.asktpk.artisanconnectbackend.service.OrderService;
|
import _11.asktpk.artisanconnectbackend.service.OrderService;
|
||||||
import _11.asktpk.artisanconnectbackend.service.PaymentService;
|
import _11.asktpk.artisanconnectbackend.service.PaymentService;
|
||||||
import _11.asktpk.artisanconnectbackend.utils.Enums;
|
import _11.asktpk.artisanconnectbackend.utils.Enums;
|
||||||
@@ -11,6 +13,8 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/orders")
|
@RequestMapping("/api/v1/orders")
|
||||||
@@ -38,21 +42,95 @@ public class OrderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/token")
|
@PostMapping("/token")
|
||||||
public ResponseEntity<?> fetchToken() {
|
public ResponseEntity<?> fetchToken(@RequestParam Long orderId) {
|
||||||
Order order = orderService.getOrderById(1L);
|
Order order = orderService.getOrderById(orderId);
|
||||||
|
Client client = order.getClient();
|
||||||
OAuthPaymentResponseDTO authPaymentDTO = paymentService.getOAuthToken();
|
OAuthPaymentResponseDTO authPaymentDTO = paymentService.getOAuthToken();
|
||||||
TransactionPaymentRequestDTO.Payer payer = new TransactionPaymentRequestDTO.Payer(
|
TransactionPaymentRequestDTO.Payer payer = new TransactionPaymentRequestDTO.Payer(
|
||||||
"patryk@test.pl", "Patryk Test");
|
client.getEmail(), client.getFirstName()+' '+client.getLastName());
|
||||||
|
|
||||||
String paymentDescription = order.getOrderType() == Enums.OrderType.ACTIVATION ? "Aktywacja ogłoszenia" : "Podbicie ogłoszenia";
|
String paymentDescription = order.getOrderType() == Enums.OrderType.ACTIVATION ? "Aktywacja ogłoszenia" : "Podbicie ogłoszenia";
|
||||||
paymentDescription += order.getNotice().getTitle();
|
paymentDescription += order.getNotice().getTitle();
|
||||||
TransactionPaymentRequestDTO request = new TransactionPaymentRequestDTO(
|
|
||||||
order.getAmount(), paymentDescription, payer);
|
|
||||||
|
|
||||||
String response = paymentService.createTransaction(order, authPaymentDTO.getAccess_token(), request);
|
TransactionPaymentRequestDTO.Callbacks callbacks = new TransactionPaymentRequestDTO.Callbacks();
|
||||||
System.out.println(response);
|
TransactionPaymentRequestDTO.PayerUrls payerUrls = new TransactionPaymentRequestDTO.PayerUrls();
|
||||||
System.out.println(request);
|
payerUrls.setSuccess("com.hamx.artisanconnect://dashboard/userNotices");
|
||||||
|
payerUrls.setError("com.hamx.artisanconnect://dashboard/userNotices");
|
||||||
|
callbacks.setPayerUrls(payerUrls);
|
||||||
|
|
||||||
|
TransactionPaymentRequestDTO paymentRequest = new TransactionPaymentRequestDTO(
|
||||||
|
order.getAmount(), paymentDescription, payer, callbacks);
|
||||||
|
|
||||||
|
String response = paymentService.createTransaction(order, authPaymentDTO.getAccess_token(), paymentRequest);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(response);
|
return ResponseEntity.status(HttpStatus.OK).body(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get/all")
|
||||||
|
public ResponseEntity<List<OrderWithPaymentsDTO>> getOrders(HttpServletRequest request) {
|
||||||
|
Long clientId = tools.getClientIdFromRequest(request);
|
||||||
|
List<Order> orders = orderService.getOrdersByClientId(clientId);
|
||||||
|
|
||||||
|
List<OrderWithPaymentsDTO> dtoList = orders.stream().map(order -> {
|
||||||
|
OrderWithPaymentsDTO dto = new OrderWithPaymentsDTO();
|
||||||
|
dto.setOrderId(order.getId());
|
||||||
|
dto.setOrderType(order.getOrderType().name());
|
||||||
|
dto.setStatus(order.getStatus().name());
|
||||||
|
dto.setAmount(order.getAmount());
|
||||||
|
dto.setCreatedAt(order.getCreatedAt());
|
||||||
|
|
||||||
|
List<Payment> payments = paymentService.getPaymentsByOrderId(order.getId());
|
||||||
|
|
||||||
|
List<PaymentDTO> paymentDTOs = payments.stream().map(payment -> {
|
||||||
|
PaymentDTO pDto = new PaymentDTO();
|
||||||
|
pDto.setPaymentId(payment.getIdPayment());
|
||||||
|
pDto.setAmount(payment.getAmount());
|
||||||
|
pDto.setStatus(payment.getStatus().name());
|
||||||
|
pDto.setTransactionPaymentUrl(payment.getTransactionPaymentUrl());
|
||||||
|
pDto.setTransactionId(payment.getTransactionId());
|
||||||
|
return pDto;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
dto.setPayments(paymentDTOs);
|
||||||
|
return dto;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
return ResponseEntity.ok(dtoList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get/{orderId}")
|
||||||
|
public ResponseEntity<OrderWithPaymentsDTO> getOrderById(HttpServletRequest request,
|
||||||
|
@PathVariable Long orderId) {
|
||||||
|
Long clientId = tools.getClientIdFromRequest(request);
|
||||||
|
|
||||||
|
Order order = orderService.getOrderById(orderId);
|
||||||
|
|
||||||
|
if (!order.getClient().getId().equals(clientId)) {
|
||||||
|
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderWithPaymentsDTO dto = new OrderWithPaymentsDTO();
|
||||||
|
dto.setOrderId(order.getId());
|
||||||
|
dto.setOrderType(order.getOrderType().name());
|
||||||
|
dto.setStatus(order.getStatus().name());
|
||||||
|
dto.setAmount(order.getAmount());
|
||||||
|
dto.setCreatedAt(order.getCreatedAt());
|
||||||
|
|
||||||
|
List<Payment> payments = paymentService.getPaymentsByOrderId(order.getId());
|
||||||
|
List<PaymentDTO> paymentDTOs = payments.stream().map(payment -> {
|
||||||
|
PaymentDTO pDto = new PaymentDTO();
|
||||||
|
pDto.setPaymentId(payment.getIdPayment());
|
||||||
|
pDto.setAmount(payment.getAmount());
|
||||||
|
pDto.setStatus(payment.getStatus().name());
|
||||||
|
pDto.setTransactionPaymentUrl(payment.getTransactionPaymentUrl());
|
||||||
|
pDto.setTransactionId(payment.getTransactionId());
|
||||||
|
return pDto;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
dto.setPayments(paymentDTOs);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,6 @@ public class PaymentController {
|
|||||||
|
|
||||||
@PostMapping(value = "/notification", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
@PostMapping(value = "/notification", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||||
public ResponseEntity<String> handleTpayNotification(@RequestParam Map<String, String> params) {
|
public ResponseEntity<String> handleTpayNotification(@RequestParam Map<String, String> params) {
|
||||||
log.info("=== ODEBRANO NOTYFIKACJĘ Tpay ===");
|
|
||||||
log.info("Parametry:\n{}", paramsToLogString(params));
|
|
||||||
|
|
||||||
String id = params.get("id");
|
String id = params.get("id");
|
||||||
String trId = params.get("tr_id");
|
String trId = params.get("tr_id");
|
||||||
String trAmount = params.get("tr_amount");
|
String trAmount = params.get("tr_amount");
|
||||||
@@ -54,7 +51,6 @@ public class PaymentController {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!expectedMd5.equals(md5sum)) {
|
if (!expectedMd5.equals(md5sum)) {
|
||||||
log.warn("❌ Błędna suma kontrolna! Otrzymano: {}, Oczekiwano: {}", md5sum, expectedMd5);
|
|
||||||
return ResponseEntity.status(400).body("INVALID CHECKSUM");
|
return ResponseEntity.status(400).body("INVALID CHECKSUM");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +59,6 @@ public class PaymentController {
|
|||||||
Payment payment = optionalPayment.get();
|
Payment payment = optionalPayment.get();
|
||||||
|
|
||||||
if ("true".equalsIgnoreCase(trStatus) || "PAID".equalsIgnoreCase(trStatus)) {
|
if ("true".equalsIgnoreCase(trStatus) || "PAID".equalsIgnoreCase(trStatus)) {
|
||||||
log.info("✅ Transakcja opłacona: tr_id={}, kwota={}", trId, params.get("tr_paid"));
|
|
||||||
payment.setStatus(Enums.PaymentStatus.CORRECT);
|
payment.setStatus(Enums.PaymentStatus.CORRECT);
|
||||||
|
|
||||||
if (payment.getOrder() != null) {
|
if (payment.getOrder() != null) {
|
||||||
@@ -78,7 +73,6 @@ public class PaymentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if ("false".equalsIgnoreCase(trStatus)) {
|
} else if ("false".equalsIgnoreCase(trStatus)) {
|
||||||
log.warn("❌ Transakcja nieudana: {}", trId);
|
|
||||||
payment.setStatus(Enums.PaymentStatus.INCORRECT);
|
payment.setStatus(Enums.PaymentStatus.INCORRECT);
|
||||||
|
|
||||||
if (payment.getOrder() != null) {
|
if (payment.getOrder() != null) {
|
||||||
@@ -87,10 +81,7 @@ public class PaymentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
paymentRepository.save(payment);
|
paymentRepository.save(payment);
|
||||||
} else {
|
|
||||||
log.warn("⚠️ Brak płatności o tr_id={}", trId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok("TRUE");
|
return ResponseEntity.ok("TRUE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package _11.asktpk.artisanconnectbackend.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter @Setter
|
||||||
|
public class OrderWithPaymentsDTO {
|
||||||
|
private Long orderId;
|
||||||
|
private String orderType;
|
||||||
|
private String status;
|
||||||
|
private Double amount;
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private List<PaymentDTO> payments;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package _11.asktpk.artisanconnectbackend.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class PaymentDTO {
|
||||||
|
private Long paymentId;
|
||||||
|
private Double amount;
|
||||||
|
private String status;
|
||||||
|
private String transactionPaymentUrl;
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
public void setPaymentId(Long paymentId) {
|
||||||
|
this.paymentId = paymentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(Double amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionPaymentUrl(String transactionPaymentUrl) {
|
||||||
|
this.transactionPaymentUrl = transactionPaymentUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionId(String transactionId) {
|
||||||
|
this.transactionId = transactionId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ public class TransactionPaymentRequestDTO {
|
|||||||
private double amount;
|
private double amount;
|
||||||
private String description;
|
private String description;
|
||||||
private Payer payer;
|
private Payer payer;
|
||||||
|
private Callbacks callbacks;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -20,4 +21,21 @@ public class TransactionPaymentRequestDTO {
|
|||||||
private String email;
|
private String email;
|
||||||
private String name;
|
private String name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class Callbacks {
|
||||||
|
private PayerUrls payerUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class PayerUrls {
|
||||||
|
private String success;
|
||||||
|
private String error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import _11.asktpk.artisanconnectbackend.entities.Order;
|
|||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface OrderRepository extends JpaRepository<Order, Long> {
|
public interface OrderRepository extends JpaRepository<Order, Long> {
|
||||||
|
List<Order> findByClientId(Long clientId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import _11.asktpk.artisanconnectbackend.entities.Payment;
|
|||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface PaymentRepository extends JpaRepository<Payment, Long> {
|
public interface PaymentRepository extends JpaRepository<Payment, Long> {
|
||||||
Optional<Payment> findByTransactionId(String transactionId);
|
Optional<Payment> findByTransactionId(String transactionId);
|
||||||
|
|
||||||
|
List<Payment> findAllByOrderId(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import _11.asktpk.artisanconnectbackend.dto.ClientDTO;
|
|||||||
import _11.asktpk.artisanconnectbackend.entities.Client;
|
import _11.asktpk.artisanconnectbackend.entities.Client;
|
||||||
import _11.asktpk.artisanconnectbackend.security.JwtUtil;
|
import _11.asktpk.artisanconnectbackend.security.JwtUtil;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -23,10 +22,10 @@ public class AuthService {
|
|||||||
private final PasswordEncoder passwordEncoder;
|
private final PasswordEncoder passwordEncoder;
|
||||||
private final JwtUtil jwtUtil;
|
private final JwtUtil jwtUtil;
|
||||||
|
|
||||||
public AuthService(ClientService clientService, JwtUtil jwtUtil) {
|
public AuthService(ClientService clientService, JwtUtil jwtUtil, PasswordEncoder passwordEncoder) {
|
||||||
this.clientService = clientService;
|
this.clientService = clientService;
|
||||||
this.jwtUtil = jwtUtil;
|
this.jwtUtil = jwtUtil;
|
||||||
this.passwordEncoder = new BCryptPasswordEncoder();
|
this.passwordEncoder = passwordEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthResponseDTO login(String email, String password) throws Exception {
|
public AuthResponseDTO login(String email, String password) throws Exception {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import _11.asktpk.artisanconnectbackend.entities.Role;
|
|||||||
import _11.asktpk.artisanconnectbackend.repository.ClientRepository;
|
import _11.asktpk.artisanconnectbackend.repository.ClientRepository;
|
||||||
import _11.asktpk.artisanconnectbackend.repository.RolesRepository;
|
import _11.asktpk.artisanconnectbackend.repository.RolesRepository;
|
||||||
import jakarta.persistence.EntityNotFoundException;
|
import jakarta.persistence.EntityNotFoundException;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,12 +14,10 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class ClientService {
|
public class ClientService {
|
||||||
private final ClientRepository clientRepository;
|
private final ClientRepository clientRepository;
|
||||||
private final PasswordEncoder passwordEncoder;
|
|
||||||
private final RolesRepository rolesRepository;
|
private final RolesRepository rolesRepository;
|
||||||
|
|
||||||
public ClientService(ClientRepository clientRepository, PasswordEncoder passwordEncoder, RolesRepository rolesRepository) {
|
public ClientService(ClientRepository clientRepository, RolesRepository rolesRepository) {
|
||||||
this.clientRepository = clientRepository;
|
this.clientRepository = clientRepository;
|
||||||
this.passwordEncoder = passwordEncoder;
|
|
||||||
this.rolesRepository = rolesRepository;
|
this.rolesRepository = rolesRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +123,6 @@ public class ClientService {
|
|||||||
|
|
||||||
public ClientDTO registerClient(Client client) {
|
public ClientDTO registerClient(Client client) {
|
||||||
client.setRole(getUserRole()); // ID 1 - USER role
|
client.setRole(getUserRole()); // ID 1 - USER role
|
||||||
client.setPassword(passwordEncoder.encode(client.getPassword()));
|
|
||||||
return toDto(clientRepository.save(client));
|
return toDto(clientRepository.save(client));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ public class EmailService {
|
|||||||
|
|
||||||
public void sendEmail(EmailDTO email) {
|
public void sendEmail(EmailDTO email) {
|
||||||
SimpleMailMessage message = new SimpleMailMessage();
|
SimpleMailMessage message = new SimpleMailMessage();
|
||||||
|
message.setFrom("noreply@zikor.pl");
|
||||||
message.setTo(email.getTo());
|
message.setTo(email.getTo());
|
||||||
message.setSubject(email.getSubject());
|
message.setSubject(email.getSubject());
|
||||||
message.setText(email.getBody());
|
message.setText(email.getBody());
|
||||||
message.setFrom("patryk.kania001@gmail.com");
|
|
||||||
mailSender.send(message);
|
mailSender.send(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import _11.asktpk.artisanconnectbackend.entities.Order;
|
import _11.asktpk.artisanconnectbackend.entities.Order;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class OrderService {
|
public class OrderService {
|
||||||
@@ -75,4 +76,8 @@ public class OrderService {
|
|||||||
return orderRepository.findById(id)
|
return orderRepository.findById(id)
|
||||||
.orElseThrow(() -> new RuntimeException("Nie znaleziono zamówienia o ID: " + id));
|
.orElseThrow(() -> new RuntimeException("Nie znaleziono zamówienia o ID: " + id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Order> getOrdersByClientId(Long clientId) {
|
||||||
|
return orderRepository.findByClientId(clientId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import org.springframework.web.reactive.function.BodyInserters;
|
|||||||
import org.springframework.web.reactive.function.client.WebClient;
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class PaymentService {
|
public class PaymentService {
|
||||||
private final WebClient webClient;
|
private final WebClient webClient;
|
||||||
@@ -80,4 +82,10 @@ public class PaymentService {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Payment> getPaymentsByOrderId(Long id) {
|
||||||
|
return paymentRepository.findAllByOrderId(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ file.upload-dir=/Users/andsol/Desktop/uploads
|
|||||||
spring.servlet.multipart.max-file-size=10MB
|
spring.servlet.multipart.max-file-size=10MB
|
||||||
spring.servlet.multipart.max-request-size=10MB
|
spring.servlet.multipart.max-request-size=10MB
|
||||||
|
|
||||||
spring.mail.host=smtp.gmail.com
|
spring.mail.host=smtp.sendgrid.net
|
||||||
spring.mail.port=587
|
spring.mail.port=587
|
||||||
spring.mail.username=patryk.kania001@gmail.com
|
spring.mail.username=apikey
|
||||||
spring.mail.password=pmyd ylwg mbsn hcpp
|
spring.mail.password=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
|
||||||
spring.mail.properties.mail.smtp.auth=true
|
spring.mail.properties.mail.smtp.auth=true
|
||||||
spring.mail.properties.mail.smtp.starttls.enable=true
|
spring.mail.properties.mail.smtp.starttls.enable=true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user