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,22 +16,47 @@ package google.registry.model.domain.fee06;
import com.google.common.base.Optional;
import google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItemImpl;
import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
import javax.xml.bind.annotation.XmlType;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/** An individual price check item in version 0.6 of the fee extension on Check commands. */
@XmlType(propOrder = {"name", "currency", "command", "period"})
public class FeeCheckCommandExtensionItemV06
extends FeeQueryCommandExtensionItemImpl implements FeeCheckCommandExtensionItem {
public class FeeCheckCommandExtensionItemV06 extends FeeCheckCommandExtensionItem {
/** The fully qualified domain name being checked. */
String name;
CurrencyUnit currency;
/** The command being checked. */
FeeExtensionCommandDescriptor command;
/** The name of the command being checked. */
@Override
public CommandName getCommandName() {
return command.getCommand();
}
/** The command name before being parsed into an enum, for use in error strings. */
@Override
public String getUnparsedCommandName() {
return command.getUnparsedCommandName();
}
/** The phase of the command being checked. */
@Override
public String getPhase() {
return command.getPhase();
}
/** The subphase of the command being checked. */
@Override
public String getSubphase() {
return command.getSubphase();
}
@Override
public boolean isDomainNameSupported() {
return true;
@ -48,7 +73,7 @@ public class FeeCheckCommandExtensionItemV06
}
@Override
public FeeCheckResponseExtensionItem.Builder createResponseBuilder() {
public FeeCheckResponseExtensionItemV06.Builder createResponseBuilder() {
return new FeeCheckResponseExtensionItemV06.Builder();
}