package com.test.payment.controller; import com.test.payment.dto.AirtelCallbackPayload; import com.test.payment.dto.CallbackAckDto; import com.test.payment.dto.PaymentRequest; import com.test.payment.dto.PaymentResultDto; import com.test.payment.dto.TransactionStatusDto; import com.test.payment.service.AirtelService; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Mono; @RestController @RequestMapping("/api/airtel") @RequiredArgsConstructor public class AirtelController { private final AirtelService airtelService; @PostMapping("/pay") public Mono pay(@Valid @RequestBody PaymentRequest request) { return airtelService.initiatePayment(request); } @PostMapping("/callback") public Mono callback(@RequestBody AirtelCallbackPayload payload) { return airtelService.handleCallback(payload); } @GetMapping("/status/{transactionId}") public Mono status(@PathVariable String transactionId) { return airtelService.checkStatus(transactionId); } }