Search in sources :

Example 1 with RPBSPCI0Converter

use of ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPCI0Converter in project moh-hnweb by bcgov.

the class MspContractsController method inquireContract.

/**
 * Get MSP Coverage info for a Personal Health Number (PHN) of a group Inquiry
 * Maps to the legacy R40.
 *
 * Also used by R37 as the results required for R37 are a subset of those returned for Contract Inquiry so it can return the same result. This
 * does not break overall security as currently all roles with permissions for R37(Get Group Member's Contract Address) also have permission
 * for R40(Contract Inquiry).
 *
 * @param contractInquiryRequest
 * @return The result of the operation.
 */
@PostMapping("/inquire-contract")
public ResponseEntity<ContractInquiryResponse> inquireContract(@Valid @RequestBody ContractInquiryRequest contractInquiryRequest, HttpServletRequest request) {
    Transaction transaction = auditContractInquiryStart(contractInquiryRequest, request);
    try {
        RPBSPCI0Converter converter = new RPBSPCI0Converter();
        RPBSPCI0 rpbspci0Request = converter.convertRequest(contractInquiryRequest);
        RPBSPCI0 rpbspci0Response = mspContractsService.inquireContract(rpbspci0Request);
        ContractInquiryResponse contractInquiryResponse = converter.convertResponse(rpbspci0Response);
        ResponseEntity<ContractInquiryResponse> response = ResponseEntity.ok(contractInquiryResponse);
        logger.info("ContractInquiry response: {} ", rpbspci0Response);
        auditContractInquiryEnd(transaction, contractInquiryResponse);
        return response;
    } catch (Exception e) {
        handleException(transaction, e);
        return null;
    }
}
Also used : RPBSPCI0(ca.bc.gov.hlth.hnweb.model.rapid.RPBSPCI0) ContractInquiryResponse(ca.bc.gov.hlth.hnweb.model.rest.mspcontracts.ContractInquiryResponse) Transaction(ca.bc.gov.hlth.hnweb.persistence.entity.Transaction) RPBSPCI0Converter(ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPCI0Converter) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

RPBSPCI0Converter (ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPCI0Converter)1 RPBSPCI0 (ca.bc.gov.hlth.hnweb.model.rapid.RPBSPCI0)1 ContractInquiryResponse (ca.bc.gov.hlth.hnweb.model.rest.mspcontracts.ContractInquiryResponse)1 Transaction (ca.bc.gov.hlth.hnweb.persistence.entity.Transaction)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1