Add additional specific PricingEngineProxy methods

We already had methods to return just the create or just the renew price. I added more to return just the premium flag or just the fee class.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136833071
This commit is contained in:
mountford 2016-10-21 08:10:33 -07:00 committed by Ben McIlwain
parent fad0aa4ffa
commit aecca10989
7 changed files with 29 additions and 19 deletions

View file

@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static google.registry.util.DomainNameUtils.getTldFromDomainName;
import com.google.common.base.Optional;
import google.registry.model.pricing.PremiumPricingEngine;
import google.registry.model.pricing.PremiumPricingEngine.DomainPrices;
import google.registry.model.registry.Registry;
@ -46,6 +47,16 @@ public final class PricingEngineProxy {
return getPricesForDomainName(domainName, priceTime).getRenewCost().multipliedBy(years);
}
/** Returns true if the specified domain name is premium. */
public static boolean isDomainPremium(String domainName, DateTime priceTime) {
return getPricesForDomainName(domainName, priceTime).isPremium();
}
/** Returns the fee class of the specified domain name. */
public static Optional<String> getDomainFeeClass(String domainName, DateTime priceTime) {
return getPricesForDomainName(domainName, priceTime).getFeeClass();
}
/**
* Returns the full {@link DomainPrices} details for the given domain name by dispatching to the
* appropriate {@link PremiumPricingEngine} based on what is configured for the TLD that the