mirror of
https://github.com/google/nomulus
synced 2026-08-19 13:46:13 +00:00
Create a separate billing event when EAP is applied
When EAP is involed we current have one billing event for domain create that has the create fee and EAP fee lumped together. Change it to record two separate billing events for each. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=132335349
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
package google.registry.model.domain.fee;
|
||||
|
||||
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.xml.PeriodAdapter;
|
||||
@@ -38,6 +39,24 @@ public abstract class BaseFee extends ImmutableObject {
|
||||
@XmlEnumValue("delayed")
|
||||
DELAYED
|
||||
}
|
||||
|
||||
/** Enum for the type of the fee. */
|
||||
public enum FeeType {
|
||||
CREATE("create"),
|
||||
EAP("Early Access Period, fee expires: %s"),
|
||||
RENEW("renew"),
|
||||
RESTORE("restore");
|
||||
|
||||
private final String formatString;
|
||||
|
||||
FeeType(String formatString) {
|
||||
this.formatString = formatString;
|
||||
}
|
||||
|
||||
String renderDescription(Object... args) {
|
||||
return String.format(formatString, args);
|
||||
}
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
String description;
|
||||
@@ -54,6 +73,9 @@ public abstract class BaseFee extends ImmutableObject {
|
||||
|
||||
@XmlValue
|
||||
BigDecimal cost;
|
||||
|
||||
@XmlTransient
|
||||
FeeType type;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
@@ -81,6 +103,15 @@ public abstract class BaseFee extends ImmutableObject {
|
||||
public BigDecimal getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public FeeType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
protected void generateDescription(Object... args) {
|
||||
checkState(type != null);
|
||||
description = type.renderDescription(args);
|
||||
}
|
||||
|
||||
public boolean hasDefaultAttributes() {
|
||||
return getGracePeriod().equals(Period.ZERO)
|
||||
|
||||
Reference in New Issue
Block a user