@@ -1,6 +1,7 @@
|
||||
package ru.soune.nocopy.service.payment;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import ru.soune.nocopy.entity.payment.Payment;
|
||||
@@ -24,6 +25,7 @@ import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class PaymentService {
|
||||
private final PaymentRepository paymentRepository;
|
||||
|
||||
@@ -57,10 +59,13 @@ public class PaymentService {
|
||||
|
||||
@Transactional
|
||||
public void handlePaymentNotification(Map<String, Object> notification) {
|
||||
log.info("INFO FROM YOKASSA:" + notification.toString());
|
||||
|
||||
|
||||
String eventType = (String) notification.get("event");
|
||||
Map<String, Object> object = (Map<String, Object>) notification.get("object");
|
||||
String paymentUuid = (String) object.get("id");
|
||||
|
||||
log.info("METADATA:" + (String) object.get("metadata"));
|
||||
Payment payment = paymentRepository.findByPaymentUuid(paymentUuid)
|
||||
.orElseThrow(() -> new RuntimeException("Payment not found"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user