This commit is contained in:
Kukks 2023-07-21 15:35:13 +02:00 committed by Dennis Reimann
parent 2cbbf4af7e
commit a1c86e011a
No known key found for this signature in database
GPG key ID: 5009E1797F03F8D0
2 changed files with 11 additions and 6 deletions

View file

@ -3,7 +3,7 @@
public class PairSuccessResult public class PairSuccessResult
{ {
public string Key { get; set; } public string Key { get; set; }
public string StoreId { get; set; } public string? StoreId { get; set; }
public string UserId { get; set; } public string UserId { get; set; }
public string? ExistingWallet { get; set; } public string? ExistingWallet { get; set; }

View file

@ -43,11 +43,16 @@ public class BtcPayAppController : Controller
return Unauthorized(); return Unauthorized();
} }
var store = await _storeRepository.FindStore(res.StoreId, res.UserId); StoreData? store = null;
if (store is null) if (res.StoreId is not null)
{ {
return NotFound(); store = await _storeRepository.FindStore(res.StoreId, res.UserId);
if (store is null)
{
return NotFound();
}
} }
var key = new APIKeyData() var key = new APIKeyData()
{ {
@ -60,7 +65,7 @@ public class BtcPayAppController : Controller
await _apiKeyRepository.CreateKey(key); await _apiKeyRepository.CreateKey(key);
var onchain = store.GetDerivationSchemeSettings(_btcPayNetworkProvider, "BTC"); var onchain = store?.GetDerivationSchemeSettings(_btcPayNetworkProvider, "BTC");
string? onchainSeed = null; string? onchainSeed = null;
if (onchain is not null) if (onchain is not null)
{ {
@ -71,7 +76,7 @@ public class BtcPayAppController : Controller
return Ok(new PairSuccessResult() return Ok(new PairSuccessResult()
{ {
Key = key.Id, Key = key.Id,
StoreId = store.Id, StoreId = store?.Id,
UserId = res.UserId, UserId = res.UserId,
ExistingWallet = ExistingWallet =
onchain?.AccountDerivation?.GetExtPubKeys()?.FirstOrDefault() onchain?.AccountDerivation?.GetExtPubKeys()?.FirstOrDefault()