mirror of
https://github.com/google/nomulus
synced 2026-09-03 14:46:59 +00:00
Add discount price param to GenerateAllocationTokens command (#2578)
* Add discount price param to GenerateAlloCationTokens command * add discount price param to UpdateAllocationTokens command
This commit is contained in:
@@ -47,6 +47,7 @@ import google.registry.model.domain.token.AllocationToken.RegistrationBehavior;
|
||||
import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
||||
import google.registry.model.domain.token.AllocationToken.TokenType;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.tools.params.MoneyParameter;
|
||||
import google.registry.tools.params.TransitionListParameter.TokenStatusTransitions;
|
||||
import google.registry.util.CollectionUtils;
|
||||
import google.registry.util.DomainNameUtils;
|
||||
@@ -140,6 +141,17 @@ class GenerateAllocationTokensCommand implements Command {
|
||||
arity = 1)
|
||||
private Boolean discountPremiums;
|
||||
|
||||
@Parameter(
|
||||
names = {"--discount_price"},
|
||||
description =
|
||||
"A discount that allows the setting of promotional prices. This field is different from "
|
||||
+ "{@code discountFraction} because the price set here is treated as the domain "
|
||||
+ "price, versus {@code discountFraction} that applies a fraction discount to the "
|
||||
+ "domain base price. Use CURRENCY PRICE format, example: USD 777.99",
|
||||
converter = MoneyParameter.class,
|
||||
validateWith = MoneyParameter.class)
|
||||
private Money discountPrice;
|
||||
|
||||
@Parameter(
|
||||
names = {"--discount_years"},
|
||||
description = "The number of years the discount applies for. Default is 1, max value is 10.")
|
||||
@@ -233,6 +245,7 @@ class GenerateAllocationTokensCommand implements Command {
|
||||
.collect(toImmutableSet()));
|
||||
Optional.ofNullable(discountFraction).ifPresent(token::setDiscountFraction);
|
||||
Optional.ofNullable(discountPremiums).ifPresent(token::setDiscountPremiums);
|
||||
Optional.ofNullable(discountPrice).ifPresent(token::setDiscountPrice);
|
||||
Optional.ofNullable(discountYears).ifPresent(token::setDiscountYears);
|
||||
Optional.ofNullable(tokenStatusTransitions)
|
||||
.ifPresent(token::setTokenStatusTransitions);
|
||||
|
||||
@@ -34,6 +34,7 @@ import google.registry.model.domain.token.AllocationToken;
|
||||
import google.registry.model.domain.token.AllocationToken.RegistrationBehavior;
|
||||
import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
||||
import google.registry.model.domain.token.AllocationToken.TokenType;
|
||||
import google.registry.tools.params.MoneyParameter;
|
||||
import google.registry.tools.params.StringListParameter;
|
||||
import google.registry.tools.params.TransitionListParameter.TokenStatusTransitions;
|
||||
import java.util.List;
|
||||
@@ -91,6 +92,17 @@ final class UpdateAllocationTokensCommand extends UpdateOrDeleteAllocationTokens
|
||||
arity = 1)
|
||||
private Boolean discountPremiums;
|
||||
|
||||
@Parameter(
|
||||
names = {"--discount_price"},
|
||||
description =
|
||||
"A discount that allows the setting of promotional prices. This field is different from "
|
||||
+ "{@code discountFraction} because the price set here is treated as the domain "
|
||||
+ "price, versus {@code discountFraction} that applies a fraction discount to the "
|
||||
+ "domain base price. Use CURRENCY PRICE format, example: USD 777.99",
|
||||
converter = MoneyParameter.class,
|
||||
validateWith = MoneyParameter.class)
|
||||
private Money discountPrice;
|
||||
|
||||
@Parameter(
|
||||
names = {"-y", "--discount_years"},
|
||||
description = "The number of years the discount applies for. Default is 1, max value is 10.")
|
||||
@@ -203,6 +215,7 @@ final class UpdateAllocationTokensCommand extends UpdateOrDeleteAllocationTokens
|
||||
.collect(toImmutableSet())));
|
||||
Optional.ofNullable(discountFraction).ifPresent(builder::setDiscountFraction);
|
||||
Optional.ofNullable(discountPremiums).ifPresent(builder::setDiscountPremiums);
|
||||
Optional.ofNullable(discountPrice).ifPresent(builder::setDiscountPrice);
|
||||
Optional.ofNullable(discountYears).ifPresent(builder::setDiscountYears);
|
||||
Optional.ofNullable(tokenStatusTransitions).ifPresent(builder::setTokenStatusTransitions);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user