Simplify the fee extensions.

I added shared base classes to all of the Fee extension types that
make it possible to fully ignore the version in the flows. (You
ask for a FeeCreateCommandExtension, for example, and you get one
without having to worry about which). This is an improvement over
the old code that asked you to provide a list of possible fee
extensions and then ask for the first one in preference order.

As part of this I was able to make the Fee implementation a bit
simpler as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137992390
This commit is contained in:
cgoldfeder 2016-11-02 14:18:47 -07:00 committed by Ben McIlwain
parent 2dd703ef3a
commit 8256120b3a
66 changed files with 786 additions and 954 deletions

View file

@ -16,16 +16,15 @@ package google.registry.model.domain.fee11;
import google.registry.model.domain.DomainObjectSpec;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import google.registry.model.domain.fee.FeeQueryResponseExtensionItemImpl;
import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/** The version 0.11 response for a domain check on a single resource. */
@XmlType(propOrder = {"object", "command", "currency", "period", "fee", "feeClass", "reason"})
public class FeeCheckResponseExtensionItemV11
extends FeeQueryResponseExtensionItemImpl implements FeeCheckResponseExtensionItem {
@XmlType(propOrder = {"object", "command", "currency", "period", "fees", "feeClass", "reason"})
public class FeeCheckResponseExtensionItemV11 extends FeeCheckResponseExtensionItem {
/** Whether the domain is available. */
@XmlAttribute
@ -39,10 +38,18 @@ public class FeeCheckResponseExtensionItemV11
/** The reason that the check item cannot be calculated. */
String reason;
/** The command that was checked. */
FeeExtensionCommandDescriptor command;
/** Builder for {@link FeeCheckResponseExtensionItemV11}. */
public static class Builder
extends FeeQueryResponseExtensionItemImpl.Builder<FeeCheckResponseExtensionItemV11, Builder>
implements FeeCheckResponseExtensionItem.Builder {
extends FeeCheckResponseExtensionItem.Builder<FeeCheckResponseExtensionItemV11> {
@Override
public Builder setCommand(CommandName commandName, String phase, String subphase) {
getInstance().command = FeeExtensionCommandDescriptor.create(commandName, phase, subphase);
return this;
}
@Override
public Builder setDomainNameIfSupported(String name) {
@ -67,15 +74,5 @@ public class FeeCheckResponseExtensionItemV11
getInstance().reason = reason;
return this;
}
@Override
public Builder setEffectiveDateIfSupported(DateTime effectiveDate) {
return this;
}
@Override
public Builder setNotAfterDateIfSupported(DateTime notAfterDate) {
return this;
}
}
}