Add extra logic for all relevant flows

This CL enhances various domain flows (check, create, delete, renew, restore, transfer, update) so that they invoke the appropriate methods on the object implementing the TLD's RegistryExtraFlowLogic (if any). TldSpecificLogicProxy is also updated to invoke RegistryExtraFlowLogic proxy (if any) to fetch the appropriate price. The tests use a made-up extra flow logic object which can be attached to a test TLD to make sure that the proper routines are being invoked.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132486734
This commit is contained in:
mountford 2016-09-07 15:23:50 -07:00 committed by Ben McIlwain
parent a6db24c8bb
commit 95cc7ab3d8
46 changed files with 1173 additions and 394 deletions

View file

@ -45,7 +45,9 @@ public abstract class BaseFee extends ImmutableObject {
CREATE("create"),
EAP("Early Access Period, fee expires: %s"),
RENEW("renew"),
RESTORE("restore");
RESTORE("restore"),
UPDATE("update"),
CREDIT("%s credit");
private final String formatString;

View file

@ -21,11 +21,12 @@ import java.math.BigDecimal;
/** A credit, in currency units specified elsewhere in the xml, and with an optional description. */
public class Credit extends BaseFee {
public static Credit create(BigDecimal cost, String description) {
public static Credit create(BigDecimal cost, FeeType type, Object... descriptionArgs) {
Credit instance = new Credit();
instance.cost = checkNotNull(cost);
checkArgument(instance.cost.signum() < 0);
instance.description = description;
instance.type = checkNotNull(type);
instance.generateDescription(descriptionArgs);
return instance;
}
}

View file

@ -14,6 +14,8 @@
package google.registry.model.domain.fee;
import static google.registry.util.CollectionUtils.nullToEmpty;
import google.registry.model.ImmutableObject;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@ -51,6 +53,6 @@ public abstract class FeeTransformCommandExtensionImpl
@Override
public List<Credit> getCredits() {
return credits;
return nullToEmpty(credits);
}
}

View file

@ -14,8 +14,8 @@
package google.registry.model.domain.fee;
import com.google.common.collect.ImmutableList;
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
import java.util.List;
import org.joda.money.CurrencyUnit;
/** Interface for fee extensions in Create, Renew, Transfer and Update responses. */
@ -24,8 +24,8 @@ public interface FeeTransformResponseExtension extends ResponseExtension {
/** Builder for {@link FeeTransformResponseExtension}. */
public interface Builder {
Builder setCurrency(CurrencyUnit currency);
Builder setFees(ImmutableList<Fee> fees);
Builder setCredits(ImmutableList<Credit> credits);
Builder setFees(List<Fee> fees);
Builder setCredits(List<Credit> credits);
FeeTransformResponseExtension build();
}
}

View file

@ -14,7 +14,8 @@
package google.registry.model.domain.fee;
import com.google.common.collect.ImmutableList;
import static google.registry.util.CollectionUtils.forceEmptyToNull;
import google.registry.model.Buildable.GenericBuilder;
import google.registry.model.ImmutableObject;
import java.util.List;
@ -53,14 +54,14 @@ public class FeeTransformResponseExtensionImpl extends ImmutableObject
}
@Override
public B setFees(ImmutableList<Fee> fees) {
public B setFees(List<Fee> fees) {
getInstance().fees = fees;
return thisCastToDerived();
}
@Override
public B setCredits(ImmutableList<Credit> credits) {
getInstance().credits = credits;
public B setCredits(List<Credit> credits) {
getInstance().credits = forceEmptyToNull(credits);
return thisCastToDerived();
}
}

View file

@ -14,7 +14,6 @@
package google.registry.model.domain.fee;
import com.google.common.collect.ImmutableList;
import google.registry.model.Buildable.GenericBuilder;
import google.registry.model.ImmutableObject;
import java.util.List;
@ -54,13 +53,13 @@ public class FeeTransformResponseExtensionImplNoCredits extends ImmutableObject
}
@Override
public B setFees(ImmutableList<Fee> fees) {
public B setFees(List<Fee> fees) {
getInstance().fees = fees;
return thisCastToDerived();
}
@Override
public B setCredits(ImmutableList<Credit> credits) {
public B setCredits(List<Credit> credits) {
return thisCastToDerived();
}
}

View file

@ -30,4 +30,8 @@ import javax.xml.bind.annotation.XmlRootElement;
public class FlagsCreateCommandExtension implements CommandExtension {
@XmlElement(name = "flag")
List<String> flags;
public List<String> getFlags() {
return flags;
}
}

View file

@ -30,4 +30,12 @@ import javax.xml.bind.annotation.XmlType;
public class FlagsTransferCommandExtension implements CommandExtension {
FlagsList add; // list of flags to be added (turned on)
FlagsList rem; // list of flags to be removed (turned off)
public FlagsList getAddFlags() {
return add;
}
public FlagsList getRemoveFlags() {
return rem;
}
}