Updates and payments additions

This commit is contained in:
spiro-alvin-nyasimi
2026-07-02 16:45:48 +03:00
parent 36c25a8fe6
commit e9d216be78
98 changed files with 2623 additions and 1445 deletions

View File

@@ -0,0 +1,40 @@
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<PaymentResultDto> pay(@Valid @RequestBody PaymentRequest request) {
return airtelService.initiatePayment(request);
}
@PostMapping("/callback")
public Mono<CallbackAckDto> callback(@RequestBody AirtelCallbackPayload payload) {
return airtelService.handleCallback(payload);
}
@GetMapping("/status/{transactionId}")
public Mono<TransactionStatusDto> status(@PathVariable String transactionId) {
return airtelService.checkStatus(transactionId);
}
}