summaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/InstrumentOwner.java
diff options
context:
space:
mode:
Diffstat (limited to 'controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/InstrumentOwner.java')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/InstrumentOwner.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/InstrumentOwner.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/InstrumentOwner.java
new file mode 100644
index 00000000000..45e06b11b2a
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/InstrumentOwner.java
@@ -0,0 +1,67 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.billing;
+
+import com.yahoo.config.provision.TenantName;
+
+import java.util.Objects;
+
+/**
+ * @author olaa
+ */
+public class InstrumentOwner {
+
+ private final TenantName tenantName;
+ private final String userId;
+ private final String paymentInstrumentId;
+ private final boolean isDefault;
+
+ public InstrumentOwner(TenantName tenantName, String userId, String paymentInstrumentId, boolean isDefault) {
+ this.tenantName = tenantName;
+ this.userId = userId;
+ this.paymentInstrumentId = paymentInstrumentId;
+ this.isDefault = isDefault;
+ }
+
+ public TenantName getTenantName() {
+ return tenantName;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public String getPaymentInstrumentId() {
+ return paymentInstrumentId;
+ }
+
+ public boolean isDefault() {
+ return isDefault;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(
+ "Tenant: %s\nCusomer ID: %s\nPayment Instrument ID: %s\nIs default: %s",
+ tenantName.value(),
+ userId,
+ paymentInstrumentId,
+ isDefault
+ );
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ InstrumentOwner other = (InstrumentOwner) o;
+ return this.tenantName.equals(other.getTenantName()) &&
+ this.userId.equals(other.getUserId()) &&
+ this.paymentInstrumentId.equals(other.getPaymentInstrumentId()) &&
+ this.isDefault() == other.isDefault();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(tenantName, userId, paymentInstrumentId, isDefault);
+ }
+}