Skip to content

Commit 5603b91

Browse files
authored
Make nomulus update_recurrence command only fail on pending transfers (#2605)
It was failing when any kind of transfer data was present, even completed transfer data. Note that completed transfer data persists on a domain indefinitely until/unless a new transfer is requested. BUG= http://b/377328244
1 parent 332f491 commit 5603b91

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

core/src/main/java/google/registry/tools/UpdateRecurrenceCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import google.registry.model.domain.DomainHistory;
3131
import google.registry.model.reporting.HistoryEntry;
3232
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
33+
import google.registry.model.transfer.TransferStatus;
3334
import java.util.List;
3435
import java.util.Optional;
3536
import javax.annotation.Nullable;
@@ -174,7 +175,8 @@ private ImmutableMap<Domain, BillingRecurrence> loadDomainsAndRecurrences() {
174175
"Domain %s has already had a deletion time set",
175176
domainName);
176177
checkArgument(
177-
domain.getTransferData().isEmpty(),
178+
domain.getTransferData().isEmpty()
179+
|| domain.getTransferData().getTransferStatus() != TransferStatus.PENDING,
178180
"Domain %s has a pending transfer: %s",
179181
domainName,
180182
domain.getTransferData());

core/src/test/java/google/registry/tools/UpdateRecurrenceCommandTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import google.registry.model.domain.Domain;
3434
import google.registry.model.domain.DomainHistory;
3535
import google.registry.model.reporting.HistoryEntry;
36+
import google.registry.model.transfer.DomainTransferData;
37+
import google.registry.model.transfer.TransferStatus;
3638
import java.util.Optional;
3739
import javax.annotation.Nullable;
3840
import org.joda.money.CurrencyUnit;
@@ -121,6 +123,25 @@ void testSuccess_setsPrice_whenSpecifiedAlready() throws Exception {
121123
Money.of(CurrencyUnit.USD, 9001));
122124
}
123125

126+
@Test
127+
void testSuccess_completedTransfer() throws Exception {
128+
Domain domain = persistDomain();
129+
domain =
130+
persistResource(
131+
domain
132+
.asBuilder()
133+
.setTransferData(
134+
new DomainTransferData.Builder()
135+
.setTransferStatus(TransferStatus.CLIENT_APPROVED)
136+
.setPendingTransferExpirationTime(fakeClock.nowUtc().minusDays(8))
137+
.build())
138+
.build());
139+
BillingRecurrence billingRecurrence = loadByKey(domain.getAutorenewBillingEvent());
140+
runCommandForced("domain.tld", "--renewal_price_behavior", "NONPREMIUM");
141+
assertNewBillingEventAndHistory(
142+
billingRecurrence.getId(), RenewalPriceBehavior.NONPREMIUM, null);
143+
}
144+
124145
@Test
125146
void testFailure_nonexistentDomain() {
126147
assertThrows(

0 commit comments

Comments
 (0)