void.cat/VoidCat/Services/Payment/CachePaymentOrderStore.cs

26 lines
656 B
C#
Raw Normal View History

using VoidCat.Database;
2022-09-07 14:52:40 +00:00
using VoidCat.Services.Abstractions;
namespace VoidCat.Services.Payment;
/// <inheritdoc cref="IPaymentOrderStore"/>
public class CachePaymentOrderStore : BasicCacheStore<PaywallOrder>, IPaymentOrderStore
2022-09-07 14:52:40 +00:00
{
public CachePaymentOrderStore(ICache cache) : base(cache)
{
}
/// <inheritdoc />
public async ValueTask UpdateStatus(Guid order, PaywallOrderStatus status)
2022-09-07 14:52:40 +00:00
{
var old = await Get(order);
if (old == default) return;
old.Status = status;
await Add(order, old);
}
/// <inheritdoc />
protected override string MapKey(Guid id) => $"payment:order:{id}";
}