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

@ -167,6 +167,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
"--registrar_type=REAL",
"--iana_id=8",
"--allowed_tlds=xn--q9jyb4c,foobar",
"--billing_account_map=USD=123abc",
"--passcode=01234",
"--icann_referral_email=foo@bar.test",
"--street=\"123 Fake St\"",
@ -431,6 +432,53 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
.containsExactly(CurrencyUnit.USD, "abc123", CurrencyUnit.JPY, "789xyz");
}
@Test
public void testFailure_billingAccountMap_doesNotContainEntryForTldAllowed() throws Exception {
createTlds("foo");
thrown.expect(IllegalArgumentException.class, "USD");
runCommandForced(
"--name=blobio",
"--password=some_password",
"--registrar_type=REAL",
"--iana_id=8",
"--billing_account_map=JPY=789xyz",
"--allowed_tlds=foo",
"--passcode=01234",
"--icann_referral_email=foo@bar.test",
"--street=\"123 Fake St\"",
"--city Fakington",
"--state MA",
"--zip 00351",
"--cc US",
"clientz");
}
@Test
public void testSuccess_billingAccountMap_onlyAppliesToRealRegistrar() throws Exception {
createTlds("foo");
runCommandForced(
"--name=blobio",
"--password=some_password",
"--registrar_type=TEST",
"--billing_account_map=JPY=789xyz",
"--allowed_tlds=foo",
"--passcode=01234",
"--icann_referral_email=foo@bar.test",
"--street=\"123 Fake St\"",
"--city Fakington",
"--state MA",
"--zip 00351",
"--cc US",
"clientz");
Registrar registrar = Registrar.loadByClientId("clientz");
assertThat(registrar).isNotNull();
assertThat(registrar.getBillingAccountMap())
.containsExactly(CurrencyUnit.JPY, "789xyz");
}
@Test
public void testSuccess_streetAddress() throws Exception {
runCommandForced(