mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Validate EAP currency in Registry build
Verify that the currency of all entries in the EAP fee schedule map matches that of the registry object itself. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=124967612
This commit is contained in:
parent
ec39f15a23
commit
5a4877805b
3 changed files with 30 additions and 8 deletions
|
@ -30,6 +30,7 @@ import com.beust.jcommander.Parameters;
|
|||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.registry.Registry.TldState;
|
||||
|
||||
import org.joda.money.CurrencyUnit;
|
||||
import org.joda.money.Money;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -73,9 +74,17 @@ class CreateTldCommand extends CreateOrUpdateTldCommand {
|
|||
void setCommandSpecificProperties(Registry.Builder builder) {
|
||||
// Pick up the currency from the create cost. Since all costs must be in one currency, and that
|
||||
// condition is enforced by the builder, it doesn't matter which cost we choose it from.
|
||||
builder.setCurrency(createBillingCost != null
|
||||
CurrencyUnit currency = createBillingCost != null
|
||||
? createBillingCost.getCurrencyUnit()
|
||||
: Registry.DEFAULT_CURRENCY);
|
||||
: Registry.DEFAULT_CURRENCY;
|
||||
|
||||
builder.setCurrency(currency);
|
||||
|
||||
// If this is a non-default currency, set the EAP fee schedule to a matching currency.
|
||||
// TODO(b/29089413): once we have a flag for this, don't do this check if the flag is set.
|
||||
if (currency != Registry.DEFAULT_CURRENCY) {
|
||||
builder.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(currency)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue