mirror of
https://github.com/google/nomulus.git
synced 2025-07-21 02:06:00 +02:00
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:
parent
0518f63aad
commit
77571e2063
9 changed files with 121 additions and 131 deletions
|
@ -56,7 +56,8 @@ 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.domain.fee.EapFee;
|
||||
import google.registry.model.domain.fee.BaseFee.FeeType;
|
||||
import google.registry.model.domain.fee.Fee;
|
||||
import google.registry.model.registry.label.PremiumList;
|
||||
import google.registry.model.registry.label.ReservedList;
|
||||
import google.registry.util.Idn;
|
||||
|
@ -518,15 +519,19 @@ public class Registry extends ImmutableObject implements Buildable {
|
|||
/**
|
||||
* Returns the EAP fee for the registry at the given time.
|
||||
*/
|
||||
public EapFee getEapFeeFor(DateTime now) {
|
||||
public Fee getEapFeeFor(DateTime now) {
|
||||
ImmutableSortedMap<DateTime, Money> valueMap = eapFeeSchedule.toValueMap();
|
||||
DateTime periodStart = valueMap.floorKey(now);
|
||||
DateTime periodEnd = valueMap.ceilingKey(now);
|
||||
return EapFee.create(
|
||||
eapFeeSchedule.getValueAtTime(now),
|
||||
Range.closedOpen(
|
||||
periodStart != null ? periodStart : START_OF_TIME,
|
||||
periodEnd != null ? periodEnd : END_OF_TIME));
|
||||
// NOTE: assuming END_OF_TIME would never be reached...
|
||||
Range<DateTime> validPeriod = Range.closedOpen(
|
||||
periodStart != null ? periodStart : START_OF_TIME,
|
||||
periodEnd != null ? periodEnd : END_OF_TIME);
|
||||
return Fee.create(
|
||||
eapFeeSchedule.getValueAtTime(now).getAmount(),
|
||||
FeeType.EAP,
|
||||
validPeriod,
|
||||
validPeriod.upperEndpoint());
|
||||
}
|
||||
|
||||
public String getLordnUsername() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue