mirror of
https://github.com/google/nomulus.git
synced 2025-05-22 04:09:46 +02:00
Store a reference to an allocation token in the OneTime billing event
We will need to be able to find all redemptions associated with a particular token and this will allow us to do that. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=245292865
This commit is contained in:
parent
aadefd9595
commit
6ee34a79b1
5 changed files with 121 additions and 48 deletions
|
@ -295,6 +295,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
years,
|
||||
feesAndCredits,
|
||||
historyEntry,
|
||||
allocationToken,
|
||||
now);
|
||||
// Create a new autorenew billing event and poll message starting at the expiration time.
|
||||
BillingEvent.Recurring autorenewBillingEvent =
|
||||
|
@ -477,6 +478,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
int years,
|
||||
FeesAndCredits feesAndCredits,
|
||||
HistoryEntry historyEntry,
|
||||
Optional<AllocationToken> allocationToken,
|
||||
DateTime now) {
|
||||
ImmutableSet.Builder<Flag> flagsBuilder = new ImmutableSet.Builder<>();
|
||||
// Sunrise and anchor tenancy are orthogonal tags and thus both can be present together.
|
||||
|
@ -497,6 +499,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
.setPeriodYears(years)
|
||||
.setCost(feesAndCredits.getCreateCost())
|
||||
.setEventTime(now)
|
||||
.setAllocationToken(allocationToken.map(Key::create).orElse(null))
|
||||
.setBillingTime(
|
||||
now.plus(
|
||||
isAnchorTenant
|
||||
|
|
|
@ -40,6 +40,7 @@ import google.registry.model.annotations.ReportedOn;
|
|||
import google.registry.model.common.TimeOfYear;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.token.AllocationToken;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
||||
import java.util.Objects;
|
||||
|
@ -244,6 +245,11 @@ public abstract class BillingEvent extends ImmutableObject
|
|||
*/
|
||||
Key<? extends BillingEvent> cancellationMatchingBillingEvent;
|
||||
|
||||
/**
|
||||
* The {@link AllocationToken} used in the creation of this event, or null if one was not used.
|
||||
*/
|
||||
@Index @Nullable Key<AllocationToken> allocationToken;
|
||||
|
||||
public Money getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
@ -264,6 +270,10 @@ public abstract class BillingEvent extends ImmutableObject
|
|||
return cancellationMatchingBillingEvent;
|
||||
}
|
||||
|
||||
public Optional<Key<AllocationToken>> getAllocationToken() {
|
||||
return Optional.ofNullable(allocationToken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder asBuilder() {
|
||||
return new Builder(clone(this));
|
||||
|
@ -306,6 +316,11 @@ public abstract class BillingEvent extends ImmutableObject
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setAllocationToken(@Nullable Key<AllocationToken> allocationToken) {
|
||||
getInstance().allocationToken = allocationToken;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OneTime build() {
|
||||
OneTime instance = getInstance();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue