Handle Purchase Order numbers explicitly in billing pipeline

Note that these aren't used for most registrars.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213631863
This commit is contained in:
mcilwain 2018-09-19 08:30:03 -07:00 committed by Ben McIlwain
parent 3fc7271145
commit 633b30725a
10 changed files with 138 additions and 12 deletions

View file

@ -310,6 +310,10 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
@Nullable
Long billingIdentifier;
/** Purchase Order number used for invoices in external billing system, if applicable. */
@Nullable
String poNumber;
/**
* Map of currency-to-billing account for the registrar.
*
@ -422,6 +426,10 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
return billingIdentifier;
}
public Optional<String> getPoNumber() {
return Optional.ofNullable(poNumber);
}
public ImmutableMap<CurrencyUnit, String> getBillingAccountMap() {
if (billingAccountMap == null) {
return ImmutableMap.of();
@ -644,20 +652,25 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
return this;
}
public Builder setIanaIdentifier(Long ianaIdentifier) {
public Builder setIanaIdentifier(@Nullable Long ianaIdentifier) {
checkArgument(ianaIdentifier == null || ianaIdentifier > 0,
"IANA ID must be a positive number");
getInstance().ianaIdentifier = ianaIdentifier;
return this;
}
public Builder setBillingIdentifier(Long billingIdentifier) {
public Builder setBillingIdentifier(@Nullable Long billingIdentifier) {
checkArgument(billingIdentifier == null || billingIdentifier > 0,
"Billing ID must be a positive number");
getInstance().billingIdentifier = billingIdentifier;
return this;
}
public Builder setPoNumber(Optional<String> poNumber) {
getInstance().poNumber = poNumber.orElse(null);
return this;
}
public Builder setBillingAccountMap(@Nullable Map<CurrencyUnit, String> billingAccountMap) {
if (billingAccountMap == null) {
getInstance().billingAccountMap = null;