In server-initiated situation, the server can set the label

This commit is contained in:
nicolas.dorier
2017-10-18 18:43:52 +09:00
parent 06a96e8b77
commit 94e9ab7f67
5 changed files with 13 additions and 3 deletions

View File

@@ -58,6 +58,12 @@ namespace BTCPayServer.Controllers
pairingEntity = await _TokenRepository.GetPairingAsync(request.PairingCode);
pairingEntity.SIN = sin;
if(string.IsNullOrEmpty(pairingEntity.Label) && !string.IsNullOrEmpty(request.Label))
{
pairingEntity.Label = request.Label;
await _TokenRepository.UpdatePairingCode(pairingEntity);
}
var result = await _TokenRepository.PairWithSINAsync(request.PairingCode, sin);
if(result != PairingResult.Complete && result != PairingResult.Partial)
throw new BitpayHttpException(400, $"Error while pairing ({result})");