Skip to content

Commit

Permalink
delete web compose files
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEggenberger committed Apr 25, 2024
1 parent a0a5367 commit c60bd67
Show file tree
Hide file tree
Showing 24 changed files with 700 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ namespace Modules.Subscriptions.Features.DomainFeatures.StripeCustomerAggregate
public class StripeCustomer : AggregateRoot
{
public Guid UserId { get; set; }
public string StripeCustomerId { get; set; }
public string StripePortalCustomerId { get; set; }
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Modules.Subscriptions.Features.Infrastructure.StripePayments;
using Shared.Features.Modules.Configuration;
using Shared.Kernel.BuildingBlocks.Auth;
using Shared.Kernel.BuildingBlocks.Auth.DomainKernel;

namespace Modules.Subscriptions.Features.Infrastructure.Configuration
{
public class SubscriptionsConfiguration : IModuleConfiguration
{
public string StripeAPIKey { get; set; }
public string StripeEndpointSecret { get; set; }
public string StripeProfessionalPlanPriceId { get; set; }
public string StripeEnterprisePlanPriceId { get; set; }

public StripeSubscriptionPlan GetSubscriptionType(SubscriptionPlanType subscriptionPlanType)
{
return Subscriptions.Single(s => s.Type == subscriptionPlanType);
}

public List<StripeSubscriptionPlan> Subscriptions => new List<StripeSubscriptionPlan>()
{
new StripeSubscriptionPlan
{
Type = SubscriptionPlanType.Professional,
TrialPeriodDays = 14,
StripePriceId = StripeProfessionalPlanPriceId
},
new StripeSubscriptionPlan
{
Type = SubscriptionPlanType.Enterprise,
TrialPeriodDays = 14,
StripePriceId = StripeEnterprisePlanPriceId
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.Extensions.Options;

namespace Modules.Subscriptions.Features.Infrastructure.Configuration
{
public class SubscriptionsConfigurationValidator : IValidateOptions<SubscriptionsConfiguration>
{
public ValidateOptionsResult Validate(string name, SubscriptionsConfiguration options)
{
if (string.IsNullOrEmpty(options.StripeProfessionalPlanPriceId))
{
throw new ArgumentNullException();
}

return ValidateOptionsResult.Success;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Modules.Subscriptions.Features.Infrastructure.EFCore.Migrations
{
/// <inheritdoc />
public partial class initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "Subscriptions");

migrationBuilder.CreateTable(
name: "StripeCustomers",
schema: "Subscriptions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StripePortalCustomerId = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedByUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RowVersion = table.Column<byte[]>(type: "varbinary(max)", nullable: true),
CreatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
LastUpdatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StripeCustomers", x => x.Id);
});

migrationBuilder.CreateTable(
name: "StripeSubscriptions",
schema: "Subscriptions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StripeCustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ExpirationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
PlanType = table.Column<int>(type: "int", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
CreatedByUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RowVersion = table.Column<byte[]>(type: "varbinary(max)", nullable: true),
CreatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
LastUpdatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StripeSubscriptions", x => x.Id);
table.ForeignKey(
name: "FK_StripeSubscriptions_StripeCustomers_StripeCustomerId",
column: x => x.StripeCustomerId,
principalSchema: "Subscriptions",
principalTable: "StripeCustomers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.CreateIndex(
name: "IX_StripeSubscriptions_StripeCustomerId",
schema: "Subscriptions",
table: "StripeSubscriptions",
column: "StripeCustomerId");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "StripeSubscriptions",
schema: "Subscriptions");

migrationBuilder.DropTable(
name: "StripeCustomers",
schema: "Subscriptions");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c60bd67

Please sign in to comment.