use of ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWP0 in project moh-hnweb by bcgov.
the class GroupMemberService method cancelDependent.
/**
* Cancels the group member's dependent coverage based on the R36/RPBSPWP0.
*
* @param rpbspwp0
* @return The RPBSPWP0 response.
* @throws HNWebException
*/
public RPBSPWP0 cancelDependent(RPBSPWP0 rpbspwp0, Transaction transaction) throws HNWebException {
String rpbspwp0Str = rpbspwp0.serialize();
logger.info("Request {}", rpbspwp0Str);
messageSent(transaction);
ResponseEntity<String> response = postRapidRequest(r36Path, rpbspwp0Str);
messageReceived(transaction);
logger.debug("Response Status: {} ; Message:\n{}", response.getStatusCode(), response.getBody());
if (response.getStatusCode() != HttpStatus.OK) {
logger.error("Could not connect to downstream service. Service returned {}", response.getStatusCode());
throw new HNWebException(ExceptionType.DOWNSTREAM_FAILURE);
}
RPBSPWP0 rpbspwp0Response = new RPBSPWP0(response.getBody());
return rpbspwp0Response;
}
use of ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWP0 in project moh-hnweb by bcgov.
the class GroupMemberController method cancelDependent.
/**
* Cancels a group member's dependent coverage.
* Maps to the legacy R36.
*
* @param cancelDependentRequest
* @return The result of the operation.
*/
@PostMapping("/cancel-dependent")
public ResponseEntity<CancelDependentResponse> cancelDependent(@Valid @RequestBody CancelDependentRequest cancelDependentRequest, HttpServletRequest request) {
Transaction transaction = auditCancelDependentStart(cancelDependentRequest, request);
try {
RPBSPWP0Converter converter = new RPBSPWP0Converter();
RPBSPWP0 rpbspwp0 = converter.convertRequest(cancelDependentRequest);
RPBSPWP0 rpbspwc0Response = groupMemberService.cancelDependent(rpbspwp0, transaction);
CancelDependentResponse cancelDependentResponse = converter.convertResponse(rpbspwc0Response);
ResponseEntity<CancelDependentResponse> response = ResponseEntity.ok(cancelDependentResponse);
logger.info("CancelDependentResponse response: {} ", cancelDependentResponse);
transactionComplete(transaction);
addAffectedParty(transaction, IdentifierType.PHN, cancelDependentResponse.getPhn());
return response;
} catch (Exception e) {
handleException(transaction, e);
return null;
}
}
use of ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWP0 in project moh-hnweb by bcgov.
the class RPBSPWP0Converter method convertRequest.
public RPBSPWP0 convertRequest(CancelDependentRequest request) {
RPBSHeader rpbsHeader = new RPBSHeader();
rpbsHeader.setOrganization(userInfo.getOrganization());
rpbsHeader.setTranCode(getTranCode());
WP0 wp0 = new WP0();
wp0.setGroupNumber(request.getGroupNumber());
wp0.setSubscriberPhn(request.getPhn());
wp0.setBeneficiaryPhn(request.getDependentPhn());
wp0.setCoverageCancelDate(formatDate(request.getCoverageCancelDate()));
wp0.setPayerCancelReason(request.getCancelReason());
RPBSPWP0 rpbspwp0 = new RPBSPWP0();
rpbspwp0.setRpbsHeader(rpbsHeader);
rpbspwp0.setWp0(wp0);
return rpbspwp0;
}
Aggregations