mirror of
https://github.com/google/nomulus
synced 2026-01-06 21:47:31 +00:00
Rename PricingEngine to PremiumPricingEngine
This properly reflects the fact that other, separate things will now be responsible both for EAP and for per-TLD custom pricing. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=124558165
This commit is contained in:
committed by
Justine Tunney
parent
366c5a344d
commit
6ba1d5e6df
@@ -19,8 +19,13 @@ import com.google.common.base.Optional;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** A plugin interface for premium pricing engines. */
|
||||
public interface PricingEngine {
|
||||
/**
|
||||
* A plugin interface for premium pricing engines.
|
||||
*
|
||||
* <p>A premium pricing engine is responsible solely for determining whether a given label is
|
||||
* premium or not, and if it is, how much it should cost.
|
||||
*/
|
||||
public interface PremiumPricingEngine {
|
||||
|
||||
/**
|
||||
* Returns the prices for the given fully qualified domain name at the given time.
|
||||
@@ -31,9 +36,9 @@ public interface PricingEngine {
|
||||
public DomainPrices getDomainPrices(String fullyQualifiedDomainName, DateTime priceTime);
|
||||
|
||||
/**
|
||||
* A class containing information on prices for a specific domain name.
|
||||
* A class containing information on premium prices for a specific domain name.
|
||||
*
|
||||
* <p>Any implementation of PricingEngine is responsible for determining all of these.
|
||||
* <p>Any implementation of PremiumPricingEngine is responsible for determining all of these.
|
||||
*/
|
||||
public static class DomainPrices {
|
||||
|
||||
@@ -42,20 +47,17 @@ public interface PricingEngine {
|
||||
// create, renew, restore, and transfer.
|
||||
private Money createCost;
|
||||
private Money renewCost;
|
||||
private Optional<Money> oneTimeFee;
|
||||
private Optional<String> feeClass;
|
||||
|
||||
static DomainPrices create(
|
||||
boolean isPremium,
|
||||
Money createCost,
|
||||
Money renewCost,
|
||||
Optional<Money> oneTimeFee,
|
||||
Optional<String> feeClass) {
|
||||
DomainPrices instance = new DomainPrices();
|
||||
instance.isPremium = isPremium;
|
||||
instance.createCost = createCost;
|
||||
instance.renewCost = renewCost;
|
||||
instance.oneTimeFee = oneTimeFee;
|
||||
instance.feeClass = feeClass;
|
||||
return instance;
|
||||
}
|
||||
@@ -75,15 +77,6 @@ public interface PricingEngine {
|
||||
return renewCost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the one time fee to register a domain if there is one.
|
||||
*
|
||||
* <p>This is primarily used for EAP registration fees.
|
||||
*/
|
||||
public Optional<Money> getOneTimeFee() {
|
||||
return oneTimeFee;
|
||||
}
|
||||
|
||||
/** Returns the fee class of the cost (used for the Fee extension). */
|
||||
public Optional<String> getFeeClass() {
|
||||
return feeClass;
|
||||
@@ -35,7 +35,7 @@ import org.joda.time.DateTime;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/** A premium list pricing engine that stores static pricing information in Datastore entities. */
|
||||
public final class StaticPremiumListPricingEngine implements PricingEngine {
|
||||
public final class StaticPremiumListPricingEngine implements PremiumPricingEngine {
|
||||
|
||||
@Inject StaticPremiumListPricingEngine() {}
|
||||
|
||||
@@ -61,7 +61,6 @@ public final class StaticPremiumListPricingEngine implements PricingEngine {
|
||||
premiumPrice.isPresent(),
|
||||
premiumPrice.or(registry.getStandardCreateCost()),
|
||||
premiumPrice.or(registry.getStandardRenewCost(priceTime)),
|
||||
Optional.<Money>absent(),
|
||||
Optional.<String>fromNullable(feeClass));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user