mirror of
https://github.com/google/nomulus.git
synced 2025-07-13 06:28:15 +02: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:
parent
2dd703ef3a
commit
8256120b3a
66 changed files with 786 additions and 954 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue