Deny non-active registrars access to non-free EPP commands

Registrars that are PENDING or SUSPENDED should not have access to
EPP commands that cost money, as in either case it's not likely we'd
actually be able to get payment from said registrar. For this reason
we already prevented access to the domain create flow for non-active
registrars. This commit extends that to other commands that cost
money, including renewals, restores, and transfer requests.

Note that implicit autorenews will still occur for suspended
registrars, as in our point-in-time data model there's no good way
to prevent them. So when a registrar is suspended for non-payment,
the game plan is to get all of their domains transferred out to a
registrar that will pay as soon as possible.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=223173677
This commit is contained in:
mcilwain 2018-11-28 08:41:05 -08:00 committed by jianglai
parent dbdc69916a
commit 11da64bee2
13 changed files with 172 additions and 15 deletions

View file

@ -892,13 +892,14 @@ public class DomainFlowUtils {
/**
* Check that the registrar with the given client ID is active.
*
* <p>Non-active registrars are not allowed to create domain applications or domain resources.
* <p>Non-active registrars are not allowed to run operations that cost money, like domain creates
* or renews.
*/
static void verifyRegistrarIsActive(String clientId)
throws RegistrarMustBeActiveToCreateDomainsException {
throws RegistrarMustBeActiveForThisOperationException {
Registrar registrar = Registrar.loadByClientIdCached(clientId).get();
if (registrar.getState() != State.ACTIVE) {
throw new RegistrarMustBeActiveToCreateDomainsException();
throw new RegistrarMustBeActiveForThisOperationException();
}
}
@ -1606,10 +1607,10 @@ public class DomainFlowUtils {
}
}
/** Registrar must be active in order to create domains or applications. */
static class RegistrarMustBeActiveToCreateDomainsException extends AuthorizationErrorException {
public RegistrarMustBeActiveToCreateDomainsException() {
super("Registrar must be active in order to create domains or applications");
/** Registrar must be active in order to perform this operation. */
static class RegistrarMustBeActiveForThisOperationException extends AuthorizationErrorException {
public RegistrarMustBeActiveForThisOperationException() {
super("Registrar must be active in order to perform this operation");
}
}
}