Refactor payment request handling to support role change top-ups
- Updated the `PaymentRequest` model to include a new `Kind` property, distinguishing between `Subscription` and `RoleChangeTopUp` requests. - Modified the `TelegramNotifier` to accommodate the new request type, ensuring accurate notifications for role change top-ups. - Enhanced the `ConfirmPaymentRequestCommandHandler` to handle role change top-ups without extending the billing period, reflecting the new payment logic. - Updated various application components and tests to support the new payment request structure and ensure proper functionality. - Revised API documentation to clarify the behavior of role change top-ups and their impact on billing.
This commit is contained in:
+1
@@ -11,6 +11,7 @@ public class PaymentRequestConfiguration : IEntityTypeConfiguration<PaymentReque
|
||||
builder.ToTable("PaymentRequests");
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Kind).HasConversion<string>().HasMaxLength(32);
|
||||
builder.Property(x => x.Period).HasConversion<string>().HasMaxLength(32);
|
||||
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(32);
|
||||
builder.Property(x => x.RejectionReason).HasMaxLength(500);
|
||||
|
||||
+1073
File diff suppressed because it is too large
Load Diff
+52
@@ -0,0 +1,52 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PnvPanel.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPaymentRequestKind : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Period",
|
||||
table: "PaymentRequests",
|
||||
type: "character varying(32)",
|
||||
maxLength: 32,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(32)",
|
||||
oldMaxLength: 32);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Kind",
|
||||
table: "PaymentRequests",
|
||||
type: "character varying(32)",
|
||||
maxLength: 32,
|
||||
nullable: false,
|
||||
defaultValue: "Subscription");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Kind",
|
||||
table: "PaymentRequests");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Period",
|
||||
table: "PaymentRequests",
|
||||
type: "character varying(32)",
|
||||
maxLength: 32,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(32)",
|
||||
oldMaxLength: 32,
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -293,11 +293,15 @@ namespace PnvPanel.Infrastructure.Persistence.Migrations
|
||||
b.Property<Guid?>("DecidedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Period")
|
||||
b.Property<string>("Kind")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<string>("Period")
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<string>("RejectionReason")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
Reference in New Issue
Block a user