mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
@@ -2,21 +2,20 @@ namespace BTCPayServer.Client.Models;
|
|||||||
|
|
||||||
public class AssetPairData
|
public class AssetPairData
|
||||||
{
|
{
|
||||||
|
|
||||||
public AssetPairData()
|
public AssetPairData()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetPairData(string AssetBought, string AssetSold)
|
public AssetPairData(string assetBought, string assetSold)
|
||||||
{
|
{
|
||||||
this.AssetBought = AssetBought;
|
AssetBought = assetBought;
|
||||||
this.AssetSold = AssetSold;
|
AssetSold = assetSold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string AssetBought { set; get; }
|
public string AssetBought { set; get; }
|
||||||
public string AssetSold { set; get; }
|
public string AssetSold { set; get; }
|
||||||
|
|
||||||
public string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return AssetBought + "/" + AssetSold;
|
return AssetBought + "/" + AssetSold;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,12 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||||||
{
|
{
|
||||||
return validationResult;
|
return validationResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultCurrency = (await _storeRepository.FindStore(storeId)).GetStoreBlob().DefaultCurrency;
|
var store = await _storeRepository.FindStore(storeId);
|
||||||
|
if (store == null)
|
||||||
|
return this.CreateAPIError(404, "store-not-found", "The store was not found");
|
||||||
|
|
||||||
|
var defaultCurrency = store.GetStoreBlob().DefaultCurrency;
|
||||||
var appData = new AppData
|
var appData = new AppData
|
||||||
{
|
{
|
||||||
StoreDataId = storeId,
|
StoreDataId = storeId,
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace BTCPayServer.Controllers
|
|||||||
[Authorize(Policy = Policies.CanViewStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
|
[Authorize(Policy = Policies.CanViewStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
|
||||||
public async Task<IActionResult> Invoice(string invoiceId)
|
public async Task<IActionResult> Invoice(string invoiceId)
|
||||||
{
|
{
|
||||||
var invoice = (await _InvoiceRepository.GetInvoices(new InvoiceQuery()
|
var invoice = (await _InvoiceRepository.GetInvoices(new InvoiceQuery
|
||||||
{
|
{
|
||||||
InvoiceId = new[] { invoiceId },
|
InvoiceId = new[] { invoiceId },
|
||||||
UserId = GetUserId(),
|
UserId = GetUserId(),
|
||||||
@@ -99,6 +99,9 @@ namespace BTCPayServer.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
||||||
var store = await _StoreRepository.FindStore(invoice.StoreId);
|
var store = await _StoreRepository.FindStore(invoice.StoreId);
|
||||||
|
if (store == null)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
var invoiceState = invoice.GetInvoiceState();
|
var invoiceState = invoice.GetInvoiceState();
|
||||||
var model = new InvoiceDetailsModel
|
var model = new InvoiceDetailsModel
|
||||||
{
|
{
|
||||||
@@ -541,7 +544,11 @@ namespace BTCPayServer.Controllers
|
|||||||
var invoice = await _InvoiceRepository.GetInvoice(invoiceId);
|
var invoice = await _InvoiceRepository.GetInvoice(invoiceId);
|
||||||
if (invoice == null)
|
if (invoice == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var store = await _StoreRepository.FindStore(invoice.StoreId);
|
var store = await _StoreRepository.FindStore(invoice.StoreId);
|
||||||
|
if (store == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
bool isDefaultPaymentId = false;
|
bool isDefaultPaymentId = false;
|
||||||
if (paymentMethodId is null)
|
if (paymentMethodId is null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,23 +26,22 @@ namespace BTCPayServer.HostedServices
|
|||||||
Invoice = invoice;
|
Invoice = invoice;
|
||||||
}
|
}
|
||||||
public InvoiceEntity Invoice { get; set; }
|
public InvoiceEntity Invoice { get; set; }
|
||||||
public List<object> Events { get; set; } = new List<object>();
|
public List<object> Events { get; set; } = new ();
|
||||||
|
|
||||||
bool _Dirty = false;
|
bool _dirty;
|
||||||
private bool _Unaffect;
|
|
||||||
|
|
||||||
public void MarkDirty()
|
public void MarkDirty()
|
||||||
{
|
{
|
||||||
_Dirty = true;
|
_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Dirty => _Dirty;
|
public bool Dirty => _dirty;
|
||||||
|
|
||||||
bool _IsBlobUpdated;
|
bool _isBlobUpdated;
|
||||||
public bool IsBlobUpdated => _IsBlobUpdated;
|
public bool IsBlobUpdated => _isBlobUpdated;
|
||||||
public void BlobUpdated()
|
public void BlobUpdated()
|
||||||
{
|
{
|
||||||
_IsBlobUpdated = true;
|
_isBlobUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,10 +65,10 @@ namespace BTCPayServer.HostedServices
|
|||||||
_explorerClientProvider = explorerClientProvider;
|
_explorerClientProvider = explorerClientProvider;
|
||||||
_notificationSender = notificationSender;
|
_notificationSender = notificationSender;
|
||||||
_paymentService = paymentService;
|
_paymentService = paymentService;
|
||||||
this.Logs = logs;
|
Logs = logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly CompositeDisposable leases = new CompositeDisposable();
|
readonly CompositeDisposable _leases = new ();
|
||||||
|
|
||||||
|
|
||||||
private void UpdateInvoice(UpdateInvoiceContext context)
|
private void UpdateInvoice(UpdateInvoiceContext context)
|
||||||
@@ -270,11 +269,11 @@ namespace BTCPayServer.HostedServices
|
|||||||
_Loop = StartLoop(_Cts.Token);
|
_Loop = StartLoop(_Cts.Token);
|
||||||
_ = WaitPendingInvoices();
|
_ = WaitPendingInvoices();
|
||||||
|
|
||||||
leases.Add(_eventAggregator.Subscribe<Events.InvoiceNeedUpdateEvent>(b =>
|
_leases.Add(_eventAggregator.Subscribe<Events.InvoiceNeedUpdateEvent>(b =>
|
||||||
{
|
{
|
||||||
Watch(b.InvoiceId);
|
Watch(b.InvoiceId);
|
||||||
}));
|
}));
|
||||||
leases.Add(_eventAggregator.SubscribeAsync<Events.InvoiceEvent>(async b =>
|
_leases.Add(_eventAggregator.SubscribeAsync<Events.InvoiceEvent>(async b =>
|
||||||
{
|
{
|
||||||
if (InvoiceEventNotification.HandlesEvent(b.Name))
|
if (InvoiceEventNotification.HandlesEvent(b.Name))
|
||||||
{
|
{
|
||||||
@@ -410,7 +409,7 @@ namespace BTCPayServer.HostedServices
|
|||||||
{
|
{
|
||||||
if (_Cts == null)
|
if (_Cts == null)
|
||||||
return;
|
return;
|
||||||
leases.Dispose();
|
_leases.Dispose();
|
||||||
_Cts.Cancel();
|
_Cts.Cancel();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace BTCPayServer.PayoutProcessors.OnChain
|
|||||||
workingTx = txBuilder.BuildTransaction(true);
|
workingTx = txBuilder.BuildTransaction(true);
|
||||||
transfersProcessing.Add(transferRequest);
|
transfersProcessing.Add(transferRequest);
|
||||||
}
|
}
|
||||||
catch (NotEnoughFundsException e)
|
catch (NotEnoughFundsException)
|
||||||
{
|
{
|
||||||
|
|
||||||
failedAmount = blob.CryptoAmount;
|
failedAmount = blob.CryptoAmount;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace BTCPayServer.Services.Stores
|
|||||||
{
|
{
|
||||||
if (storeId == null)
|
if (storeId == null)
|
||||||
return null;
|
return null;
|
||||||
using var ctx = _ContextFactory.CreateContext();
|
await using var ctx = _ContextFactory.CreateContext();
|
||||||
var result = await ctx.FindAsync<StoreData>(storeId).ConfigureAwait(false);
|
var result = await ctx.FindAsync<StoreData>(storeId).ConfigureAwait(false);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user