first commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
namespace Fitness_core_BE.DTOs.PlatformBilling
|
||||
{
|
||||
// The gym's own saved card(s) for paying their HexaFitness platform subscription
|
||||
// (ClientCard), and the transaction history behind those charges. Distinct from
|
||||
// PaymentGatewayDtos.cs (admin gateway catalog) and PaymentsEnablementDtos.cs
|
||||
// (payout track/KYC/wallet) — this is the "gym pays HexaFitness" card-charging surface.
|
||||
|
||||
// Fetched live from Payment-Service on every call — CardToken is the identifier (not a
|
||||
// local id), and none of these fields are ever cached in Core's own database.
|
||||
public class ClientCardDto
|
||||
{
|
||||
public string CardToken { get; set; } = string.Empty;
|
||||
public string MaskedPan { get; set; } = string.Empty;
|
||||
public string CardBrand { get; set; } = string.Empty;
|
||||
public int ExpiryMonth { get; set; }
|
||||
public int ExpiryYear { get; set; }
|
||||
public bool IsDefault { get; set; }
|
||||
}
|
||||
|
||||
public class StartCardOnboardingRequest
|
||||
{
|
||||
public string? CardLabel { get; set; }
|
||||
public string? ReturnUrl { get; set; }
|
||||
}
|
||||
|
||||
public class StartCardOnboardingResult
|
||||
{
|
||||
public string RedirectUrl { get; set; } = string.Empty;
|
||||
public string SessionId { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class CardOnboardingStatusResult
|
||||
{
|
||||
public bool IsComplete { get; set; }
|
||||
public ClientCardDto? Card { get; set; }
|
||||
}
|
||||
|
||||
public class TransactionHistoryItemDto
|
||||
{
|
||||
public Guid PaymentId { get; set; }
|
||||
public decimal AmountMinorUnits { get; set; }
|
||||
public string Currency { get; set; } = string.Empty;
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public DateTime CreatedAtUtc { get; set; }
|
||||
}
|
||||
|
||||
public class TransactionHistoryResult
|
||||
{
|
||||
public int Total { get; set; }
|
||||
public int Page { get; set; }
|
||||
public List<TransactionHistoryItemDto> Items { get; set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
namespace Fitness_core_BE.DTOs.PlatformBilling
|
||||
{
|
||||
public class PricingPlanDto
|
||||
{
|
||||
public Guid ClientPackageId { get; set; }
|
||||
public string? PackageName { get; set; }
|
||||
public string? PackageDescription { get; set; }
|
||||
public decimal PerMemberRate { get; set; }
|
||||
public decimal MinimumMonthlyBill { get; set; }
|
||||
public decimal? MonthlyCap { get; set; }
|
||||
public decimal SetupFee { get; set; }
|
||||
public int IncludedMemberCount { get; set; }
|
||||
public int? MaxBillableMemberCount { get; set; }
|
||||
public decimal OwnGatewayFeePercent { get; set; }
|
||||
public decimal OwnGatewayFeeFixed { get; set; }
|
||||
public decimal OurGatewayFeePercent { get; set; }
|
||||
public decimal OurGatewayFeeFixed { get; set; }
|
||||
public int PayoutDayOfMonth { get; set; }
|
||||
public bool IsDefault { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
|
||||
public class UpsertPricingPlanRequest
|
||||
{
|
||||
public Guid? ClientPackageId { get; set; }
|
||||
public string PackageName { get; set; } = string.Empty;
|
||||
public string? PackageDescription { get; set; }
|
||||
public decimal PerMemberRate { get; set; }
|
||||
public decimal MinimumMonthlyBill { get; set; }
|
||||
public decimal? MonthlyCap { get; set; }
|
||||
public decimal SetupFee { get; set; }
|
||||
public int IncludedMemberCount { get; set; }
|
||||
public int? MaxBillableMemberCount { get; set; }
|
||||
public decimal OwnGatewayFeePercent { get; set; }
|
||||
public decimal OwnGatewayFeeFixed { get; set; }
|
||||
public decimal OurGatewayFeePercent { get; set; }
|
||||
public decimal OurGatewayFeeFixed { get; set; }
|
||||
public int PayoutDayOfMonth { get; set; } = 1;
|
||||
public bool IsDefault { get; set; }
|
||||
}
|
||||
|
||||
public class DevicePricingDto
|
||||
{
|
||||
public decimal DeviceRentalFeePerMonth { get; set; }
|
||||
public decimal DeviceInstallationFee { get; set; }
|
||||
public decimal DeviceConfigureExistingFee { get; set; }
|
||||
}
|
||||
|
||||
public class AssignPricingPlanRequest
|
||||
{
|
||||
public Guid ClientPackageId { get; set; }
|
||||
// Optional: decide the fingerprint-machine charge at the same time as the plan assignment.
|
||||
public string? DeviceBillingMode { get; set; } // "FullPurchase" | "Rental" | null (no device charge)
|
||||
public decimal? DeviceAgreedAmount { get; set; }
|
||||
public decimal? DeviceSetupFee { get; set; }
|
||||
}
|
||||
|
||||
public class ClientDeviceBillingDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Mode { get; set; } = "Rental";
|
||||
public decimal AgreedAmount { get; set; }
|
||||
public decimal SetupFee { get; set; }
|
||||
public DateTime AssignedAt { get; set; }
|
||||
}
|
||||
|
||||
public class RecordClientInvoicePaymentRequest
|
||||
{
|
||||
public decimal Amount { get; set; }
|
||||
}
|
||||
|
||||
public class PlatformFeeBreakdownDto
|
||||
{
|
||||
public Guid ClientId { get; set; }
|
||||
public string? PlanName { get; set; }
|
||||
public int ActiveMemberCount { get; set; }
|
||||
public decimal PerMemberRate { get; set; }
|
||||
public decimal MinimumMonthlyBill { get; set; }
|
||||
public decimal? MonthlyCap { get; set; }
|
||||
public decimal BaseFee { get; set; }
|
||||
public int DeviceCount { get; set; }
|
||||
public decimal DeviceFee { get; set; }
|
||||
public decimal GatewayFee { get; set; }
|
||||
public decimal TotalFee { get; set; }
|
||||
}
|
||||
|
||||
public class ClientInvoiceItemDto
|
||||
{
|
||||
public string? ItemName { get; set; }
|
||||
public string? ItemDescription { get; set; }
|
||||
public decimal ItemPrice { get; set; }
|
||||
}
|
||||
|
||||
public class ClientInvoiceSummaryDto
|
||||
{
|
||||
public Guid ClientInvoiceId { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public DateTime ClientInvoiceDate { get; set; }
|
||||
public List<ClientInvoiceItemDto> Items { get; set; } = new();
|
||||
}
|
||||
|
||||
public class PendingPlatformInvoiceDto
|
||||
{
|
||||
public Guid ClientInvoiceId { get; set; }
|
||||
public Guid ClientId { get; set; }
|
||||
public string? ClientName { get; set; }
|
||||
public string? City { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public decimal PaidAmount { get; set; }
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public DateTime ClientInvoiceDate { get; set; }
|
||||
public int DaysOverdue { get; set; }
|
||||
}
|
||||
|
||||
// Result of one worker run: RunAndChargeSubscriptionBillingAsync both generates any
|
||||
// invoices newly due this period and drives them (and any still-in-flight from a prior
|
||||
// run) toward Paid/Failed via Payment-Service.
|
||||
public class SubscriptionChargeRunResult
|
||||
{
|
||||
public int InvoicesGenerated { get; set; }
|
||||
public int ChargesAttempted { get; set; }
|
||||
public int Paid { get; set; }
|
||||
public int StillProcessing { get; set; }
|
||||
public int Failed { get; set; }
|
||||
public int SkippedNoCard { get; set; }
|
||||
// A prior attempt already came back Failed — Payment-Service payments can never leave
|
||||
// Failed, so these are left Pending for the existing manual pay-link fallback rather
|
||||
// than retried automatically here.
|
||||
public int SkippedPreviouslyFailed { get; set; }
|
||||
// The invoice's balance changed (e.g. an admin recorded a manual partial payment) since
|
||||
// an in-flight charge was created for the old balance — retrying would either overcharge
|
||||
// or hit Payment-Service's idempotency-conflict check, so this is left for manual review.
|
||||
public int SkippedAmountMismatch { get; set; }
|
||||
public int Errors { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user