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

com.mx.path.model.mdx.web.controller.CrossAccountTransfersController 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.AccountType;
import com.mx.path.model.mdx.model.MdxList;
import com.mx.path.model.mdx.model.account.Account;
import com.mx.path.model.mdx.model.cross_account_transfer.CrossAccountTransfer;

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 CrossAccountTransfersController extends BaseController {
  @RequestMapping(value = "/users/{userId}/cross_account_transfers", method = RequestMethod.POST)
  public final ResponseEntity createCrossAccountTransfer(@RequestBody CrossAccountTransfer crossAccountTransfer) {
    AccessorResponse response = gateway().crossAccount().create(crossAccountTransfer);
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

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

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

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

  @Deprecated
  @RequestMapping(value = "/account_types/cross_account_transfer", method = RequestMethod.GET)
  public final ResponseEntity> listCrossAccountTransferAccountTypesOldPath() {
    AccessorResponse> response = gateway().crossAccount().accountTypes();
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy