diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-03-18 09:01:09 +0100 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-03-18 09:01:09 +0100 |
commit | 1d4b731b3474f8f208ab5b90e0e0667b316263e5 (patch) | |
tree | 4ec4350f8fb3b408b2c2ecdd2ca2aaca7f05255b /controller-api | |
parent | 32ce5d092445669babe25f0f0e6ab9da8fb42c20 (diff) |
Add some more scaffolding
Diffstat (limited to 'controller-api')
2 files changed, 67 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/BillingInfo.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/BillingInfo.java new file mode 100644 index 00000000000..1bc3764aacd --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/BillingInfo.java @@ -0,0 +1,54 @@ +package com.yahoo.vespa.hosted.controller.api.integration.organization; + +import java.util.Objects; +import java.util.StringJoiner; + +import static java.util.Objects.requireNonNull; + +/** + * Information pertinent to billing a tenant for use of hosted Vespa services. + * + * @author jonmv + */ +public class BillingInfo { + + private final String customerId; + private final String productCode; + + /** Creates a new BillingInfo with the given data. Assumes data has already been validated. */ + public BillingInfo(String customerId, String productCode) { + this.customerId = requireNonNull(customerId); + this.productCode = requireNonNull(productCode); + } + + public String customerId() { + return customerId; + } + + public String productCode() { + return productCode; + } + + @Override + public String toString() { + return new StringJoiner(", ", BillingInfo.class.getSimpleName() + "[", "]") + .add("customerId='" + customerId + "'") + .add("productCode='" + productCode + "'") + .toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if ( ! (o instanceof BillingInfo)) return false; + BillingInfo that = (BillingInfo) o; + return Objects.equals(customerId, that.customerId) && + Objects.equals(productCode, that.productCode); + } + + @Override + public int hashCode() { + return Objects.hash(customerId, productCode); + } + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Marketplace.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Marketplace.java new file mode 100644 index 00000000000..b0ee5274a8f --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Marketplace.java @@ -0,0 +1,13 @@ +package com.yahoo.vespa.hosted.controller.api.integration.organization; + +/** + * A marketplace where purchase tokens can be validated and redeemed for payments. + * + * @author jonmv + */ +public interface Marketplace { + + /** Validates and translates the token to billing information which can be used to request payment. */ + BillingInfo resolveCustomer(String registrationToken); + +} |