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

com.mx.path.model.mdx.web.controller.TransferFeesController 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.transfer.Fee;
import com.mx.path.model.mdx.model.transfer.options.FeeListOptions;
import com.mx.path.model.mdx.web.model.transfer.TransferFeeListQueryParameters;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
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 TransferFeesController extends BaseController {

  @RequestMapping(value = "/users/{user_id}/transfers/{id}/fees", method = RequestMethod.GET)
  public final ResponseEntity> list(@PathVariable("id") String transferId) {
    AccessorResponse> response = gateway().transfers().fees().list(transferId);
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

  @RequestMapping(value = "/users/{user_id}/transfers/fees", method = RequestMethod.GET)
  public final ResponseEntity> list(TransferFeeListQueryParameters queryParameters) {
    FeeListOptions options = new FeeListOptions();
    options.setAmount(queryParameters.getAmount());
    options.setFromAccountId(queryParameters.getFrom_account_id());
    options.setToAccountId(queryParameters.getTo_account_id());
    AccessorResponse> response = gateway().transfers().fees().list(options);
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy