mirror of
https://github.com/google/nomulus
synced 2026-05-31 03:56:33 +00:00
Filter cancellation records for only cancellable records
Previously, I would cancel all the records associated with HistoryEntry that's available for cancellation. This could cause unexpected behavior if we cancelled a historyEntry which itself had cancelled records (in effect we would negate the negation unintentionally). This is easily remedied by only cancelling records which want to be cancelled. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167204383
This commit is contained in:
@@ -960,8 +960,11 @@ public class DomainFlowUtils {
|
||||
ImmutableSet.Builder<DomainTransactionRecord> recordsBuilder = new ImmutableSet.Builder<>();
|
||||
if (entryToCancel.isPresent()) {
|
||||
for (DomainTransactionRecord record : entryToCancel.get().getDomainTransactionRecords()) {
|
||||
int cancelledAmount = -1 * record.getReportAmount();
|
||||
recordsBuilder.add(record.asBuilder().setReportAmount(cancelledAmount).build());
|
||||
// Only cancel fields which are cancelable
|
||||
if (cancelableFields.contains(record.getReportField())) {
|
||||
int cancelledAmount = -1 * record.getReportAmount();
|
||||
recordsBuilder.add(record.asBuilder().setReportAmount(cancelledAmount).build());
|
||||
}
|
||||
}
|
||||
}
|
||||
return recordsBuilder.build();
|
||||
|
||||
Reference in New Issue
Block a user