2023-02-21 15:06:34 +09:00
|
|
|
using System;
|
2023-01-06 14:18:07 +01:00
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2022-04-24 05:19:34 +02:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2023-02-21 15:06:34 +09:00
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
2022-04-24 05:19:34 +02:00
|
|
|
|
2023-02-21 15:06:34 +09:00
|
|
|
namespace BTCPayServer.Data;
|
2022-04-24 05:19:34 +02:00
|
|
|
|
2023-02-21 15:06:34 +09:00
|
|
|
public class AutomatedPayoutBlob
|
|
|
|
{
|
|
|
|
public TimeSpan Interval { get; set; } = TimeSpan.FromHours(1);
|
2023-07-20 15:05:14 +02:00
|
|
|
public bool ProcessNewPayoutsInstantly { get; set; }
|
2023-02-21 15:06:34 +09:00
|
|
|
}
|
|
|
|
public class PayoutProcessorData : IHasBlobUntyped
|
2022-04-24 05:19:34 +02:00
|
|
|
{
|
|
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
public string Id { get; set; }
|
|
|
|
public string StoreId { get; set; }
|
|
|
|
public StoreData Store { get; set; }
|
2024-09-06 13:24:33 +09:00
|
|
|
public string PayoutMethodId { get; set; }
|
2022-04-24 05:19:34 +02:00
|
|
|
public string Processor { get; set; }
|
2023-01-06 14:18:07 +01:00
|
|
|
|
2023-02-21 15:06:34 +09:00
|
|
|
[Obsolete("Use Blob2 instead")]
|
2022-04-24 05:19:34 +02:00
|
|
|
public byte[] Blob { get; set; }
|
2023-02-21 15:06:34 +09:00
|
|
|
public string Blob2 { get; set; }
|
2023-01-06 14:18:07 +01:00
|
|
|
|
2023-02-21 15:06:34 +09:00
|
|
|
internal static void OnModelCreating(ModelBuilder builder, DatabaseFacade databaseFacade)
|
2022-04-24 05:19:34 +02:00
|
|
|
{
|
|
|
|
builder.Entity<PayoutProcessorData>()
|
|
|
|
.HasOne(o => o.Store)
|
|
|
|
.WithMany(data => data.PayoutProcessors).OnDelete(DeleteBehavior.Cascade);
|
2023-02-21 15:06:34 +09:00
|
|
|
|
2024-04-15 19:08:25 +09:00
|
|
|
builder.Entity<PayoutProcessorData>()
|
|
|
|
.Property(o => o.Blob2)
|
|
|
|
.HasColumnType("JSONB");
|
2022-04-24 05:19:34 +02:00
|
|
|
}
|
2022-08-17 09:45:51 +02:00
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
{
|
2024-09-06 13:24:33 +09:00
|
|
|
return $"{Processor} {PayoutMethodId} {StoreId}";
|
2022-08-17 09:45:51 +02:00
|
|
|
}
|
2022-04-24 05:19:34 +02:00
|
|
|
}
|