com.mx.path.model.mdx.web.controller.AchTransfersController 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.ach_transfer.AchTransfer;
import com.mx.path.model.mdx.model.ach_transfer.options.AchTransferListOptions;
import com.mx.path.model.mdx.web.model.ach_transfer.AchTransferListQueryParameters;
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 AchTransfersController extends BaseController {
public AchTransfersController() {
}
@RequestMapping(value = "/users/{userId}/ach_transfers", method = RequestMethod.GET)
public final ResponseEntity> list(AchTransferListQueryParameters queryParameters) {
AchTransferListOptions options = new AchTransferListOptions();
options.setTransferType(queryParameters.getTransfer_type());
AccessorResponse> response = gateway().achTransfers().list(options);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/ach_transfers/{id}", method = RequestMethod.GET)
public final ResponseEntity get(@PathVariable("id") String id) {
AccessorResponse response = gateway().achTransfers().get(id);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/ach_transfers", method = RequestMethod.POST)
public final ResponseEntity create(@RequestBody AchTransfer achTransfer) {
AccessorResponse response = gateway().achTransfers().create(achTransfer);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/ach_transfers/{id}", method = RequestMethod.PUT)
public final ResponseEntity update(@PathVariable("id") String id, @RequestBody AchTransfer achTransfer) {
achTransfer.setId(id);
AccessorResponse response = gateway().achTransfers().update(id, achTransfer);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/ach_transfers/{id}/cancel", method = RequestMethod.PUT)
public final ResponseEntity cancel(@PathVariable("id") String id) {
AccessorResponse response = gateway().achTransfers().cancel(id);
return new ResponseEntity<>(createMultiMapForResponse(response.getHeaders()), HttpStatus.NO_CONTENT);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy