Add billing account map to Registrar entity

A CurrencyUnit-to-BillingAccountEntry map is persisted in the Registrar entity. It provides flexibility for billing systems that assign different account ids for accounts under different currencies of the same registrar.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151022753
This commit is contained in:
jianglai 2017-03-23 10:42:05 -07:00 committed by Ben McIlwain
parent ab9b7c613d
commit d7e2009ddf
8 changed files with 225 additions and 39 deletions

View file

@ -34,6 +34,7 @@ import google.registry.model.registrar.Registrar;
import google.registry.testing.CertificateSamples;
import google.registry.tools.ServerSideCommand.Connection;
import java.io.IOException;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Test;
@ -345,6 +346,25 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
assertThat(registrar.getBillingIdentifier()).isEqualTo(12345);
}
@Test
public void testSuccess_billingAccountMap() throws Exception {
runCommand(
"--name=blobio",
"--password=some_password",
"--registrar_type=REAL",
"--iana_id=8",
"--billing_account_map=USD=abc123,JPY=789xyz",
"--passcode=01234",
"--icann_referral_email=foo@bar.test",
"--force",
"clientz");
Registrar registrar = Registrar.loadByClientId("clientz");
assertThat(registrar).isNotNull();
assertThat(registrar.getBillingAccountMap())
.containsExactly(CurrencyUnit.USD, "abc123", CurrencyUnit.JPY, "789xyz");
}
@Test
public void testSuccess_streetAddress() throws Exception {
runCommand(