class Oadr20bVENEiRegisterPartyService {

	public OadrCanceledPartyRegistrationType oadrCancelPartyRegistration(VtnSessionConfiguration vtnConfiguration,
			OadrCancelPartyRegistrationType oadrCancelPartyRegistrationType) {

		String venID = oadrCancelPartyRegistrationType.getVenID();

		String requestID = oadrCancelPartyRegistrationType.getRequestID();
		String registrationID = oadrCancelPartyRegistrationType.getRegistrationID();
		int responseCode = HttpStatus.OK_200;
		if (getRegistration(vtnConfiguration).getRegistrationID().equals(registrationID)) {
			clearRegistration(vtnConfiguration);
			oadrPollService.cancelHttpScheduledPullRequestTask(vtnConfiguration, false);
		} else {
			responseCode = Oadr20bApplicationLayerErrorCode.INVALID_ID_452;
		}

		return Oadr20bEiRegisterPartyBuilders.newOadr20bCanceledPartyRegistrationBuilder(
				Oadr20bResponseBuilders.newOadr20bEiResponseBuilder(requestID, responseCode).build(), registrationID,
				venID).build();
	}

}