mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 09:32:48 -05:00
Merge branch 'master' into feature/flexible-collections
This commit is contained in:
12
.github/CODEOWNERS
vendored
12
.github/CODEOWNERS
vendored
@ -18,4 +18,14 @@ src/Identity @bitwarden/team-auth-dev
|
|||||||
bitwarden_license/src/Scim @bitwarden/team-admin-console-dev
|
bitwarden_license/src/Scim @bitwarden/team-admin-console-dev
|
||||||
bitwarden_license/src/test/Scim.IntegrationTest @bitwarden/team-admin-console-dev
|
bitwarden_license/src/test/Scim.IntegrationTest @bitwarden/team-admin-console-dev
|
||||||
bitwarden_license/src/test/Scim.ScimTest @bitwarden/team-admin-console-dev
|
bitwarden_license/src/test/Scim.ScimTest @bitwarden/team-admin-console-dev
|
||||||
**/AdminConsole @bitwarden/team-admin-console-dev
|
**/AdminConsole @bitwarden/team-admin-console-dev
|
||||||
|
|
||||||
|
# Billing Team
|
||||||
|
**/*billing* @bitwarden/team-billing-dev
|
||||||
|
**/*subscription* @bitwarden/team-billing-dev
|
||||||
|
**/*stripe* @bitwarden/team-billing-dev
|
||||||
|
**/*paypal* @bitwarden/team-billing-dev
|
||||||
|
**/*braintree* @bitwarden/team-billing-dev
|
||||||
|
**/*bitpay* @bitwarden/team-billing-dev
|
||||||
|
**/*freshdesk* @bitwarden/team-billing-dev
|
||||||
|
**/*freshsales* @bitwarden/team-billing-dev
|
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -277,7 +277,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Retrieve github PAT secrets
|
- name: Retrieve github PAT secrets
|
||||||
id: retrieve-secret-pat
|
id: retrieve-secret-pat
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/get-keyvault-secrets@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
with:
|
with:
|
||||||
keyvault: "bitwarden-ci"
|
keyvault: "bitwarden-ci"
|
||||||
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
|
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
|
||||||
@ -528,7 +528,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Retrieve github PAT secrets
|
- name: Retrieve github PAT secrets
|
||||||
id: retrieve-secret-pat
|
id: retrieve-secret-pat
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/get-keyvault-secrets@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
with:
|
with:
|
||||||
keyvault: "bitwarden-ci"
|
keyvault: "bitwarden-ci"
|
||||||
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
|
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
|
||||||
@ -603,7 +603,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/get-keyvault-secrets@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
keyvault: "bitwarden-ci"
|
keyvault: "bitwarden-ci"
|
||||||
|
@ -92,7 +92,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/get-keyvault-secrets@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
keyvault: "bitwarden-ci"
|
keyvault: "bitwarden-ci"
|
||||||
|
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@ -41,7 +41,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Check Release Version
|
- name: Check Release Version
|
||||||
id: version
|
id: version
|
||||||
uses: bitwarden/gh-actions/release-version-check@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/release-version-check@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
with:
|
with:
|
||||||
release-type: ${{ github.event.inputs.release_type }}
|
release-type: ${{ github.event.inputs.release_type }}
|
||||||
project-type: dotnet
|
project-type: dotnet
|
||||||
@ -89,7 +89,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Download latest Release ${{ matrix.name }} asset
|
- name: Download latest Release ${{ matrix.name }} asset
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
uses: bitwarden/gh-actions/download-artifacts@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/download-artifacts@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
@ -98,7 +98,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Dry Run - Download latest Release ${{ matrix.name }} asset
|
- name: Dry Run - Download latest Release ${{ matrix.name }} asset
|
||||||
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
||||||
uses: bitwarden/gh-actions/download-artifacts@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/download-artifacts@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
@ -274,7 +274,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Download latest Release Docker Stubs
|
- name: Download latest Release Docker Stubs
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
uses: bitwarden/gh-actions/download-artifacts@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/download-artifacts@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
@ -287,7 +287,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Dry Run - Download latest Release Docker Stubs
|
- name: Dry Run - Download latest Release Docker Stubs
|
||||||
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
||||||
uses: bitwarden/gh-actions/download-artifacts@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/download-artifacts@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
|
6
.github/workflows/version-bump.yml
vendored
6
.github/workflows/version-bump.yml
vendored
@ -23,13 +23,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/get-keyvault-secrets@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
with:
|
with:
|
||||||
keyvault: "bitwarden-ci"
|
keyvault: "bitwarden-ci"
|
||||||
secrets: "github-gpg-private-key, github-gpg-private-key-passphrase"
|
secrets: "github-gpg-private-key, github-gpg-private-key-passphrase"
|
||||||
|
|
||||||
- name: Import GPG key
|
- name: Import GPG key
|
||||||
uses: crazy-max/ghaction-import-gpg@d6f3f49f3345e29369fe57596a3ca8f94c4d2ca7 # v5.4.0
|
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0
|
||||||
with:
|
with:
|
||||||
gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
|
gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
|
||||||
passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}
|
passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}
|
||||||
@ -40,7 +40,7 @@ jobs:
|
|||||||
run: git switch -c version_bump_${{ github.event.inputs.version_number }}
|
run: git switch -c version_bump_${{ github.event.inputs.version_number }}
|
||||||
|
|
||||||
- name: Bump Version - Props
|
- name: Bump Version - Props
|
||||||
uses: bitwarden/gh-actions/version-bump@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/version-bump@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
with:
|
with:
|
||||||
version: ${{ github.event.inputs.version_number }}
|
version: ${{ github.event.inputs.version_number }}
|
||||||
file_path: "Directory.Build.props"
|
file_path: "Directory.Build.props"
|
||||||
|
2
.github/workflows/workflow-linter.yml
vendored
2
.github/workflows/workflow-linter.yml
vendored
@ -8,4 +8,4 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
call-workflow:
|
call-workflow:
|
||||||
uses: bitwarden/gh-actions/.github/workflows/workflow-linter.yml@fdcf1fcec3b04762ce48216cbf3af32498bed74c
|
uses: bitwarden/gh-actions/.github/workflows/workflow-linter.yml@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>2023.9.0</Version>
|
<Version>2023.9.1</Version>
|
||||||
<RootNamespace>Bit.$(MSBuildProjectName)</RootNamespace>
|
<RootNamespace>Bit.$(MSBuildProjectName)</RootNamespace>
|
||||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
@ -118,6 +118,7 @@ public class OrganizationSubscriptionResponseModel : OrganizationResponseModel
|
|||||||
{
|
{
|
||||||
Subscription = subscription.Subscription != null ? new BillingSubscription(subscription.Subscription) : null;
|
Subscription = subscription.Subscription != null ? new BillingSubscription(subscription.Subscription) : null;
|
||||||
UpcomingInvoice = subscription.UpcomingInvoice != null ? new BillingSubscriptionUpcomingInvoice(subscription.UpcomingInvoice) : null;
|
UpcomingInvoice = subscription.UpcomingInvoice != null ? new BillingSubscriptionUpcomingInvoice(subscription.UpcomingInvoice) : null;
|
||||||
|
Discount = subscription.Discount != null ? new BillingCustomerDiscount(subscription.Discount) : null;
|
||||||
Expiration = DateTime.UtcNow.AddYears(1); // Not used, so just give it a value.
|
Expiration = DateTime.UtcNow.AddYears(1); // Not used, so just give it a value.
|
||||||
|
|
||||||
if (hideSensitiveData)
|
if (hideSensitiveData)
|
||||||
@ -148,6 +149,7 @@ public class OrganizationSubscriptionResponseModel : OrganizationResponseModel
|
|||||||
|
|
||||||
public string StorageName { get; set; }
|
public string StorageName { get; set; }
|
||||||
public double? StorageGb { get; set; }
|
public double? StorageGb { get; set; }
|
||||||
|
public BillingCustomerDiscount Discount { get; set; }
|
||||||
public BillingSubscription Subscription { get; set; }
|
public BillingSubscription Subscription { get; set; }
|
||||||
public BillingSubscriptionUpcomingInvoice UpcomingInvoice { get; set; }
|
public BillingSubscriptionUpcomingInvoice UpcomingInvoice { get; set; }
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ public class SubscriptionResponseModel : ResponseModel
|
|||||||
Subscription = subscription.Subscription != null ? new BillingSubscription(subscription.Subscription) : null;
|
Subscription = subscription.Subscription != null ? new BillingSubscription(subscription.Subscription) : null;
|
||||||
UpcomingInvoice = subscription.UpcomingInvoice != null ?
|
UpcomingInvoice = subscription.UpcomingInvoice != null ?
|
||||||
new BillingSubscriptionUpcomingInvoice(subscription.UpcomingInvoice) : null;
|
new BillingSubscriptionUpcomingInvoice(subscription.UpcomingInvoice) : null;
|
||||||
|
Discount = subscription.Discount != null ? new BillingCustomerDiscount(subscription.Discount) : null;
|
||||||
StorageName = user.Storage.HasValue ? CoreHelpers.ReadableBytesSize(user.Storage.Value) : null;
|
StorageName = user.Storage.HasValue ? CoreHelpers.ReadableBytesSize(user.Storage.Value) : null;
|
||||||
StorageGb = user.Storage.HasValue ? Math.Round(user.Storage.Value / 1073741824D, 2) : 0; // 1 GB
|
StorageGb = user.Storage.HasValue ? Math.Round(user.Storage.Value / 1073741824D, 2) : 0; // 1 GB
|
||||||
MaxStorageGb = user.MaxStorageGb;
|
MaxStorageGb = user.MaxStorageGb;
|
||||||
@ -41,11 +42,24 @@ public class SubscriptionResponseModel : ResponseModel
|
|||||||
public short? MaxStorageGb { get; set; }
|
public short? MaxStorageGb { get; set; }
|
||||||
public BillingSubscriptionUpcomingInvoice UpcomingInvoice { get; set; }
|
public BillingSubscriptionUpcomingInvoice UpcomingInvoice { get; set; }
|
||||||
public BillingSubscription Subscription { get; set; }
|
public BillingSubscription Subscription { get; set; }
|
||||||
|
public BillingCustomerDiscount Discount { get; set; }
|
||||||
public UserLicense License { get; set; }
|
public UserLicense License { get; set; }
|
||||||
public DateTime? Expiration { get; set; }
|
public DateTime? Expiration { get; set; }
|
||||||
public bool UsingInAppPurchase { get; set; }
|
public bool UsingInAppPurchase { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class BillingCustomerDiscount
|
||||||
|
{
|
||||||
|
public BillingCustomerDiscount(SubscriptionInfo.BillingCustomerDiscount discount)
|
||||||
|
{
|
||||||
|
Id = discount.Id;
|
||||||
|
Active = discount.Active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Id { get; set; }
|
||||||
|
public bool Active { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class BillingSubscription
|
public class BillingSubscription
|
||||||
{
|
{
|
||||||
public BillingSubscription(SubscriptionInfo.BillingSubscription sub)
|
public BillingSubscription(SubscriptionInfo.BillingSubscription sub)
|
||||||
|
@ -20,7 +20,7 @@ public static class Constants
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const int OrganizationSelfHostSubscriptionGracePeriodDays = 60;
|
public const int OrganizationSelfHostSubscriptionGracePeriodDays = 60;
|
||||||
|
|
||||||
public const string CipherKeyEncryptionMinimumVersion = "2023.9.1";
|
public const string CipherKeyEncryptionMinimumVersion = "2023.9.2";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TokenPurposes
|
public static class TokenPurposes
|
||||||
|
@ -5,10 +5,25 @@ namespace Bit.Core.Models.Business;
|
|||||||
|
|
||||||
public class SubscriptionInfo
|
public class SubscriptionInfo
|
||||||
{
|
{
|
||||||
|
public BillingCustomerDiscount Discount { get; set; }
|
||||||
public BillingSubscription Subscription { get; set; }
|
public BillingSubscription Subscription { get; set; }
|
||||||
public BillingUpcomingInvoice UpcomingInvoice { get; set; }
|
public BillingUpcomingInvoice UpcomingInvoice { get; set; }
|
||||||
public bool UsingInAppPurchase { get; set; }
|
public bool UsingInAppPurchase { get; set; }
|
||||||
|
|
||||||
|
public class BillingCustomerDiscount
|
||||||
|
{
|
||||||
|
public BillingCustomerDiscount() { }
|
||||||
|
|
||||||
|
public BillingCustomerDiscount(Discount discount)
|
||||||
|
{
|
||||||
|
Id = discount.Id;
|
||||||
|
Active = discount.Start != null && discount.End == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Id { get; }
|
||||||
|
public bool Active { get; }
|
||||||
|
}
|
||||||
|
|
||||||
public class BillingSubscription
|
public class BillingSubscription
|
||||||
{
|
{
|
||||||
public BillingSubscription(Subscription sub)
|
public BillingSubscription(Subscription sub)
|
||||||
|
@ -1557,10 +1557,19 @@ public class StripePaymentService : IPaymentService
|
|||||||
{
|
{
|
||||||
var subscriptionInfo = new SubscriptionInfo();
|
var subscriptionInfo = new SubscriptionInfo();
|
||||||
|
|
||||||
if (subscriber.IsUser() && !string.IsNullOrWhiteSpace(subscriber.GatewayCustomerId))
|
if (!string.IsNullOrWhiteSpace(subscriber.GatewayCustomerId))
|
||||||
{
|
{
|
||||||
var customer = await _stripeAdapter.CustomerGetAsync(subscriber.GatewayCustomerId);
|
var customer = await _stripeAdapter.CustomerGetAsync(subscriber.GatewayCustomerId);
|
||||||
subscriptionInfo.UsingInAppPurchase = customer.Metadata.ContainsKey("appleReceipt");
|
|
||||||
|
if (customer.Discount != null)
|
||||||
|
{
|
||||||
|
subscriptionInfo.Discount = new SubscriptionInfo.BillingCustomerDiscount(customer.Discount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subscriber.IsUser())
|
||||||
|
{
|
||||||
|
subscriptionInfo.UsingInAppPurchase = customer.Metadata.ContainsKey("appleReceipt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(subscriber.GatewaySubscriptionId))
|
if (!string.IsNullOrWhiteSpace(subscriber.GatewaySubscriptionId))
|
||||||
|
Reference in New Issue
Block a user