Skip to content

Commit

Permalink
pauseactivesubscription command
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEggenberger committed Mar 26, 2024
1 parent cc393a7 commit 56a4cdb
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@

namespace Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptionAggregate.Application.Commands
{
public class CreateTrialingSubscriptionForTenant : ICommand
public class CreateTrialingSubscription : ICommand
{
public Guid UserId { get; set; }
public Guid TenantId { get; set; }
public string StripeCustomerId { get; set; }
public Stripe.Subscription CreatedStripeSubscription { get; set; }
}

public class CreateTrialingSubscriptionCommandHandler : ServerExecutionBase, ICommandHandler<CreateTrialingSubscriptionForTenant>
public class CreateTrialingSubscriptionCommandHandler : ServerExecutionBase, ICommandHandler<CreateTrialingSubscription>
{
private readonly SubscriptionsDbContext subscriptionDbContext;
private readonly SubscriptionsConfiguration subscriptionConfiguration;
private readonly IIntegrationEventDispatcher integrationEventDispatcher;

public CreateTrialingSubscriptionCommandHandler(
SubscriptionsDbContext subscriptionDbContext,
Expand All @@ -32,7 +31,7 @@ public CreateTrialingSubscriptionCommandHandler(
this.subscriptionConfiguration = subscriptionConfiguration;
}

public async Task HandleAsync(CreateTrialingSubscriptionForTenant command, CancellationToken cancellationToken)
public async Task HandleAsync(CreateTrialingSubscription command, CancellationToken cancellationToken)
{
var subscriptionType = subscriptionConfiguration.Subscriptions.First(s => s.StripePriceId == command.CreatedStripeSubscription.Items.First().Price.Id).Type;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptionAggregate.Application.Commands
{
public class UpdateSubscriptionPeriodEnd : ICommand
public class UpdateSubscriptionPeriod : ICommand
{
public Stripe.Subscription Subscription { get; set; }
}

public class UpdateSubscriptionPerioEndCommandHandler : ICommandHandler<UpdateSubscriptionPeriodEnd>
public class UpdateSubscriptionPerioEndCommandHandler : ICommandHandler<UpdateSubscriptionPeriod>
{
public Task HandleAsync(UpdateSubscriptionPeriodEnd command, CancellationToken cancellationToken)
public Task HandleAsync(UpdateSubscriptionPeriod command, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Shared.Features.CQRS.Command;

namespace Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptionAggregate.Application.Commands
{
public class UpdateSubscriptionPeriod : ICommand

Check failure on line 5 in Source/Modules/Subscriptions/Features/DomainFeatures/StripeSubscriptionAggregate/Application/Commands/UpdateSubscriptionPeriod.cs

View workflow job for this annotation

GitHub Actions / build

The namespace 'Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptionAggregate.Application.Commands' already contains a definition for 'UpdateSubscriptionPeriod'

Check failure on line 5 in Source/Modules/Subscriptions/Features/DomainFeatures/StripeSubscriptionAggregate/Application/Commands/UpdateSubscriptionPeriod.cs

View workflow job for this annotation

GitHub Actions / build

The namespace 'Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptionAggregate.Application.Commands' already contains a definition for 'UpdateSubscriptionPeriod'
{
public Stripe.Subscription Subscription { get; set; }
}

public class UpdateSubscriptionPerioEndCommandHandler : ICommandHandler<UpdateSubscriptionPeriod>

Check failure on line 10 in Source/Modules/Subscriptions/Features/DomainFeatures/StripeSubscriptionAggregate/Application/Commands/UpdateSubscriptionPeriod.cs

View workflow job for this annotation

GitHub Actions / build

The namespace 'Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptionAggregate.Application.Commands' already contains a definition for 'UpdateSubscriptionPerioEndCommandHandler'

Check failure on line 10 in Source/Modules/Subscriptions/Features/DomainFeatures/StripeSubscriptionAggregate/Application/Commands/UpdateSubscriptionPeriod.cs

View workflow job for this annotation

GitHub Actions / build

The namespace 'Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptionAggregate.Application.Commands' already contains a definition for 'UpdateSubscriptionPerioEndCommandHandler'
{
public Task HandleAsync(UpdateSubscriptionPeriod command, CancellationToken cancellationToken)

Check failure on line 12 in Source/Modules/Subscriptions/Features/DomainFeatures/StripeSubscriptionAggregate/Application/Commands/UpdateSubscriptionPeriod.cs

View workflow job for this annotation

GitHub Actions / build

Type 'UpdateSubscriptionPerioEndCommandHandler' already defines a member called 'HandleAsync' with the same parameter types

Check failure on line 12 in Source/Modules/Subscriptions/Features/DomainFeatures/StripeSubscriptionAggregate/Application/Commands/UpdateSubscriptionPeriod.cs

View workflow job for this annotation

GitHub Actions / build

Type 'UpdateSubscriptionPerioEndCommandHandler' already defines a member called 'HandleAsync' with the same parameter types
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Shared.Features.CQRS.Query;
using Shared.Kernel.BuildingBlocks.Auth.Attributes;

namespace Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptionAggregate.Application.Commands
namespace Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptionAggregate.Application.Queries
{
[AuthorizeTenantAdmin]
public class GetSubscriptionForTenant : IQuery<object>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task<IActionResult> Index()
var subscription = await new SubscriptionService().GetAsync(session.SubscriptionId);
var userId = subscription.Metadata["UserId"];

var createTrialingSubscription = new CreateTrialingSubscriptionForTenant
var createTrialingSubscription = new CreateTrialingSubscription
{
UserId = Guid.Parse(userId),
StripeCustomerId = subscription.CustomerId,
Expand All @@ -55,7 +55,12 @@ public async Task<IActionResult> Index()

var subscription = await new SubscriptionService().GetAsync(invoice.SubscriptionId);


var updateSubscriptionPeriod = new UpdateSubscriptionPeriod
{

};


}
// Sent each billing interval if there is an issue with your customer’s payment method. (Stripe)
else if (stripeEvent.Type == Events.InvoicePaymentFailed)
Expand Down

0 comments on commit 56a4cdb

Please sign in to comment.