dev add violation notion
Test Workflow / test (push) Successful in 4s

This commit is contained in:
vladp
2026-03-18 15:27:43 +07:00
parent 41bc26ee94
commit 9f3430adf2
14 changed files with 726 additions and 9 deletions
@@ -52,4 +52,40 @@ public class PaymentController {
log.error("Error processing payment notification", e);
}
}
@PostMapping("/auto-renewal/disable")
public ResponseEntity<?> disableAutoRenewal(@RequestParam String email) {
try {
paymentService.disableAutoRenewal(email);
return ResponseEntity.ok(Map.of("message", "Auto-renewal disabled"));
} catch (UserNotFoundException e) {
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(Map.of("error", e.getMessage()));
}
}
@DeleteMapping("/methods/{paymentMethodId}")
public ResponseEntity<?> deletePaymentMethod(@RequestParam String email,
@PathVariable String paymentMethodId) {
try {
paymentService.deletePaymentMethod(email, paymentMethodId);
return ResponseEntity.ok(Map.of("message", "Payment method deleted"));
} catch (UserNotFoundException e) {
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(Map.of("error", e.getMessage()));
} catch (RuntimeException e) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(Map.of("error", e.getMessage()));
}
}
@GetMapping("/methods")
public ResponseEntity<?> getPaymentMethods(@RequestParam String email) {
try {
return ResponseEntity.ok(paymentService.getUserPaymentMethods(email));
} catch (UserNotFoundException e) {
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(Map.of("error", e.getMessage()));
}
}
}