Compare commits
2 Commits
f56ffacec3
...
422daeb99e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
422daeb99e | ||
|
|
3204b921c4 |
@@ -44,7 +44,6 @@ public class OrderController {
|
||||
@PostMapping("/token")
|
||||
public ResponseEntity<?> fetchToken(HttpServletRequest request,@RequestParam Long orderId) {
|
||||
Order order = orderService.getOrderById(orderId);
|
||||
Long clientId = tools.getClientIdFromRequest(request);
|
||||
Client client = order.getClient();
|
||||
OAuthPaymentResponseDTO authPaymentDTO = paymentService.getOAuthToken();
|
||||
TransactionPaymentRequestDTO.Payer payer = new TransactionPaymentRequestDTO.Payer(
|
||||
@@ -56,8 +55,6 @@ public class OrderController {
|
||||
order.getAmount(), paymentDescription, payer);
|
||||
|
||||
String response = paymentService.createTransaction(order, authPaymentDTO.getAccess_token(), paymentRequest);
|
||||
System.out.println(response);
|
||||
System.out.println(request);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(response);
|
||||
}
|
||||
@@ -102,7 +99,7 @@ public class OrderController {
|
||||
Order order = orderService.getOrderById(orderId);
|
||||
|
||||
if (!order.getClient().getId().equals(clientId)) {
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).build(); // lub UNAUTHORIZED
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
|
||||
}
|
||||
|
||||
OrderWithPaymentsDTO dto = new OrderWithPaymentsDTO();
|
||||
|
||||
@@ -39,9 +39,6 @@ public class PaymentController {
|
||||
|
||||
@PostMapping(value = "/notification", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
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 trId = params.get("tr_id");
|
||||
String trAmount = params.get("tr_amount");
|
||||
@@ -54,7 +51,6 @@ public class PaymentController {
|
||||
);
|
||||
|
||||
if (!expectedMd5.equals(md5sum)) {
|
||||
log.warn("❌ Błędna suma kontrolna! Otrzymano: {}, Oczekiwano: {}", md5sum, expectedMd5);
|
||||
return ResponseEntity.status(400).body("INVALID CHECKSUM");
|
||||
}
|
||||
|
||||
@@ -63,7 +59,6 @@ public class PaymentController {
|
||||
Payment payment = optionalPayment.get();
|
||||
|
||||
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);
|
||||
|
||||
if (payment.getOrder() != null) {
|
||||
@@ -78,7 +73,6 @@ public class PaymentController {
|
||||
}
|
||||
|
||||
} else if ("false".equalsIgnoreCase(trStatus)) {
|
||||
log.warn("❌ Transakcja nieudana: {}", trId);
|
||||
payment.setStatus(Enums.PaymentStatus.INCORRECT);
|
||||
|
||||
if (payment.getOrder() != null) {
|
||||
@@ -87,10 +81,7 @@ public class PaymentController {
|
||||
}
|
||||
|
||||
paymentRepository.save(payment);
|
||||
} else {
|
||||
log.warn("⚠️ Brak płatności o tr_id={}", trId);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok("TRUE");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user