mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 16:37:13 +02:00
Restrict domain transfer pricing to 1 year
This CL restricts domain transfer pricing lookups (on domain check and info) to only support a 1-year period for inquiring about transfer fees. That treatment matches what we do for domain restores, which are also always one year. This is a followup to [] which disallowed actual transfer request flows from specifying multi-year periods. Since it's no longer necessary, this CL also changes the domain transfer pricing logic to drop the years parameter, including removing the parameter from the custom pricing logic TransferPriceParameters object. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=150367839
This commit is contained in:
parent
8b37620af1
commit
70fbdccea2
15 changed files with 133 additions and 18 deletions
|
@ -229,8 +229,6 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
|||
|
||||
public abstract DateTime asOfDate();
|
||||
|
||||
public abstract int years();
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainPricingCustomLogic_TransferPriceParameters.Builder();
|
||||
}
|
||||
|
@ -247,8 +245,6 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
|||
|
||||
public abstract Builder setAsOfDate(DateTime asOfDate);
|
||||
|
||||
public abstract Builder setYears(int years);
|
||||
|
||||
public abstract TransferPriceParameters build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ import org.joda.time.DateTime;
|
|||
* @error {@link DomainFlowUtils.RestoresAreAlwaysForOneYearException}
|
||||
* @error {@link DomainFlowUtils.TldDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.TrailingDashException}
|
||||
* @error {@link DomainFlowUtils.TransfersAreAlwaysForOneYearException}
|
||||
* @error {@link DomainFlowUtils.UnknownFeeCommandException}
|
||||
* @error {@link OnlyCheckedNamesCanBeFeeCheckedException}
|
||||
*/
|
||||
|
|
|
@ -540,8 +540,11 @@ public class DomainFlowUtils {
|
|||
fees = pricingLogic.getRestorePrice(registry, domainNameString, now).getFees();
|
||||
break;
|
||||
case TRANSFER:
|
||||
if (years != 1) {
|
||||
throw new TransfersAreAlwaysForOneYearException();
|
||||
}
|
||||
builder.setAvailIfSupported(true);
|
||||
fees = pricingLogic.getTransferPrice(registry, domainNameString, now, years).getFees();
|
||||
fees = pricingLogic.getTransferPrice(registry, domainNameString, now).getFees();
|
||||
break;
|
||||
case UPDATE:
|
||||
builder.setAvailIfSupported(true);
|
||||
|
@ -1113,6 +1116,13 @@ public class DomainFlowUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/** Transfers always renew a domain for one year. */
|
||||
static class TransfersAreAlwaysForOneYearException extends ParameterValuePolicyErrorException {
|
||||
TransfersAreAlwaysForOneYearException() {
|
||||
super("Transfers always renew a domain for one year");
|
||||
}
|
||||
}
|
||||
|
||||
/** Requested domain is reserved. */
|
||||
static class DomainReservedException extends StatusProhibitsOperationException {
|
||||
public DomainReservedException(String domainName) {
|
||||
|
|
|
@ -66,6 +66,7 @@ import org.joda.time.DateTime;
|
|||
* @error {@link DomainFlowUtils.CurrencyUnitMismatchException}
|
||||
* @error {@link DomainFlowUtils.FeeChecksDontSupportPhasesException}
|
||||
* @error {@link DomainFlowUtils.RestoresAreAlwaysForOneYearException}
|
||||
* @error {@link DomainFlowUtils.TransfersAreAlwaysForOneYearException}
|
||||
*/
|
||||
public final class DomainInfoFlow implements Flow {
|
||||
|
||||
|
|
|
@ -110,7 +110,6 @@ public final class DomainPricingLogic {
|
|||
}
|
||||
|
||||
/** Returns a new restore price for the pricer. */
|
||||
@SuppressWarnings("unused")
|
||||
public FeesAndCredits getRestorePrice(Registry registry, String domainName, DateTime date)
|
||||
throws EppException {
|
||||
FeesAndCredits feesAndCredits =
|
||||
|
@ -131,13 +130,9 @@ public final class DomainPricingLogic {
|
|||
}
|
||||
|
||||
/** Returns a new transfer price for the pricer. */
|
||||
public FeesAndCredits getTransferPrice(
|
||||
Registry registry,
|
||||
String domainName,
|
||||
DateTime transferDate,
|
||||
int years)
|
||||
public FeesAndCredits getTransferPrice(Registry registry, String domainName, DateTime date)
|
||||
throws EppException {
|
||||
Money renewCost = getDomainRenewCost(domainName, transferDate, years);
|
||||
Money renewCost = getDomainRenewCost(domainName, date, 1);
|
||||
return customLogic.customizeTransferPrice(
|
||||
TransferPriceParameters.newBuilder()
|
||||
.setFeesAndCredits(
|
||||
|
@ -147,8 +142,7 @@ public final class DomainPricingLogic {
|
|||
.build())
|
||||
.setRegistry(registry)
|
||||
.setDomainName(InternetDomainName.from(domainName))
|
||||
.setAsOfDate(transferDate)
|
||||
.setYears(years)
|
||||
.setAsOfDate(date)
|
||||
.build());
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
// An optional extension from the client specifying what they think the transfer should cost.
|
||||
FeeTransferCommandExtension feeTransfer =
|
||||
eppInput.getSingleExtension(FeeTransferCommandExtension.class);
|
||||
FeesAndCredits feesAndCredits = pricingLogic.getTransferPrice(registry, targetId, now, years);
|
||||
FeesAndCredits feesAndCredits = pricingLogic.getTransferPrice(registry, targetId, now);
|
||||
validateFeeChallenge(targetId, tld, now, feeTransfer, feesAndCredits);
|
||||
HistoryEntry historyEntry = buildHistory(period, existingDomain, now);
|
||||
DateTime automaticTransferTime = now.plus(registry.getAutomaticTransferLength());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue