com.mx.path.model.mdx.web.controller.AchAccountsController 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.account.Account;
import com.mx.path.model.mdx.model.ach_transfer.AchAccount;
import com.mx.path.model.mdx.model.ach_transfer.options.AccountListOptions;
import com.mx.path.model.mdx.model.ach_transfer.options.AchAccountListOptions;
import com.mx.path.model.mdx.web.model.ach_transfer.AchTransferAccountListQueryParameters;
import com.mx.path.model.mdx.web.model.ach_transfer.AchTransferAchAccountListQueryParameters;
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 AchAccountsController extends BaseController {
@RequestMapping(value = "/users/{userId}/accounts/ach_transfer", method = RequestMethod.GET, produces = BaseController.MDX_MEDIA)
public final ResponseEntity> listHeldAccounts(AchTransferAccountListQueryParameters queryParameters) {
AccountListOptions options = new AccountListOptions();
options.setTransferType(queryParameters.getTransfer_type());
options.setListType(queryParameters.getList_type());
options.setAccountId(queryParameters.getAccount_id());
options.setAchAccountId(queryParameters.getAchAccount_id());
AccessorResponse> response = gateway().achTransfers().accounts().list(options);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/ach_transfers/ach_accounts", method = RequestMethod.GET)
public final ResponseEntity> list(AchTransferAchAccountListQueryParameters queryParameters) {
AchAccountListOptions options = new AchAccountListOptions();
options.setTransferType(queryParameters.getTransfer_type());
options.setListType(queryParameters.getList_type());
options.setAccountId(queryParameters.getAccount_id());
options.setAchAccountId(queryParameters.getAchAccount_id());
AccessorResponse> response = gateway().achTransfers().achAccounts().list(options);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/ach_transfers/ach_accounts/{id}", method = RequestMethod.GET)
public final ResponseEntity get(@PathVariable("id") String id) {
AccessorResponse response = gateway().achTransfers().achAccounts().get(id);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/ach_transfers/ach_accounts", method = RequestMethod.POST)
public final ResponseEntity create(@RequestBody AchAccount achAccount) {
AccessorResponse response = gateway().achTransfers().achAccounts().create(achAccount);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/ach_transfers/ach_accounts/{id}", method = RequestMethod.PUT)
public final ResponseEntity update(@PathVariable("id") String id, @RequestBody AchAccount achAccount) {
achAccount.setId(id);
AccessorResponse response = gateway().achTransfers().achAccounts().update(id, achAccount);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/ach_transfers/ach_accounts/{id}", method = RequestMethod.DELETE)
public final ResponseEntity delete(@PathVariable("id") String id) {
AccessorResponse response = gateway().achTransfers().achAccounts().delete(id);
return new ResponseEntity<>(createMultiMapForResponse(response.getHeaders()), HttpStatus.NO_CONTENT);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy