mirror of
https://github.com/google/nomulus.git
synced 2025-06-29 07:43:37 +02: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:
parent
366c5a344d
commit
6ba1d5e6df
11 changed files with 45 additions and 52 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ import google.registry.model.ImmutableObject;
|
|||
import google.registry.model.common.EntityGroupRoot;
|
||||
import google.registry.model.common.TimedTransitionProperty;
|
||||
import google.registry.model.common.TimedTransitionProperty.TimedTransition;
|
||||
import google.registry.model.pricing.PricingEngine;
|
||||
import google.registry.model.pricing.PremiumPricingEngine;
|
||||
import google.registry.model.pricing.StaticPremiumListPricingEngine;
|
||||
import google.registry.model.registry.label.PremiumList;
|
||||
import google.registry.model.registry.label.ReservedList;
|
||||
|
@ -533,7 +533,7 @@ public class Registry extends ImmutableObject implements Buildable {
|
|||
return claimsPeriodEnd;
|
||||
}
|
||||
|
||||
public String getPricingEngineClassName() {
|
||||
public String getPremiumPricingEngineClassName() {
|
||||
return pricingEngineClassName;
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,8 @@ public class Registry extends ImmutableObject implements Buildable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setPricingEngineClass(Class<? extends PricingEngine> pricingEngineClass) {
|
||||
public Builder setPremiumPricingEngineClass(
|
||||
Class<? extends PremiumPricingEngine> pricingEngineClass) {
|
||||
getInstance().pricingEngineClassName =
|
||||
checkArgumentNotNull(pricingEngineClass).getCanonicalName();
|
||||
return this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue