mirror of
https://github.com/google/nomulus.git
synced 2025-07-22 10:46:10 +02:00
Remove the unused flags extension
It can always be brought back if we find an actual use case for it, but for now, it shouldn't be in the standard distribution given that it has no users. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143044153
This commit is contained in:
parent
be523f7ce2
commit
6fb9858198
57 changed files with 6 additions and 1391 deletions
|
@ -14,24 +14,16 @@
|
|||
|
||||
package google.registry.flows.custom;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.flows.domain.DomainPricingLogic;
|
||||
import google.registry.flows.domain.FeesAndCredits;
|
||||
import google.registry.model.domain.fee.BaseFee;
|
||||
import google.registry.model.domain.fee.BaseFee.FeeType;
|
||||
import google.registry.model.domain.fee.Credit;
|
||||
import google.registry.model.domain.fee.Fee;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
import org.joda.money.Money;
|
||||
|
||||
|
@ -44,27 +36,6 @@ public class TestDomainPricingCustomLogic extends DomainPricingCustomLogic {
|
|||
super(eppInput, sessionMetadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeesAndCredits customizeCreatePrice(CreatePriceParameters priceParameters)
|
||||
throws EppException {
|
||||
InternetDomainName domainName = priceParameters.domainName();
|
||||
if (domainName.parent().toString().equals("flags")) {
|
||||
FeesAndCredits feesAndCredits = priceParameters.feesAndCredits();
|
||||
FeesAndCredits.Builder feesBuilder =
|
||||
new FeesAndCredits.Builder().setCurrency(feesAndCredits.getCurrency());
|
||||
ImmutableList.Builder<BaseFee> baseFeeBuilder = new ImmutableList.Builder<>();
|
||||
baseFeeBuilder.addAll(feesAndCredits.getCredits());
|
||||
for (BaseFee fee : feesAndCredits.getFees()) {
|
||||
baseFeeBuilder.add(
|
||||
fee.getType() == FeeType.CREATE ? domainNameToFeeOrCredit(domainName) : fee);
|
||||
feesBuilder.setFeeExtensionRequired(true);
|
||||
}
|
||||
return feesBuilder.setFeesAndCredits(baseFeeBuilder.build()).build();
|
||||
} else {
|
||||
return priceParameters.feesAndCredits();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeesAndCredits customizeApplicationUpdatePrice(
|
||||
ApplicationUpdatePriceParameters priceParameters) throws EppException {
|
||||
|
@ -110,25 +81,4 @@ public class TestDomainPricingCustomLogic extends DomainPricingCustomLogic {
|
|||
.addFeeOrCredit(customFee)
|
||||
.build();
|
||||
}
|
||||
|
||||
private static BaseFee domainNameToFeeOrCredit(InternetDomainName domainName) {
|
||||
// The second-level domain should be of the form "description-price", where description is the
|
||||
// description string of the fee or credit, and price is the price (credit if negative, fee
|
||||
// otherwise). To make sure this is a valid domain name, don't use any spaces, and limit prices
|
||||
// to integers. Don't use a two-character description for credits, since it is illegal to have
|
||||
// both the third and fourth characters of a domain name label be hyphens.
|
||||
List<String> components =
|
||||
Splitter.on('-')
|
||||
.limit(2)
|
||||
.splitToList(Iterables.getFirst(Splitter.on('.').split(domainName.toString()), ""));
|
||||
checkArgument(components.size() == 2, "Domain name must be of the form description-price.tld");
|
||||
int price = Integer.parseInt(components.get(1));
|
||||
if (price < 0) {
|
||||
return Credit.create(
|
||||
new BigDecimal(price), FeeType.valueOf(Ascii.toUpperCase(components.get(0))));
|
||||
} else {
|
||||
return Fee.create(
|
||||
new BigDecimal(price), FeeType.valueOf(Ascii.toUpperCase(components.get(0))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue