summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/AcceptedCountries.java2
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java4
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java4
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java1
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/accepted-countries.json2
5 files changed, 6 insertions, 7 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/AcceptedCountries.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/AcceptedCountries.java
index c665b4fb7c2..082eaac7315 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/AcceptedCountries.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/AcceptedCountries.java
@@ -13,7 +13,7 @@ public record AcceptedCountries(List<Country> countries) {
countries = List.copyOf(countries);
}
- public record Country(String code, String displayName, List<TaxType> taxTypes) {
+ public record Country(String code, String displayName, boolean taxIdMandatory, List<TaxType> taxTypes) {
public Country {
taxTypes = List.copyOf(taxTypes);
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java
index 92a84ad9918..9012b45748c 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java
@@ -210,10 +210,10 @@ public class MockBillingController implements BillingController {
public AcceptedCountries getAcceptedCountries() {
return new AcceptedCountries(List.of(
new AcceptedCountries.Country(
- "NO", "Norway",
+ "NO", "Norway", true,
List.of(new AcceptedCountries.TaxType("no_vat", "Norwegian VAT number", "[0-9]{9}MVA", "123456789MVA"))),
new AcceptedCountries.Country(
- "CA", "Canada",
+ "CA", "Canada", true,
List.of(new AcceptedCountries.TaxType("ca_gst_hst", "Canadian GST/HST number", "([0-9]{9}) ?RT ?([0-9]{4})", "123456789RT0002"),
new AcceptedCountries.TaxType("ca_pst_bc", "Canadian PST number (British Columbia)", "PST-?([0-9]{4})-?([0-9]{4})", "PST-1234-5678")))
));
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
index fa32d61675c..1fd8e7c8f3b 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
@@ -721,10 +721,6 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
var mergedPurchaseOrder = optional("purchaseOrder", inspector).map(PurchaseOrder::new).orElse(billing.getPurchaseOrder());
var mergedInvoiceEmail = optional("invoiceEmail", inspector).map(mail -> new Email(mail, false)).orElse(billing.getInvoiceEmail());
- if (!inspector.field("taxId").valid() && inspector.field("address").valid()) {
- throw new IllegalArgumentException("Tax ID information is mandatory for setting up billing");
- }
-
var mergedBilling = info.billingContact()
.withContact(mergedContact)
.withAddress(mergedAddress)
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java
index b4237a46c5a..93c13e6ed4c 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/billing/BillingApiHandlerV2.java
@@ -131,6 +131,7 @@ public class BillingApiHandlerV2 extends RestApiRequestHandler<BillingApiHandler
var countryCursor = countries.addObject();
countryCursor.setString("code", country.code());
countryCursor.setString("name", country.displayName());
+ countryCursor.setBool("taxIdMandatory", country.taxIdMandatory());
var taxTypesCursors = countryCursor.setArray("taxTypes");
country.taxTypes().forEach(taxType -> {
var taxTypeCursor = taxTypesCursors.addObject();
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/accepted-countries.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/accepted-countries.json
index 2714de1e64d..5247b84a900 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/accepted-countries.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/billing/responses/accepted-countries.json
@@ -3,6 +3,7 @@
{
"code": "NO",
"name": "Norway",
+ "taxIdMandatory": true,
"taxTypes": [
{
"id": "no_vat",
@@ -15,6 +16,7 @@
{
"code": "CA",
"name": "Canada",
+ "taxIdMandatory": true,
"taxTypes": [
{
"id": "ca_gst_hst",