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

@ -15,24 +15,31 @@
package google.registry.model.domain.fee06;
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.XmlType;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/** The version 0.6 response for a domain check on a single resource. */
@XmlType(propOrder = {"name", "currency", "command", "period", "fee", "feeClass"})
public class FeeCheckResponseExtensionItemV06
extends FeeQueryResponseExtensionItemImpl implements FeeCheckResponseExtensionItem {
@XmlType(propOrder = {"name", "currency", "command", "period", "fees", "feeClass"})
public class FeeCheckResponseExtensionItemV06 extends FeeCheckResponseExtensionItem {
/** The name of the domain that was checked, with an attribute indicating if it is premium. */
String name;
CurrencyUnit currency;
/** The command that was checked. */
FeeExtensionCommandDescriptor command;
/** Builder for {@link FeeCheckResponseExtensionItemV06}. */
public static class Builder
extends FeeQueryResponseExtensionItemImpl.Builder<FeeCheckResponseExtensionItemV06, Builder>
implements FeeCheckResponseExtensionItem.Builder {
extends FeeCheckResponseExtensionItem.Builder<FeeCheckResponseExtensionItemV06> {
@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) {
@ -45,26 +52,5 @@ public class FeeCheckResponseExtensionItemV06
getInstance().currency = currency;
return this;
}
@Override
public Builder setAvailIfSupported(boolean avail) {
return this;
}
@Override
public Builder setReasonIfSupported(String reason) {
return this;
}
@Override
public Builder setEffectiveDateIfSupported(DateTime effectiveDate) {
return this;
}
@Override
public Builder setNotAfterDateIfSupported(DateTime notAfterDate) {
return this;
}
}
}