Files
no-copy/src/main/java/ru/soune/nocopy/controller/PaymentController.java
T
vladp 3d5856d302
Test Workflow / test (push) Successful in 3s
dev add reset password
2026-02-18 16:14:17 +07:00

34 lines
1.1 KiB
Java

package ru.soune.nocopy.controller;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import ru.soune.nocopy.entity.payment.Payment;
import ru.soune.nocopy.service.payment.PaymentService;
import java.util.Map;
@RestController
@RequestMapping("/api/payments")
@RequiredArgsConstructor
@Slf4j
public class PaymentController {
private final PaymentService paymentService;
@PostMapping("/create")
public Payment createPayment(@RequestParam String email, @RequestParam Long tariffId,
@RequestParam String operationType, @RequestParam String operationUuid) {
return paymentService.createPayment(email, tariffId, operationType, operationUuid);
}
@PostMapping("webhook/yookassa")
public void handleYooKassaNotification(@RequestBody Map<String, Object> notification) {
try {
paymentService.handlePaymentNotification(notification);
} catch (Exception e) {
log.error("Error processing payment notification", e);
}
}
}