Require currency specific billingAccountId for registrar

For the currency specific billing account ids to work properly, any REAL registrar that is allowed to register domains in a certain TLD must have a billing account id for the currency of that TLD.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155864711
This commit is contained in:
jianglai 2017-05-12 07:27:05 -07:00 committed by Ben McIlwain
parent 6e6a340113
commit 35624ace08
3 changed files with 110 additions and 7 deletions

View file

@ -212,6 +212,31 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
.containsExactly(CurrencyUnit.USD, "abc123", CurrencyUnit.JPY, "789xyz");
}
@Test
public void testFailure_billingAccountMap_doesNotContainEntryForTldAllowed() throws Exception {
createTlds("foo");
assertThat(loadByClientId("NewRegistrar").getBillingAccountMap()).isEmpty();
thrown.expect(IllegalArgumentException.class, "USD");
runCommand(
"--billing_account_map=JPY=789xyz",
"--allowed_tlds=foo",
"--force",
"--registrar_type=REAL",
"NewRegistrar");
}
public void testSuccess_billingAccountMap_onlyAppliesToRealRegistrar() throws Exception {
createTlds("foo");
assertThat(loadByClientId("NewRegistrar").getBillingAccountMap()).isEmpty();
runCommand(
"--billing_account_map=JPY=789xyz",
"--allowed_tlds=foo",
"--force",
"NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getBillingAccountMap())
.containsExactly(CurrencyUnit.JPY, "789xyz");
}
@Test
public void testSuccess_changeBillingMethodToBraintreeWhenBalanceIsZero() throws Exception {
createTlds("xn--q9jyb4c");