Class PaymentController

java.lang.Object
io.github.ravocode.avoonce.sample.PaymentController

@RestController @RequestMapping("/api/payments") public class PaymentController extends Object
Sample REST controller demonstrating selective idempotency protection for payment endpoints.
  • Constructor Details

    • PaymentController

      public PaymentController()
  • Method Details

    • processPayment

      @PostMapping @Idempotent public org.springframework.http.ResponseEntity<PaymentController.PaymentResponse> processPayment(@RequestBody PaymentController.PaymentRequest request)
      Protected endpoint: annotated with Idempotent. Deduplicated and cached in both GLOBAL mode and ANNOTATION mode.
      Parameters:
      request - the payment request payload
      Returns:
      a response entity containing the processing outcome
    • processUnprotectedPayment

      @PostMapping("/unprotected") public org.springframework.http.ResponseEntity<PaymentController.PaymentResponse> processUnprotectedPayment(@RequestBody PaymentController.PaymentRequest request)
      Unprotected endpoint: NOT annotated with Idempotent. In ANNOTATION mode, requests to this endpoint bypass the idempotency filter.
      Parameters:
      request - the payment request payload
      Returns:
      a response entity containing the processing outcome
    • getProcessCount

      @GetMapping("/count") public int getProcessCount()
      Returns the number of processed payment requests seen by this sample controller.
      Returns:
      the current process count
    • resetCount

      @PostMapping("/reset") public org.springframework.http.ResponseEntity<Void> resetCount()
      Resets the sample controller's processing counter.
      Returns:
      an empty success response