mirror of
https://github.com/google/nomulus
synced 2026-01-07 22:15:30 +00:00
Improve BaseFee class and its children
Checks are added to ensure that fees are always non-negative, while credits are always negative, as required by the EPP fee extension specification. Also, BaseFee is made specifically abstract. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=131620110
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -23,6 +24,7 @@ public class Credit extends BaseFee {
|
||||
public static Credit create(BigDecimal cost, String description) {
|
||||
Credit instance = new Credit();
|
||||
instance.cost = checkNotNull(cost);
|
||||
checkArgument(instance.cost.signum() < 0);
|
||||
instance.description = description;
|
||||
return instance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user