mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 09:27:16 +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
d02a01ba66
commit
a0f9e3b3dd
5 changed files with 121 additions and 48 deletions
|
@ -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