mirror of
https://github.com/google/nomulus
synced 2026-02-03 19:42:39 +00:00
Simplify the fee extensions.
I added shared base classes to all of the Fee extension types that make it possible to fully ignore the version in the flows. (You ask for a FeeCreateCommandExtension, for example, and you get one without having to worry about which). This is an improvement over the old code that asked you to provide a list of possible fee extensions and then ask for the first one in preference order. As part of this I was able to make the Fee implementation a bit simpler as well. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=137992390
This commit is contained in:
@@ -14,14 +14,41 @@
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** Interface for fee extensions in Create, Renew, Transfer and Update commands. */
|
||||
public interface FeeTransformCommandExtension extends CommandExtension {
|
||||
CurrencyUnit getCurrency();
|
||||
List<Fee> getFees();
|
||||
List<Credit> getCredits();
|
||||
FeeTransformResponseExtension.Builder createResponseBuilder();
|
||||
/** Base class for general transform commands with fees (create, renew, update, transfer). */
|
||||
@XmlTransient
|
||||
public abstract class FeeTransformCommandExtension
|
||||
extends ImmutableObject implements CommandExtension {
|
||||
|
||||
/** The currency of the fee. */
|
||||
CurrencyUnit currency;
|
||||
|
||||
/**
|
||||
* The magnitude of the fee, in the specified units, with an optional description.
|
||||
*
|
||||
* <p>This is a list because a single operation can involve multiple fees.
|
||||
*/
|
||||
@XmlElement(name = "fee")
|
||||
List<Fee> fees;
|
||||
|
||||
public CurrencyUnit getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public ImmutableList<Fee> getFees() {
|
||||
return nullToEmptyImmutableCopy(fees);
|
||||
}
|
||||
|
||||
public abstract ImmutableList<Credit> getCredits();
|
||||
|
||||
public abstract FeeTransformResponseExtension.Builder createResponseBuilder();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user