diff --git a/apiserver/billing/odoostorage/odoo/odoo8/odoo8.go b/apiserver/billing/odoostorage/odoo/odoo8/odoo8.go index 121c1165..d90cdb77 100644 --- a/apiserver/billing/odoostorage/odoo/odoo8/odoo8.go +++ b/apiserver/billing/odoostorage/odoo/odoo8/odoo8.go @@ -16,6 +16,8 @@ import ( "github.com/appuio/control-api/apiserver/billing/odoostorage/odoo/odoo8/client/model" ) +const VSHNAccountingContactNameKey = "billing.appuio.io/vshn-accounting-contact-name" + // Used to identify the accounting contact of a company. const roleAccountCategory = 7 @@ -146,9 +148,12 @@ func mapPartnersToBillingEntity(company model.Partner, accounting model.Partner) CreationTimestamp: metav1.Time{ Time: accounting.CreationTimestamp.ToTime(), }, + Annotations: map[string]string{ + VSHNAccountingContactNameKey: accounting.Name, + }, }, Spec: billingv1.BillingEntitySpec{ - Name: company.Name + ", " + accounting.Name, + Name: company.Name, Phone: company.Phone.Value, Emails: company.Emails(), Address: billingv1.BillingEntityAddress{ diff --git a/apiserver/billing/odoostorage/odoo/odoo8/odoo8_test.go b/apiserver/billing/odoostorage/odoo/odoo8/odoo8_test.go index bb7a7fe8..308dd8fa 100644 --- a/apiserver/billing/odoostorage/odoo/odoo8/odoo8_test.go +++ b/apiserver/billing/odoostorage/odoo/odoo8/odoo8_test.go @@ -5,14 +5,15 @@ import ( "testing" "time" - billingv1 "github.com/appuio/control-api/apis/billing/v1" - "github.com/appuio/control-api/apiserver/billing/odoostorage/odoo/odoo8/client" - "github.com/appuio/control-api/apiserver/billing/odoostorage/odoo/odoo8/client/clientmock" - "github.com/appuio/control-api/apiserver/billing/odoostorage/odoo/odoo8/client/model" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + billingv1 "github.com/appuio/control-api/apis/billing/v1" + "github.com/appuio/control-api/apiserver/billing/odoostorage/odoo/odoo8/client" + "github.com/appuio/control-api/apiserver/billing/odoostorage/odoo/odoo8/client/clientmock" + "github.com/appuio/control-api/apiserver/billing/odoostorage/odoo/odoo8/client/model" ) func TestGet(t *testing.T) { @@ -46,9 +47,12 @@ func TestGet(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "be-456", CreationTimestamp: metav1.Time{Time: tn}, + Annotations: map[string]string{ + VSHNAccountingContactNameKey: "Accounting", + }, }, Spec: billingv1.BillingEntitySpec{ - Name: "Test Company, Accounting", + Name: "Test Company", Emails: []string{}, AccountingContact: billingv1.BillingEntityContact{ Emails: []string{ @@ -157,9 +161,12 @@ func TestList(t *testing.T) { { ObjectMeta: metav1.ObjectMeta{ Name: "be-456", + Annotations: map[string]string{ + VSHNAccountingContactNameKey: "Accounting", + }, }, Spec: billingv1.BillingEntitySpec{ - Name: "Test Company, Accounting", + Name: "Test Company", Emails: []string{}, AccountingContact: billingv1.BillingEntityContact{ Emails: []string{}, @@ -168,9 +175,12 @@ func TestList(t *testing.T) { }, { ObjectMeta: metav1.ObjectMeta{ Name: "be-457", + Annotations: map[string]string{ + VSHNAccountingContactNameKey: "Accounting", + }, }, Spec: billingv1.BillingEntitySpec{ - Name: "Foo Company, Accounting", + Name: "Foo Company", Emails: []string{}, AccountingContact: billingv1.BillingEntityContact{ Emails: []string{},