Package com.bank.payment.controllers
Class PaymentController
java.lang.Object
com.bank.payment.controllers.PaymentController
REST controller for handling payment operations.
Provides endpoints for retrieving, deleting, analyzing, and processing payments via Pix.
Delegates business logic to the PaymentService
.
- GET /{idPayment} - Retrieve a payment by its ID
- DELETE /{idPayment} - Delete a payment by its ID
- POST /{idAccount}/pix/{pixKey} - Analyze a payment before processing
- POST /{idAccount}/pix/{pixKey}/direct - Process a direct payment
- Since:
- 1.0.0
- Author:
- Fernando Cruz Cavina
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<Object> analyzePayment
(Long idAccount, String pixKey, PaymentAnalyzeDto paymentDto) Analyzes a payment before processing, returning a confirmation message.org.springframework.http.ResponseEntity
<Object> deletePayment
(Long idPayment) Deletes a payment by its ID.org.springframework.http.ResponseEntity
<Object> directPayment
(Long idAccount, String pixKey, PaymentDto paymentDto) Processes a direct payment from the sender to the receiver using Pix without any analysis.org.springframework.http.ResponseEntity
<Object> getOnePayment
(Long idPayment) Retrieves a payment by its ID.
-
Constructor Details
-
PaymentController
public PaymentController()
-
-
Method Details
-
getOnePayment
@GetMapping("/{idPayment}") public org.springframework.http.ResponseEntity<Object> getOnePayment(@PathVariable("idPayment") Long idPayment) Retrieves a payment by its ID.- Parameters:
idPayment
- the ID of the payment- Returns:
- a ResponseEntity containing the payment details
-
deletePayment
@DeleteMapping("/{idPayment}") public org.springframework.http.ResponseEntity<Object> deletePayment(@PathVariable("idPayment") Long idPayment) Deletes a payment by its ID.- Parameters:
idPayment
- the ID of the payment to delete- Returns:
- a ResponseEntity containing a confirmation message
-
analyzePayment
@PostMapping("/{idAccount}/pix/{pixKey}") public org.springframework.http.ResponseEntity<Object> analyzePayment(@PathVariable("idAccount") Long idAccount, @PathVariable("pixKey") String pixKey, @RequestBody PaymentAnalyzeDto paymentDto) Analyzes a payment before processing, returning a confirmation message.- Parameters:
idAccount
- the ID of the sender's accountpixKey
- the Pix key of the receiverpaymentDto
- the payment analysis data- Returns:
- a ResponseEntity containing a confirmation message
-
directPayment
@PostMapping("/{idAccount}/pix/{pixKey}/direct") public org.springframework.http.ResponseEntity<Object> directPayment(@PathVariable("idAccount") Long idAccount, @PathVariable("pixKey") String pixKey, @RequestBody @Validated PaymentDto paymentDto) Processes a direct payment from the sender to the receiver using Pix without any analysis.- Parameters:
idAccount
- the ID of the sender's accountpixKey
- the Pix key of the receiverpaymentDto
- the payment data- Returns:
- a ResponseEntity containing a confirmation message
-