mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-29 03:44:27 +01:00
* LNURL Payment Method Support * Merge recent Lightning controller related changes * Fix build * Create separate payment settings section for stores * Improve LNURL configuration * Prevent duplicate array entries when merging Swagger JSON * Fix CanSetPaymentMethodLimitsLightning * Fix CanUsePayjoinViaUI * Adapt test for new cancel bolt invoice feature * rebase fixes * Fixes after rebase * Test fixes * Do not turn LNURL on by default, Off-Chain payment criteria should affects both BOLT11 and LNURL, Payment criteria of unset payment method shouldn't be shown * Send better error if payment method not found * Revert "Prevent duplicate array entries when merging Swagger JSON" This reverts commit 5783db9eda17c29908a60fdef2c3ebe130a8b059. * Fix LNUrl doc * Fix some warnings Co-authored-by: Dennis Reimann <mail@dennisreimann.de> Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using BTCPayServer.Client.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using NBitcoin;
|
|
|
|
namespace BTCPayServer.Data
|
|
{
|
|
public class PayoutData
|
|
{
|
|
[Key]
|
|
[MaxLength(30)]
|
|
public string Id { get; set; }
|
|
public DateTimeOffset Date { get; set; }
|
|
public string PullPaymentDataId { get; set; }
|
|
public PullPaymentData PullPaymentData { get; set; }
|
|
[MaxLength(20)]
|
|
public PayoutState State { get; set; }
|
|
[MaxLength(20)]
|
|
[Required]
|
|
public string PaymentMethodId { get; set; }
|
|
public byte[] Blob { get; set; }
|
|
public byte[] Proof { get; set; }
|
|
#nullable enable
|
|
public string? Destination { get; set; }
|
|
#nullable restore
|
|
|
|
internal static void OnModelCreating(ModelBuilder builder)
|
|
{
|
|
builder.Entity<PayoutData>()
|
|
.HasOne(o => o.PullPaymentData)
|
|
.WithMany(o => o.Payouts).OnDelete(DeleteBehavior.Cascade);
|
|
builder.Entity<PayoutData>()
|
|
.Property(o => o.State)
|
|
.HasConversion<string>();
|
|
builder.Entity<PayoutData>()
|
|
.HasIndex(o => o.State);
|
|
builder.Entity<PayoutData>()
|
|
.HasIndex(x => new { DestinationId = x.Destination, x.State});
|
|
}
|
|
|
|
// utility methods
|
|
public bool IsInPeriod(PullPaymentData pp, DateTimeOffset now)
|
|
{
|
|
var period = pp.GetPeriod(now);
|
|
if (period is { } p)
|
|
{
|
|
return p.Start <= Date && (p.End is DateTimeOffset end ? Date < end : true);
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|