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 string Key { get; set; }
public string StoreId { get; set; }
public string? StoreId { get; set; }
public string UserId { get; set; }
public string? ExistingWallet { get; set; }

View file

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