mirror of
https://github.com/google/nomulus
synced 2026-03-27 12:55:28 +00:00
Export billing account map to registrar sheet
The billing account map will be serialized in the following format:
{currency1=id1, currency2=id2, ...}
In order for the output to be deterministic, the billing account map is stored as a sorted map.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161075814
This commit is contained in:
@@ -78,8 +78,7 @@ class SyncRegistrarsSheet {
|
||||
final DateTime executionTime = clock.nowUtc();
|
||||
sheetSynchronizer.synchronize(
|
||||
spreadsheetId,
|
||||
FluentIterable
|
||||
.from(
|
||||
FluentIterable.from(
|
||||
new Ordering<Registrar>() {
|
||||
@Override
|
||||
public int compare(Registrar left, Registrar right) {
|
||||
@@ -128,6 +127,7 @@ class SyncRegistrarsSheet {
|
||||
builder.put("state", convert(registrar.getState()));
|
||||
builder.put("ianaIdentifier", convert(registrar.getIanaIdentifier()));
|
||||
builder.put("billingIdentifier", convert(registrar.getBillingIdentifier()));
|
||||
builder.put("billingAccountMap", convert(registrar.getBillingAccountMap()));
|
||||
builder.put("primaryContacts", convertContacts(contacts, byType(ADMIN)));
|
||||
builder.put("techContacts", convertContacts(contacts, byType(TECH)));
|
||||
builder.put("marketingContacts", convertContacts(contacts, byType(MARKETING)));
|
||||
|
||||
@@ -81,7 +81,7 @@ public class SyncRegistrarsSheetAction implements Runnable {
|
||||
private final int statusCode;
|
||||
protected final String message;
|
||||
|
||||
private Result(int statusCode, String message) {
|
||||
Result(int statusCode, String message) {
|
||||
this.statusCode = statusCode;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.google.common.collect.Range;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.re2j.Pattern;
|
||||
@@ -336,7 +338,9 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
|
||||
* Map of currency-to-billing account for the registrar.
|
||||
*
|
||||
* <p>A registrar can have different billing accounts that are denoted in different currencies.
|
||||
* This provides flexibility for billing systems that require such distinction.
|
||||
* This provides flexibility for billing systems that require such distinction. When this field is
|
||||
* accessed by {@link #getBillingAccountMap}, a sorted map is returned to guarantee deterministic
|
||||
* behavior when serializing the map, for display purpose for instance.
|
||||
*/
|
||||
@Nullable
|
||||
@Mapify(CurrencyMapper.class)
|
||||
@@ -448,8 +452,8 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
|
||||
if (billingAccountMap == null) {
|
||||
return ImmutableMap.of();
|
||||
}
|
||||
ImmutableMap.Builder<CurrencyUnit, String> billingAccountMapBuilder =
|
||||
new ImmutableMap.Builder<>();
|
||||
ImmutableSortedMap.Builder<CurrencyUnit, String> billingAccountMapBuilder =
|
||||
new ImmutableSortedMap.Builder<>(Ordering.natural());
|
||||
for (Map.Entry<CurrencyUnit, BillingAccountEntry> entry : billingAccountMap.entrySet()) {
|
||||
billingAccountMapBuilder.put(entry.getKey(), entry.getValue().accountId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user