Code refinement

if (newPrimaryOfferId != null) {
if (restrictedPrimaryOffersForSelectionSO.getOfferIds().contains(newPrimaryOfferId)) {
PrimaryOfferCannotSelectSOException ex = PrimaryOfferCannotSelectSOException.builder()
.offeringName(offerResponse.getPrimaryOffering().getOfferingName())
.build();
log.error("ActionLog.getMsisdnDetails.error ex", ex);
throw ex;
}
} else {
if (restrictedPrimaryOffersForSelectionSO.getOfferIds().contains(primaryOfferId)) {
PrimaryOfferCannotSelectSOException ex = PrimaryOfferCannotSelectSOException.builder()
.offeringName(offerResponse.getPrimaryOffering().getOfferingName())
.build();
log.error("ActionLog.getMsisdnDetails.error ex", ex);
throw ex;
}
}
offersInfos = mnoProductClient.getOfferListByTypeForSalesApp("az", ProviderTypes.Azerfon.getKey(),

OfferType.SO).getData(); 


to this:

if (newPrimaryOfferId != null && restrictedPrimaryOffersForSelectionSO.getOfferIds().contains(newPrimaryOfferId)
|| newPrimaryOfferId == null && restrictedPrimaryOffersForSelectionSO.getOfferIds().contains(primaryOfferId)) {
throw PrimaryOfferCannotSelectSOException.builder()
.offeringName(offerResponse.getPrimaryOffering().getOfferingName())
.build();
}

offersInfos = mnoProductClient.getOfferListByTypeForSalesApp("az", ProviderTypes.Azerfon.getKey(),
OfferType.SO).getData();



















Комментарии

Популярные сообщения из этого блога

Lesson1: JDK, JVM, JRE

SE_21_Lesson_11: Inheritance, Polymorphism

SE_21_Lesson_9: Initialization Blocks, Wrapper types, String class