package click.kamil.examples.enterprise.api;

import click.kamil.examples.enterprise.service.ReactivePaymentService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

@RestController
@RequiredArgsConstructor
public class ReactivePaymentController {

    private final ReactivePaymentService paymentService;

    @PostMapping("/api/enterprise/payments")
    public Mono<Void> pay(@RequestBody String orderId) {
        return paymentService.processPayment(orderId);
    }
}
