mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Make tx label endpoint not error
This commit is contained in:
parent
5ef31a96ea
commit
4be5eb39ff
@ -85,11 +85,14 @@ namespace BTCPayServer.Client
|
||||
public virtual async Task<OnChainWalletTransactionData> PatchOnChainWalletTransaction(
|
||||
string storeId, string cryptoCode, string transactionId,
|
||||
PatchOnChainTransactionRequest request,
|
||||
CancellationToken token = default)
|
||||
bool force = false, CancellationToken token = default)
|
||||
{
|
||||
var response =
|
||||
await _httpClient.SendAsync(
|
||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/transactions/{transactionId}", queryPayload: null, bodyPayload: request, HttpMethod.Patch), token);
|
||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/transactions/{transactionId}", queryPayload: new Dictionary<string, object>()
|
||||
{
|
||||
{"force", force}
|
||||
}, bodyPayload: request, HttpMethod.Patch), token);
|
||||
return await HandleResponse<OnChainWalletTransactionData>(response);
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,8 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
string storeId,
|
||||
string cryptoCode,
|
||||
string transactionId,
|
||||
[FromBody] PatchOnChainTransactionRequest request
|
||||
[FromBody] PatchOnChainTransactionRequest request,
|
||||
bool force = false
|
||||
)
|
||||
{
|
||||
if (IsInvalidWalletRequest(cryptoCode, out var network,
|
||||
@ -263,7 +264,7 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
|
||||
var wallet = _btcPayWalletProvider.GetWallet(network);
|
||||
var tx = await wallet.FetchTransaction(derivationScheme.AccountDerivation, uint256.Parse(transactionId));
|
||||
if (tx is null)
|
||||
if (!force && tx is null)
|
||||
{
|
||||
return this.CreateAPIError(404, "transaction-not-found", "The transaction was not found.");
|
||||
}
|
||||
|
@ -990,11 +990,11 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
|
||||
public override async Task<OnChainWalletTransactionData> PatchOnChainWalletTransaction(string storeId,
|
||||
string cryptoCode, string transactionId,
|
||||
PatchOnChainTransactionRequest request, CancellationToken token = default)
|
||||
PatchOnChainTransactionRequest request, bool force = false,CancellationToken token = default)
|
||||
{
|
||||
return GetFromActionResult<OnChainWalletTransactionData>(
|
||||
await GetController<GreenfieldStoreOnChainWalletsController>().PatchOnChainWalletTransaction(storeId, cryptoCode, transactionId,
|
||||
request));
|
||||
request, force));
|
||||
}
|
||||
|
||||
public override async Task<LightningPaymentData> GetLightningPayment(string cryptoCode, string paymentHash,
|
||||
|
@ -513,6 +513,15 @@
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "force",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "Whether to update the label/comments even if the transaction does not yet exist",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
|
Loading…
Reference in New Issue
Block a user