Add the ability to nullify the entire billing account map (#1630)

This commit is contained in:
Lai Jiang
2022-05-17 10:33:42 -04:00
committed by GitHub
parent bee5e0a5a9
commit 03ca6cecc7
2 changed files with 21 additions and 9 deletions
@@ -173,7 +173,8 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
"Registrar Billing Account key-value pairs (formatted as key=value[,key=value...]), "
+ "where key is a currency unit (USD, JPY, etc) and value is the registrar's billing "
+ "account id for that currency. During update, only the pairs that need updating "
+ "need to be provided.",
+ "need to be provided, except when an empty string is provided, in which case the"
+ "entire map is nullified.",
converter = CurrencyUnitToStringMap.class,
validateWith = CurrencyUnitToStringMap.class)
private Map<CurrencyUnit, String> billingAccountMap;
@@ -368,7 +369,9 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
Optional.ofNullable(poNumber).ifPresent(builder::setPoNumber);
if (billingAccountMap != null) {
LinkedHashMap<CurrencyUnit, String> newBillingAccountMap = new LinkedHashMap<>();
if (oldRegistrar != null && oldRegistrar.getBillingAccountMap() != null) {
if (oldRegistrar != null
&& oldRegistrar.getBillingAccountMap() != null
&& !billingAccountMap.isEmpty()) {
newBillingAccountMap.putAll(oldRegistrar.getBillingAccountMap());
}
newBillingAccountMap.putAll(billingAccountMap);