policy/src/main/java/com/stackroute.pie/service/PolicyServiceImpl.java
//Method for deleting the policy for insurer
Method for deleting the policy for insurer
Method for deleting the policy for insurer
@Override
    public Policy deletePolicy(String insurerName, String policyName) throws PolicyNotFoundException {
        if(policyRepository.existsByPolicyNameAndInsurerName(policyName,insurerName) == false) {
            new PolicyNotFoundException();
        }
        String uniqueId = insurerName + policyName;
        Policy policy = policyRepository.findByUniqueId(uniqueId).get();
        Policy policy1 = policy;
        policyRepository.delete(policy);
        return policy1;
    }
@ Override public Policy deletePolicy ( String insurerName , String policyName ) throws PolicyNotFoundException { if ( policyRepository . existsByPolicyNameAndInsurerName ( policyName , insurerName ) == false ) { new PolicyNotFoundException ( ) ; } String uniqueId = insurerName + policyName ; Policy policy = policyRepository . findByUniqueId ( uniqueId ) . get ( ) ; Policy policy1 = policy ; policyRepository . delete ( policy ) ; return policy1 ; }
Method for deleting the policy for insurer
Method for deleting the policy for insurer