Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import java.util.Locale;
import java.util.Optional;
Expand All @@ -32,12 +31,13 @@
* <pre>{@code
* <fee:command name="renew" phase="sunrise" subphase="hello">
* <fee:period unit="y">1</fee:period>
* <fee:class>premium</fee:class>
* <fee:date>2017-05-17T13:22:21.0Z</fee:date>
* </fee:command>
* }</pre>
*
* <p>The `feeClass` and `feeDate` attributes that are present in version 0.12 are removed from this
* version.
*/
@XmlType(propOrder = {"period", "feeClass", "feeDate"})
@XmlType(propOrder = {"period"})
public class FeeCheckCommandExtensionItemStdV1 extends FeeCheckCommandExtensionItem {

/** The default validity period (if not specified) is 1 year for all operations. */
Expand All @@ -50,12 +50,6 @@ public class FeeCheckCommandExtensionItemStdV1 extends FeeCheckCommandExtensionI

@XmlAttribute String subphase;

@XmlElement(name = "class")
String feeClass;

@XmlElement(name = "date")
DateTime feeDate;

/** Version 1.0 does not support domain name or currency in fee extension items. */
@Override
public boolean isDomainNameSupported() {
Expand Down Expand Up @@ -107,6 +101,6 @@ public FeeCheckResponseExtensionItemStdV1.Builder createResponseBuilder() {

@Override
public Optional<DateTime> getEffectiveDate() {
return Optional.ofNullable(feeDate);
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public FeeCheckResponseExtensionStdV1 createResponse(
}

/** Domains across multiple currencies cannot be checked simultaneously. */
static class MultipleCurrenciesCannotBeCheckedException
public static class MultipleCurrenciesCannotBeCheckedException
extends ParameterValuePolicyErrorException {
public MultipleCurrenciesCannotBeCheckedException() {
// The fee extension 1.0 only supports one currency shared across all results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@
import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import java.util.List;
import org.joda.time.DateTime;

/** The version 1.0 response command entity for a domain check on a single resource. */
@XmlType(propOrder = {"period", "fee", "effectiveDate", "notAfterDate"})
@XmlType(propOrder = {"period", "fee"})
public class FeeCheckResponseExtensionItemCommandStdV1 extends ImmutableObject {

/** The command that was checked. */
Expand All @@ -53,14 +51,6 @@ public class FeeCheckResponseExtensionItemCommandStdV1 extends ImmutableObject {
*/
List<Fee> fee;

/** The effective date that the check is to be performed on (if specified in the query). */
@XmlElement(name = "date")
DateTime effectiveDate;

/** The date after which the quoted fee is no longer valid (if applicable). */
@XmlElement(name = "notAfter")
DateTime notAfterDate;

/** Builder for {@link FeeCheckResponseExtensionItemCommandStdV1}. */
public static class Builder extends Buildable.Builder<FeeCheckResponseExtensionItemCommandStdV1> {

Expand All @@ -84,16 +74,6 @@ public Builder setPeriod(Period period) {
return this;
}

public Builder setEffectiveDate(DateTime effectiveDate) {
getInstance().effectiveDate = effectiveDate;
return this;
}

public Builder setNotAfterDate(DateTime notAfterDate) {
getInstance().notAfterDate = notAfterDate;
return this;
}

public Builder setFee(List<Fee> fees) {
getInstance().fee = forceEmptyToNull(ImmutableList.copyOf(fees));
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@
import static google.registry.util.CollectionUtils.forceEmptyToNull;

import com.google.common.collect.ImmutableList;
import google.registry.model.domain.DomainObjectSpec;
import google.registry.model.domain.Period;
import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import jakarta.xml.bind.annotation.XmlType;
import org.joda.time.DateTime;

/** The version 1.0 response for a domain check on a single resource. */
@XmlType(propOrder = {"object", "feeClass", "command"})
@XmlType(propOrder = {"objID", "feeClass", "command"})
public class FeeCheckResponseExtensionItemStdV1 extends FeeCheckResponseExtensionItem {

/** The domain that was checked. */
DomainObjectSpec object;
String objID;

/** The command that was checked. */
FeeCheckResponseExtensionItemCommandStdV1 command;
Expand Down Expand Up @@ -88,7 +86,7 @@ public Builder setClass(String feeClass) {

@Override
public Builder setDomainNameIfSupported(String name) {
getInstance().object = new DomainObjectSpec(name);
getInstance().objID = name;
return this;
}

Expand All @@ -97,17 +95,5 @@ public FeeCheckResponseExtensionItemStdV1 build() {
getInstance().command = commandBuilder.build();
return super.build();
}

@Override
public Builder setEffectiveDateIfSupported(DateTime effectiveDate) {
commandBuilder.setEffectiveDate(effectiveDate);
return this;
}

@Override
public Builder setNotAfterDateIfSupported(DateTime notAfterDate) {
commandBuilder.setNotAfterDate(notAfterDate);
return this;
}
}
}
141 changes: 63 additions & 78 deletions core/src/main/java/google/registry/xml/xsd/fee-std-v1.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<element name="renew" type="fee:transformCommandType" />
<element name="renData" type="fee:transformResultType" />
<element name="transfer" type="fee:transformCommandType" />
<element name="trnData" type="fee:transferResultType" />
<element name="trnData" type="fee:transformResultType" />
<element name="update" type="fee:transformCommandType" />
<element name="updData" type="fee:transformResultType" />
<element name="delData" type="fee:transformResultType" />
Expand All @@ -33,78 +33,38 @@
<sequence>
<element name="currency" type="fee:currencyType"
minOccurs="0" />
<element name="command" type="fee:commandCheckType"
maxOccurs="unbounded" />
<element name="command" type="fee:commandType"
minOccurs="1" maxOccurs="unbounded" />
</sequence>
</complexType>

<complexType name="commandCheckType">
<sequence>
<element name="period"
type="domain:periodType"
minOccurs="0" />
<element name="class"
type="token"
minOccurs="0" />
<element name="date"
type="dateTime"
minOccurs="0" />
</sequence>
<attribute name="name" type="fee:commandTypeValue" />
<attribute name="phase" type="token" />
<attribute name="subphase" type="token" />
<complexType name="objectIdentifierType">
<simpleContent>
<extension base="eppcom:labelType">
<attribute name="element"
type="NMTOKEN" default="name" />
</extension>
</simpleContent>
</complexType>

<!-- server <check> result -->
<complexType name="chkDataType">
<sequence>
<element name="currency" type="fee:currencyType" minOccurs="0"/>
<element name="currency" type="fee:currencyType" />
<element name="cd" type="fee:objectCDType"
maxOccurs="unbounded" />
</sequence>
</complexType>

<complexType name="objectCDType">
<sequence>
<element name="object">
<complexType>
<sequence>
<any namespace="##other" processContents="lax"/>
</sequence>
</complexType>
</element>
<element name="objID" type="fee:objectIdentifierType" />
<element name="class" type="token" minOccurs="0" />
<element name="command"
type="fee:commandCDType"
maxOccurs="unbounded" />
</sequence>
</complexType>

<complexType name="commandCDType">
<sequence>
<element name="period"
type="domain:periodType"
minOccurs="0" maxOccurs="1" />
<element name="fee"
type="fee:feeType"
minOccurs="0" maxOccurs="unbounded" />
<element name="credit"
type="fee:creditType"
<element name="command" type="fee:commandDataType"
minOccurs="0" maxOccurs="unbounded" />
<element name="reason"
type="token"
minOccurs="0" />
<element name="date"
type="dateTime"
minOccurs="0" />
<element name="notAfter"
type="dateTime"
minOccurs="0" />
<element name="reason" type="fee:reasonType" minOccurs="0" />
</sequence>
<attribute name="avail" type="boolean" default="1" />
<attribute name="name" type="fee:commandTypeValue" />
<attribute name="phase" type="token" />
<attribute name="subphase" type="token" />
</complexType>

<!-- general transform (create, renew, update, transfer) command-->
Expand All @@ -119,32 +79,15 @@
</sequence>
</complexType>

<!-- general transform (create, renew, update, delete) result -->
<!-- general transform (create, renew, update) result -->
<complexType name="transformResultType">
<sequence>
<element name="currency" type="fee:currencyType" />
<element name="fee" type="fee:feeType"
minOccurs="0" maxOccurs="unbounded" />
<element name="credit" type="fee:creditType"
minOccurs="0" maxOccurs="unbounded" />
<element name="balance" type="fee:balanceType"
minOccurs="0" />
<element name="creditLimit" type="fee:creditLimitType"
<element name="currency" type="fee:currencyType"
minOccurs="0" />
</sequence>
</complexType>

<!-- transfer result -->
<complexType name="transferResultType">
<sequence>
<element name="currency" type="fee:currencyType" />

<!-- only used op="query" responses -->
<element name="period" type="domain:periodType"
minOccurs="0" />

<element name="fee" type="fee:feeType"
maxOccurs="unbounded" />
minOccurs="0" maxOccurs="unbounded" />
<element name="credit" type="fee:creditType"
minOccurs="0" maxOccurs="unbounded" />
<element name="balance" type="fee:balanceType"
Expand All @@ -161,10 +104,50 @@
</restriction>
</simpleType>

<simpleType name="commandTypeValue">
<complexType name="commandType">
<sequence>
<element name="period" type="domain:periodType"
minOccurs="0" maxOccurs="1" />
</sequence>
<attribute name="name" type="fee:commandEnum" use="required"/>
<attribute name="customName" type="token"/>
<attribute name="phase" type="token" />
<attribute name="subphase" type="token" />
</complexType>

<complexType name="commandDataType">
<complexContent>
<extension base="fee:commandType">
<sequence>
<element name="fee" type="fee:feeType"
minOccurs="0" maxOccurs="unbounded" />
<element name="credit" type="fee:creditType"
minOccurs="0" maxOccurs="unbounded" />
<element name="reason" type="fee:reasonType"
minOccurs="0" />
</sequence>
<attribute name="standard" type="boolean" default="0" />
</extension>
</complexContent>
</complexType>

<complexType name="reasonType">
<simpleContent>
<extension base="token">
<attribute name="lang" type="language" default="en"/>
</extension>
</simpleContent>
</complexType>

<simpleType name="commandEnum">
<restriction base="token">
<minLength value="3"/>
<maxLength value="16"/>
<enumeration value="create"/>
<enumeration value="delete"/>
<enumeration value="renew"/>
<enumeration value="update"/>
<enumeration value="transfer"/>
<enumeration value="restore"/>
<enumeration value="custom"/>
</restriction>
</simpleType>

Expand All @@ -184,9 +167,10 @@
<simpleContent>
<extension base="fee:nonNegativeDecimal">
<attribute name="description"/>
<attribute name="lang" type="language" default="en"/>
<attribute name="refundable" type="boolean" />
<attribute name="grace-period" type="duration" />
<attribute name="applied" default="immediate">
<attribute name="applied">
<simpleType>
<restriction base="token">
<enumeration value="immediate" />
Expand All @@ -202,6 +186,7 @@
<simpleContent>
<extension base="fee:negativeDecimal">
<attribute name="description"/>
<attribute name="lang" type="language" default="en"/>
</extension>
</simpleContent>
</complexType>
Expand Down
3 changes: 3 additions & 0 deletions core/src/test/java/google/registry/flows/FlowTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import google.registry.flows.picker.FlowPicker;
import google.registry.model.billing.BillingBase;
import google.registry.model.domain.GracePeriod;
import google.registry.model.eppcommon.EppXmlTransformer;
import google.registry.model.eppcommon.ProtocolDefinition;
import google.registry.model.eppinput.EppInput;
import google.registry.model.eppoutput.EppOutput;
Expand Down Expand Up @@ -289,6 +290,8 @@ public EppOutput runFlowAssertResponse(
if (output.isResponse()) {
assertThat(output.isSuccess()).isTrue();
}
// Verify that expected xml is syntatically correct.
EppXmlTransformer.validateOutput(xml);
try {
assertXmlEquals(
xml, new String(marshal(output, ValidationMode.STRICT), UTF_8), ignoredPathsPlusTrid);
Expand Down
Loading
Loading