do not throw 500 if using a pairing code which does not exists

This commit is contained in:
nicolas.dorier 2017-10-23 14:12:54 +09:00
parent 0009ed0921
commit 752d34f603
2 changed files with 4 additions and 0 deletions

View file

@ -167,6 +167,8 @@ namespace BTCPayServer.Authentication
private PairingCodeEntity CreatePairingCodeEntity(PairingCodeData data)
{
if(data == null)
return null;
return new PairingCodeEntity()
{
Facade = data.Facade,

View file

@ -56,6 +56,8 @@ namespace BTCPayServer.Controllers
throw new BitpayHttpException(400, "'id' property is required, alternatively, use BitId");
pairingEntity = await _TokenRepository.GetPairingAsync(request.PairingCode);
if(pairingEntity == null)
throw new BitpayHttpException(404, "The specified pairingCode is not found");
pairingEntity.SIN = sin;
if(string.IsNullOrEmpty(pairingEntity.Label) && !string.IsNullOrEmpty(request.Label))