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

com.mx.path.model.mdx.web.controller.CreditReportController 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.credit_report.CreditReport;
import com.mx.path.model.mdx.model.credit_report.CreditReportScoreFactor;
import com.mx.path.model.mdx.model.credit_report.CreditReportSettings;

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

  public CreditReportController() {
  }

  @RequestMapping(value = "/users/{userId}/credit_reports/settings", method = RequestMethod.GET)
  public final ResponseEntity getCreditReportSettings() {
    AccessorResponse response = gateway().creditReports().settings().get();
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

  @RequestMapping(value = "/users/{userId}/credit_reports/settings/subscribe", method = RequestMethod.PUT)
  public final ResponseEntity subscribeCreditReport() {
    AccessorResponse response = gateway().creditReports().subscribe();
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

  @RequestMapping(value = "/users/{userId}/credit_reports/settings/unsubscribe", method = RequestMethod.PUT)
  public final ResponseEntity unsubscribeCreditReport() {
    AccessorResponse response = gateway().creditReports().unsubscribe();
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

  @RequestMapping(value = "/users/{userId}/credit_reports/{reportId}/score_factors", method = RequestMethod.GET)
  public final ResponseEntity> getScoreFactors(@PathVariable("reportId") String reportId) {
    AccessorResponse> response = gateway().creditReports().scoreFactors().list(reportId);
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

  @RequestMapping(value = "/users/{userId}/credit_reports/{reportId}/score_factors/{factorId}", method = RequestMethod.GET)
  public final ResponseEntity getScoreFactor(@PathVariable("reportId") String reportId, @PathVariable("factorId") String factorId) {
    AccessorResponse response = gateway().creditReports().scoreFactors().get(reportId, factorId);
    return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
  }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy