Refactor Fee class to support EAP fee

Currently EapFee is a separate class that has no inheritance from either
BaseFee and Fee. With this CL its functionality is merged into the Fee class
and the type of the fee can be identified by the FeeType enum in the Fee class.
Future custom fees can follow the same pattern.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133627570
This commit is contained in:
jianglai 2016-09-19 13:53:38 -07:00 committed by Ben McIlwain
parent 0518f63aad
commit 77571e2063
9 changed files with 121 additions and 131 deletions

View file

@ -19,6 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Range;
import google.registry.model.domain.fee06.FeeCheckCommandExtensionV06;
import google.registry.model.domain.fee06.FeeCreateCommandExtensionV06;
import google.registry.model.domain.fee06.FeeRenewCommandExtensionV06;
@ -36,6 +37,7 @@ import google.registry.model.domain.fee12.FeeTransferCommandExtensionV12;
import google.registry.model.domain.fee12.FeeUpdateCommandExtensionV12;
import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
import java.math.BigDecimal;
import org.joda.time.DateTime;
/**
* A fee, in currency units specified elsewhere in the xml, with type of the fee an optional fee
@ -51,6 +53,13 @@ public class Fee extends BaseFee {
return instance;
}
public static Fee create(
BigDecimal cost, FeeType type, Range<DateTime> validDateRange, Object... descriptionArgs) {
Fee instance = create(cost, type, descriptionArgs);
instance.validDateRange = validDateRange;
return instance;
}
public static final ImmutableList<
Class<? extends FeeCheckCommandExtension<
? extends FeeCheckCommandExtensionItem, ? extends FeeCheckResponseExtension<?>>>>
@ -91,10 +100,9 @@ public class Fee extends BaseFee {
FeeUpdateCommandExtensionV11.class,
FeeUpdateCommandExtensionV06.class);
public static final ImmutableSet<String>
FEE_EXTENSION_URIS =
ImmutableSet.<String>of(
ServiceExtension.FEE_0_12.getUri(),
ServiceExtension.FEE_0_11.getUri(),
ServiceExtension.FEE_0_6.getUri());
public static final ImmutableSet<String> FEE_EXTENSION_URIS =
ImmutableSet.<String>of(
ServiceExtension.FEE_0_12.getUri(),
ServiceExtension.FEE_0_11.getUri(),
ServiceExtension.FEE_0_6.getUri());
}