All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mx.path.model.mdx.web.controller.CrossAccountTransferDestinationController 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.cross_account_transfer.DestinationAccount;

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 CrossAccountTransferDestinationController extends BaseController {

  @RequestMapping(value = "/users/{userId}/cross_account_transfers/destinations", method = RequestMethod.GET)
  public final ResponseEntity> list() {
    AccessorResponse> response = gateway().crossAccount().destination().list();
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

  @RequestMapping(value = "/users/{userId}/cross_account_transfers/destinations/{id}", method = RequestMethod.GET)
  public final ResponseEntity get(@PathVariable("id") String destinationAccountID) {
    AccessorResponse response = gateway().crossAccount().destination().get(destinationAccountID);
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

  @RequestMapping(value = "/users/{userId}/cross_account_transfers/destinations", method = RequestMethod.POST, consumes = MDX_MEDIA)
  public final ResponseEntity create(@RequestBody DestinationAccount destinationAccount) {
    AccessorResponse response = gateway().crossAccount().destination().create(destinationAccount);
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

  @RequestMapping(value = "/users/{userId}/cross_account_transfers/destinations/{id}", method = RequestMethod.PUT, consumes = MDX_MEDIA)
  public final ResponseEntity update(@PathVariable("id") String destinationAccountID, @RequestBody DestinationAccount destinationAccount) {
    AccessorResponse response = gateway().crossAccount().destination().update(destinationAccountID, destinationAccount);
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

  @RequestMapping(value = "/users/{userId}/cross_account_transfers/destinations/{id}", method = RequestMethod.DELETE)
  public final ResponseEntity delete(@PathVariable("id") String destinationAccountID) {
    AccessorResponse response = gateway().crossAccount().destination().delete(destinationAccountID);
    return new ResponseEntity<>(createMultiMapForResponse(response.getHeaders()), HttpStatus.NO_CONTENT);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy