com.mx.path.model.mdx.web.controller.DisputedTransactionsController Maven / Gradle / Ivy
The newest version!
package com.mx.path.model.mdx.web.controller;
import com.mx.path.gateway.accessor.AccessorResponse;
import com.mx.path.model.mdx.model.MdxList;
import com.mx.path.model.mdx.model.dispute.DisputedTransaction;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "{clientId}", produces = BaseController.MDX_MEDIA)
public class DisputedTransactionsController extends BaseController {
@RequestMapping(value = "/users/{user_id}/accounts/{account_id}/disputes/{dispute_id}/disputed_transactions", method = RequestMethod.POST, consumes = BaseController.MDX_MEDIA)
public final ResponseEntity createDisputedTransaction(@PathVariable("dispute_id") String disputeId, @RequestBody DisputedTransaction disputedTransactionRequest) {
disputedTransactionRequest.setDisputeId(disputeId);
AccessorResponse response = gateway().accounts().transactions().disputes().disputedTransactions().create(disputeId, disputedTransactionRequest);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{user_id}/accounts/{account_id}/disputes/{dispute_id}/disputed_transactions/{id}", method = RequestMethod.DELETE)
public final ResponseEntity> deleteDisputedTransaction(@PathVariable("dispute_id") String disputeId, @PathVariable("id") String disputedTransactionId) {
AccessorResponse response = gateway().accounts().transactions().disputes().disputedTransactions().delete(disputeId, disputedTransactionId);
return new ResponseEntity<>(createMultiMapForResponse(response.getHeaders()), HttpStatus.NO_CONTENT);
}
@RequestMapping(value = "/users/{user_id}/accounts/{account_id}/disputes/{dispute_id}/disputed_transactions/{id}", method = RequestMethod.GET)
public final ResponseEntity getDisputedTransaction(@PathVariable("dispute_id") String disputeId, @PathVariable("id") String disputedTransactionId) {
AccessorResponse response = gateway().accounts().transactions().disputes().disputedTransactions().get(disputeId, disputedTransactionId);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{user_id}/accounts/{account_id}/disputes/{dispute_id}/disputed_transactions", method = RequestMethod.GET)
public final ResponseEntity> listDisputedTransactions(@PathVariable("dispute_id") String disputeId) {
AccessorResponse> response = gateway().accounts().transactions().disputes().disputedTransactions().list(disputeId);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{user_id}/accounts/{account_id}/disputes/{dispute_id}/disputed_transactions/{id}", method = RequestMethod.PUT, consumes = BaseController.MDX_MEDIA)
public final ResponseEntity updateDisputedTransaction(@PathVariable("dispute_id") String disputeId, @PathVariable("id") String disputedTransactionId, @RequestBody DisputedTransaction disputedTransaction) {
disputedTransaction.setDisputeId(disputeId);
disputedTransaction.setId(disputedTransactionId);
AccessorResponse response = gateway().accounts().transactions().disputes().disputedTransactions().update(disputeId, disputedTransactionId, disputedTransaction);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy