From e41461f8fccb57e48cd9ad7cb5943f325b5c3d44 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 25 Oct 2017 12:41:07 -0400 Subject: [PATCH] org tax information --- src/Api/Models/InvoiceModel.cs | 13 ++++++------- src/Api/Views/Organizations/Invoice.cshtml | 12 ++++++------ .../OrganizationCreateRequestModel.cs | 2 ++ .../Api/Response/OrganizationResponseModel.cs | 10 ++++++++++ src/Core/Models/Business/OrganizationSignup.cs | 1 + src/Core/Models/Table/Organization.cs | 5 +++++ .../Implementations/OrganizationService.cs | 1 + .../dbo/Stored Procedures/Organization_Create.sql | 15 +++++++++++++++ .../dbo/Stored Procedures/Organization_Update.sql | 10 ++++++++++ src/Sql/dbo/Tables/Organization.sql | 5 +++++ 10 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/Api/Models/InvoiceModel.cs b/src/Api/Models/InvoiceModel.cs index 74df0fe56..fa9b37482 100644 --- a/src/Api/Models/InvoiceModel.cs +++ b/src/Api/Models/InvoiceModel.cs @@ -14,12 +14,11 @@ namespace Bit.Api.Models OurAddress3 = apiSettings.OurAddress3; CustomerName = organization.BusinessName ?? "--"; - // TODO: address and vat - CustomerAddress1 = "123 Any St"; - CustomerAddress2 = "New York, NY 10001"; - CustomerAddress3 = "United States"; - CustomerAddress4 = null; - CustomerVatNumber = "PT123456789"; + CustomerAddress1 = organization.BusinessAddress1; + CustomerAddress2 = organization.BusinessAddress2; + CustomerAddress3 = organization.BusinessAddress3; + CustomerCountry = organization.BusinessCountry; + CustomerVatNumber = organization.BusinessTaxNumber; InvoiceDate = invoice.Date?.ToLongDateString(); InvoiceDueDate = invoice.DueDate?.ToLongDateString(); @@ -43,7 +42,7 @@ namespace Bit.Api.Models public string CustomerAddress1 { get; set; } public string CustomerAddress2 { get; set; } public string CustomerAddress3 { get; set; } - public string CustomerAddress4 { get; set; } + public string CustomerCountry { get; set; } public IEnumerable Items { get; set; } public string SubtotalAmount { get; set; } public string VatTotalAmount { get; set; } diff --git a/src/Api/Views/Organizations/Invoice.cshtml b/src/Api/Views/Organizations/Invoice.cshtml index 13c659216..4757ec3b6 100644 --- a/src/Api/Views/Organizations/Invoice.cshtml +++ b/src/Api/Views/Organizations/Invoice.cshtml @@ -3,12 +3,12 @@ @@ -90,9 +90,9 @@ { @Model.CustomerAddress3
} - @if(!string.IsNullOrWhiteSpace(Model.CustomerAddress4)) + @if(!string.IsNullOrWhiteSpace(Model.CustomerCountry)) { - @Model.CustomerAddress4 + @Model.CustomerCountry }

