Add extra flow logic hooks for application delete and update

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138393251
This commit is contained in:
mountford 2016-08-16 08:20:48 -04:00 committed by Ben McIlwain
parent cef07f6bc5
commit baaaacd4f5
10 changed files with 234 additions and 33 deletions

View file

@ -30,6 +30,7 @@ import com.googlecode.objectify.Key;
import google.registry.flows.EppException;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.domain.fee.BaseFee;
@ -259,6 +260,29 @@ public final class TldSpecificLogicProxy {
return new EppCommandOperations(currency, feeOrCredit);
}
/** Returns a new domain application update price for the pricer. */
public static EppCommandOperations getApplicationUpdatePrice(
Registry registry,
DomainApplication application,
String clientId,
DateTime date,
EppInput eppInput) throws EppException {
CurrencyUnit currency = registry.getCurrency();
// If there is extra flow logic, it may specify an update price. Otherwise, there is none.
BaseFee feeOrCredit;
Optional<RegistryExtraFlowLogic> extraFlowLogic =
RegistryExtraFlowLogicProxy.newInstanceForTld(registry.getTldStr());
if (extraFlowLogic.isPresent()) {
feeOrCredit = extraFlowLogic.get()
.getApplicationUpdateFeeOrCredit(application, clientId, date, eppInput);
} else {
feeOrCredit = Fee.create(Money.zero(registry.getCurrency()).getAmount(), FeeType.UPDATE);
}
return new EppCommandOperations(currency, feeOrCredit);
}
/** Returns the fee class for a given domain and date. */
public static Optional<String> getFeeClass(String domainName, DateTime date) {
return getDomainFeeClass(domainName, date);