-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Step 2: Created default subscription, with default provider
- Loading branch information
1 parent
6ed2bf5
commit b03a851
Showing
86 changed files
with
2,064 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
using Application.Interfaces.Resources; | ||
|
||
namespace Application.Resources.Shared; | ||
|
||
|
||
public class Subscription : IIdentifiableResource | ||
{ | ||
public required string BuyerId { get; set; } | ||
|
||
public required string OwningEntityId { get; set; } | ||
|
||
public string? ProviderName { get; set; } | ||
|
||
public Dictionary<string, string> ProviderState { get; set; } = new(); | ||
|
||
public required string Id { get; set; } | ||
} | ||
|
||
public class SubscriptionForMigration : Subscription | ||
{ | ||
#pragma warning disable SAASAPP014 | ||
public required Dictionary<string, object> Buyer { get; set; } | ||
#pragma warning restore SAASAPP014 | ||
} | ||
|
||
public class SubscriptionWithPlan : Subscription | ||
{ | ||
public bool CanBeCancelled { get; set; } | ||
|
||
public bool CanBeUnsubscribed { get; set; } | ||
|
||
public DateTime? CancelledDateUtc { get; set; } | ||
|
||
public required InvoiceSummary Invoice { get; set; } | ||
|
||
public required SubscriptionPaymentMethod PaymentMethod { get; set; } | ||
|
||
public required PlanPeriod Period { get; set; } | ||
|
||
public required SubscriptionPlan Plan { get; set; } | ||
|
||
public SubscriptionStatus Status { get; set; } | ||
|
||
public required string SubscriptionId { get; set; } | ||
} | ||
|
||
public class SubscriptionPlan : IIdentifiableResource | ||
{ | ||
public bool IsTrial { get; set; } | ||
|
||
public SubscriptionTier Tier { get; set; } | ||
|
||
public DateTime? TrialEndDateUtc { get; set; } | ||
|
||
public required string Id { get; set; } | ||
} | ||
|
||
public class PlanPeriod | ||
{ | ||
public int Frequency { get; set; } | ||
|
||
public PeriodFrequencyUnit Unit { get; set; } | ||
} | ||
|
||
public enum PeriodFrequencyUnit | ||
{ | ||
Eternity = 0, | ||
Day = 1, | ||
Week = 2, | ||
Month = 3, | ||
Year = 4 | ||
} | ||
|
||
public enum SubscriptionStatus | ||
{ | ||
Unsubscribed = 0, | ||
Activated = 1, | ||
Cancelled = 2, | ||
Cancelling = 3 | ||
} | ||
|
||
public enum SubscriptionTier | ||
{ | ||
Unsubscribed = 0, | ||
Basic = 1, | ||
Premium = 2 | ||
} | ||
|
||
public class Invoice : IIdentifiableResource | ||
{ | ||
public decimal Amount { get; set; } // In the denomination of the Currency | ||
|
||
public required string Currency { get; set; } // ISO4217 | ||
|
||
public bool IncludesTax { get; set; } | ||
|
||
public DateTime InvoicedOnUtc { get; set; } | ||
|
||
public List<InvoiceLineItem> LineItems { get; set; } = new(); | ||
|
||
public List<InvoiceNote> Notes { get; set; } = new(); | ||
|
||
public required InvoiceItemPayment Payment { get; set; } | ||
|
||
public DateTime? PeriodEndUtc { get; set; } | ||
|
||
public DateTime? PeriodStartUtc { get; set; } | ||
|
||
public InvoiceStatus Status { get; set; } | ||
|
||
public decimal TaxAmount { get; set; } // In the denomination of the Currency | ||
|
||
public required string Id { get; set; } | ||
} | ||
|
||
public class InvoiceSummary | ||
{ | ||
public decimal Amount { get; set; } // In the denomination of the Currency | ||
|
||
public required string Currency { get; set; } // ISO4217 | ||
|
||
public DateTime? NextUtc { get; set; } | ||
} | ||
|
||
public class InvoiceLineItem | ||
{ | ||
public decimal Amount { get; set; } // In the denomination of the Currency | ||
|
||
public required string Currency { get; set; } // ISO4217 | ||
|
||
public required string Description { get; set; } | ||
|
||
public bool IsTaxed { get; set; } | ||
|
||
public required string Reference { get; set; } | ||
|
||
public decimal TaxAmount { get; set; } // In the denomination of the Currency | ||
} | ||
|
||
public class InvoiceItemPayment | ||
{ | ||
public decimal Amount { get; set; } // In the denomination of the Currency | ||
|
||
public required string Currency { get; set; } // ISO4217 | ||
|
||
public DateTime PaidOnUtc { get; set; } | ||
|
||
public required string Reference { get; set; } | ||
} | ||
|
||
public class InvoiceNote | ||
{ | ||
public required string Description { get; set; } | ||
} | ||
|
||
public enum InvoiceStatus | ||
{ | ||
Unpaid, | ||
Paid | ||
} | ||
|
||
public class SubscriptionPaymentMethod | ||
{ | ||
public static readonly SubscriptionPaymentMethod None = new() | ||
{ | ||
Status = PaymentMethodStatus.Invalid, | ||
Type = PaymentMethodType.None, | ||
ExpiresOn = null | ||
}; | ||
|
||
public DateOnly? ExpiresOn { get; set; } | ||
|
||
public PaymentMethodStatus Status { get; set; } | ||
|
||
public PaymentMethodType Type { get; set; } | ||
} | ||
|
||
public enum PaymentMethodType | ||
{ | ||
None = 0, | ||
Card = 1, | ||
Other = 2 | ||
} | ||
|
||
public enum PaymentMethodStatus | ||
{ | ||
Invalid = 0, | ||
Valid = 1 | ||
} | ||
|
||
public class PricingPlans | ||
{ | ||
public List<PricingPlan> Annually { get; set; } = new(); | ||
|
||
public List<PricingPlan> Daily { get; set; } = new(); | ||
|
||
public List<PricingPlan> Eternally { get; set; } = new(); | ||
|
||
public List<PricingPlan> Monthly { get; set; } = new(); | ||
|
||
public List<PricingPlan> Weekly { get; set; } = new(); | ||
} | ||
|
||
public class PricingPlan : IIdentifiableResource | ||
{ | ||
public required PlanPeriod Billing { get; set; } | ||
|
||
public required string Currency { get; set; } // ISO4217 | ||
|
||
public required string Description { get; set; } | ||
|
||
public required string DisplayName { get; set; } | ||
|
||
public List<PricingFeatureSection> FeatureSection { get; set; } = new(); | ||
|
||
public bool IsRecommended { get; set; } | ||
|
||
public required string Notes { get; set; } | ||
|
||
public required decimal Cost { get; set; } // In the denomination of the Currency | ||
|
||
public required decimal SetupCost { get; set; } // In the denomination of the Currency | ||
|
||
public required SubscriptionTrialPeriod Trial { get; set; } | ||
|
||
public required string Id { get; set; } | ||
} | ||
|
||
public class SubscriptionTrialPeriod | ||
{ | ||
public int Frequency { get; set; } | ||
|
||
public bool HasTrial { get; set; } | ||
|
||
public PeriodFrequencyUnit Unit { get; set; } | ||
} | ||
|
||
public class PricingFeatureSection | ||
{ | ||
public required string Description { get; set; } | ||
|
||
public List<PricingFeatureItem> Features { get; set; } = new(); | ||
} | ||
|
||
public class PricingFeatureItem | ||
{ | ||
public required string Description { get; set; } | ||
|
||
public bool IsIncluded { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.