use of ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPPE0Converter in project moh-hnweb by bcgov.
the class EligibilityController method inquirePhn.
/**
* Inquiries on a list of PHNs.
* Maps to the legacy R41.
*
* @param inquirePhnRequest
* @return The result of the query
*/
@PostMapping("/inquire-phn")
public ResponseEntity<InquirePhnResponse> inquirePhn(@Valid @RequestBody InquirePhnRequest inquirePhnRequest, HttpServletRequest request) {
Transaction transaction = transactionStart(request, TransactionType.PHN_INQUIRY);
inquirePhnRequest.getPhns().forEach(phn -> addAffectedParty(transaction, IdentifierType.PHN, phn));
try {
RPBSPPE0Converter converter = new RPBSPPE0Converter();
RPBSPPE0 ppe0Request = converter.convertRequest(inquirePhnRequest);
RPBSPPE0 ppe0Response = eligibilityService.inquirePhn(ppe0Request, transaction);
InquirePhnResponse inquirePhnResponse = converter.convertResponse(ppe0Response);
ResponseEntity<InquirePhnResponse> response = ResponseEntity.ok(inquirePhnResponse);
logger.info("inquirePHN response: {} ", inquirePhnResponse);
transactionComplete(transaction);
inquirePhnResponse.getBeneficiaries().forEach(beneficiary -> addAffectedParty(transaction, IdentifierType.PHN, beneficiary.getPhn()));
return response;
} catch (Exception e) {
handleException(transaction, e);
return null;
}
}
Aggregations