mirror of
https://github.com/google/nomulus
synced 2026-09-20 23:14:44 +00:00
Record transaction for domain adds, renews and allocates
This is the second of many cls adding explicit logging in all our domain mutation flows to facilitate transaction reporting. Adds and renews each result in a +1 counter for the NET_ADDS/RENEWS_#_YR field, which I've added simple (# of years, add or renew) -> Enum functions to get. Allocates are just a special case of adds, and are counted in a similar manner. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=165963249
This commit is contained in:
@@ -17,6 +17,7 @@ package google.registry.flows.domain;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.flows.domain.DomainTransferFlowTestCase.persistWithPendingTransfer;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.reporting.DomainTransactionRecord.TransactionFieldAmount.TransactionReportField.netRenewsFieldFromYears;
|
||||
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.getOnlyHistoryEntryOfType;
|
||||
@@ -58,6 +59,8 @@ import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionFieldAmount;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import java.util.Map;
|
||||
import org.joda.money.Money;
|
||||
@@ -660,4 +663,26 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
||||
assertIcannReportingActivityFieldLogged("srs-dom-renew");
|
||||
assertTldsFieldLogged("tld");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIcannTransactionRecord_getsStored() throws Exception {
|
||||
persistDomain();
|
||||
// Test with a nonstandard Renew period to ensure the reporting time is correct regardless
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewGracePeriodLength(Duration.standardMinutes(9))
|
||||
.build());
|
||||
runFlow();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
HistoryEntry historyEntry =
|
||||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RENEW);
|
||||
DomainTransactionRecord transactionRecord = historyEntry.getDomainTransactionRecord();
|
||||
|
||||
assertThat(transactionRecord.getTld()).isEqualTo("tld");
|
||||
assertThat(transactionRecord.getReportingTime())
|
||||
.isEqualTo(historyEntry.getModificationTime().plusMinutes(9));
|
||||
assertThat(transactionRecord.getTransactionFieldAmounts())
|
||||
.containsExactly(TransactionFieldAmount.create(netRenewsFieldFromYears(5), 1));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user