@if(Model.UsesVat) diff --git a/src/Core/Models/Api/Request/Organizations/OrganizationCreateRequestModel.cs b/src/Core/Models/Api/Request/Organizations/OrganizationCreateRequestModel.cs index c7ca92dbf..d25f91143 100644 --- a/src/Core/Models/Api/Request/Organizations/OrganizationCreateRequestModel.cs +++ b/src/Core/Models/Api/Request/Organizations/OrganizationCreateRequestModel.cs @@ -29,6 +29,7 @@ namespace Bit.Core.Models.Api [EncryptedString] [StringLength(1000)] public string CollectionName { get; set; } + public string Country { get; set; } public virtual OrganizationSignup ToOrganizationSignup(User user) { @@ -43,6 +44,7 @@ namespace Bit.Core.Models.Api AdditionalStorageGb = AdditionalStorageGb.GetValueOrDefault(0), BillingEmail = BillingEmail, BusinessName = BusinessName, + BusinessCountry = Country, CollectionName = CollectionName }; } diff --git a/src/Core/Models/Api/Response/OrganizationResponseModel.cs b/src/Core/Models/Api/Response/OrganizationResponseModel.cs index 83d44045e..b20fc8ff9 100644 --- a/src/Core/Models/Api/Response/OrganizationResponseModel.cs +++ b/src/Core/Models/Api/Response/OrganizationResponseModel.cs @@ -19,6 +19,11 @@ namespace Bit.Core.Models.Api Id = organization.Id.ToString(); Name = organization.Name; BusinessName = organization.BusinessName; + BusinessAddress1 = organization.BusinessAddress1; + BusinessAddress2 = organization.BusinessAddress2; + BusinessAddress3 = organization.BusinessAddress3; + BusinessCountry = organization.BusinessCountry; + BusinessTaxNumber = organization.BusinessTaxNumber; BillingEmail = organization.BillingEmail; Plan = organization.Plan; PlanType = organization.PlanType; @@ -32,6 +37,11 @@ namespace Bit.Core.Models.Api public string Id { get; set; } public string Name { get; set; } public string BusinessName { get; set; } + public string BusinessAddress1 { get; set; } + public string BusinessAddress2 { get; set; } + public string BusinessAddress3 { get; set; } + public string BusinessCountry { get; set; } + public string BusinessTaxNumber { get; set; } public string BillingEmail { get; set; } public string Plan { get; set; } public Enums.PlanType PlanType { get; set; } diff --git a/src/Core/Models/Business/OrganizationSignup.cs b/src/Core/Models/Business/OrganizationSignup.cs index 7bb9dc718..eca1d04d2 100644 --- a/src/Core/Models/Business/OrganizationSignup.cs +++ b/src/Core/Models/Business/OrganizationSignup.cs @@ -6,6 +6,7 @@ namespace Bit.Core.Models.Business { public string Name { get; set; } public string BusinessName { get; set; } + public string BusinessCountry { get; set; } public string BillingEmail { get; set; } public User Owner { get; set; } public string OwnerKey { get; set; } diff --git a/src/Core/Models/Table/Organization.cs b/src/Core/Models/Table/Organization.cs index d54c13b92..8e3cac000 100644 --- a/src/Core/Models/Table/Organization.cs +++ b/src/Core/Models/Table/Organization.cs @@ -11,6 +11,11 @@ namespace Bit.Core.Models.Table public Guid Id { get; set; } public string Name { get; set; } public string BusinessName { get; set; } + public string BusinessAddress1 { get; set; } + public string BusinessAddress2 { get; set; } + public string BusinessAddress3 { get; set; } + public string BusinessCountry { get; set; } + public string BusinessTaxNumber { get; set; } public string BillingEmail { get; set; } public string Plan { get; set; } public PlanType PlanType { get; set; } diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index 843d66e5b..ac313a231 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -517,6 +517,7 @@ namespace Bit.Core.Services Name = signup.Name, BillingEmail = signup.BillingEmail, BusinessName = signup.BusinessName, + BusinessCountry = signup.BusinessCountry, PlanType = plan.Type, Seats = (short)(plan.BaseSeats + signup.AdditionalSeats), MaxCollections = plan.MaxCollections, diff --git a/src/Sql/dbo/Stored Procedures/Organization_Create.sql b/src/Sql/dbo/Stored Procedures/Organization_Create.sql index d06266b2f..1cd60f3d2 100644 --- a/src/Sql/dbo/Stored Procedures/Organization_Create.sql +++ b/src/Sql/dbo/Stored Procedures/Organization_Create.sql @@ -2,6 +2,11 @@ @Id UNIQUEIDENTIFIER, @Name NVARCHAR(50), @BusinessName NVARCHAR(50), + @BusinessAddress1 NVARCHAR(50), + @BusinessAddress2 NVARCHAR(50), + @BusinessAddress3 NVARCHAR(50), + @BusinessCountry VARCHAR(2), + @BusinessTaxNumber NVARCHAR(30), @BillingEmail NVARCHAR(50), @Plan NVARCHAR(50), @PlanType TINYINT, @@ -30,6 +35,11 @@ BEGIN [Id], [Name], [BusinessName], + [BusinessAddress1], + [BusinessAddress2], + [BusinessAddress3], + [BusinessCountry], + [BusinessTaxNumber], [BillingEmail], [Plan], [PlanType], @@ -55,6 +65,11 @@ BEGIN @Id, @Name, @BusinessName, + @BusinessAddress1, + @BusinessAddress2, + @BusinessAddress3, + @BusinessCountry, + @BusinessTaxNumber, @BillingEmail, @Plan, @PlanType, diff --git a/src/Sql/dbo/Stored Procedures/Organization_Update.sql b/src/Sql/dbo/Stored Procedures/Organization_Update.sql index 0a1f773e5..2e82b701d 100644 --- a/src/Sql/dbo/Stored Procedures/Organization_Update.sql +++ b/src/Sql/dbo/Stored Procedures/Organization_Update.sql @@ -2,6 +2,11 @@ @Id UNIQUEIDENTIFIER, @Name NVARCHAR(50), @BusinessName NVARCHAR(50), + @BusinessAddress1 NVARCHAR(50), + @BusinessAddress2 NVARCHAR(50), + @BusinessAddress3 NVARCHAR(50), + @BusinessCountry VARCHAR(2), + @BusinessTaxNumber NVARCHAR(30), @BillingEmail NVARCHAR(50), @Plan NVARCHAR(50), @PlanType TINYINT, @@ -31,6 +36,11 @@ BEGIN SET [Name] = @Name, [BusinessName] = @BusinessName, + [BusinessAddress1] = @BusinessAddress1, + [BusinessAddress2] = @BusinessAddress2, + [BusinessAddress3] = @BusinessAddress3, + [BusinessCountry] = @BusinessCountry, + [BusinessTaxNumber] = @BusinessTaxNumber, [BillingEmail] = @BillingEmail, [Plan] = @Plan, [PlanType] = @PlanType, diff --git a/src/Sql/dbo/Tables/Organization.sql b/src/Sql/dbo/Tables/Organization.sql index 30ee05147..4008926a5 100644 --- a/src/Sql/dbo/Tables/Organization.sql +++ b/src/Sql/dbo/Tables/Organization.sql @@ -2,6 +2,11 @@ [Id] UNIQUEIDENTIFIER NOT NULL, [Name] NVARCHAR (50) NOT NULL, [BusinessName] NVARCHAR (50) NULL, + [BusinessAddress1] NVARCHAR (50) NULL, + [BusinessAddress2] NVARCHAR (50) NULL, + [BusinessAddress3] NVARCHAR (50) NULL, + [BusinessCountry] VARCHAR (2) NULL, + [BusinessTaxNumber] NVARCHAR (30) NULL, [BillingEmail] NVARCHAR (50) NOT NULL, [Plan] NVARCHAR (50) NOT NULL, [PlanType] TINYINT NOT NULL,