2023-05-09 13:56:57 +00:00
|
|
|
|
using VoidCat.Database;
|
2022-09-07 14:52:40 +00:00
|
|
|
|
using VoidCat.Services.Abstractions;
|
|
|
|
|
|
|
|
|
|
namespace VoidCat.Services.Payment;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc cref="IPaymentOrderStore"/>
|
2023-05-09 13:56:57 +00:00
|
|
|
|
public class CachePaymentOrderStore : BasicCacheStore<PaywallOrder>, IPaymentOrderStore
|
2022-09-07 14:52:40 +00:00
|
|
|
|
{
|
|
|
|
|
public CachePaymentOrderStore(ICache cache) : base(cache)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2023-05-09 13:56:57 +00:00
|
|
|
|
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}";
|
|
|
|
|
}
|