mirror of
https://github.com/google/nomulus.git
synced 2025-05-28 16:30:12 +02:00
Allow partial update of billing account map
When doing update_registrar, it is now possible to only specify the currencies and the account ids that need updating. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=159262119
This commit is contained in:
parent
7d2f53a6fe
commit
d1ef4b9c37
3 changed files with 27 additions and 4 deletions
|
@ -26,6 +26,7 @@ import static org.joda.time.DateTimeZone.UTC;
|
|||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.billing.RegistrarBillingEntry;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
|
@ -225,6 +226,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
|
|||
"NewRegistrar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_billingAccountMap_onlyAppliesToRealRegistrar() throws Exception {
|
||||
createTlds("foo");
|
||||
assertThat(loadByClientId("NewRegistrar").getBillingAccountMap()).isEmpty();
|
||||
|
@ -237,6 +239,20 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
|
|||
.containsExactly(CurrencyUnit.JPY, "789xyz");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_billingAccountMap_partialUpdate() throws Exception {
|
||||
createTlds("foo");
|
||||
persistResource(
|
||||
loadByClientId("NewRegistrar")
|
||||
.asBuilder()
|
||||
.setBillingAccountMap(
|
||||
ImmutableMap.of(CurrencyUnit.USD, "abc123", CurrencyUnit.JPY, "789xyz"))
|
||||
.build());
|
||||
runCommand("--billing_account_map=JPY=123xyz", "--allowed_tlds=foo", "--force", "NewRegistrar");
|
||||
assertThat(loadByClientId("NewRegistrar").getBillingAccountMap())
|
||||
.containsExactly(CurrencyUnit.JPY, "123xyz", CurrencyUnit.USD, "abc123");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_changeBillingMethodToBraintreeWhenBalanceIsZero() throws Exception {
|
||||
createTlds("xn--q9jyb4c");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue