mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-10 09:19:24 +01:00
Fix: Setup a boltcard for the second time wouldn't generate new keys
This commit is contained in:
parent
20512a59b3
commit
c94dc87cb8
2 changed files with 5 additions and 1 deletions
|
@ -2189,6 +2189,10 @@ namespace BTCPayServer.Tests
|
||||||
// Relink should bump Version
|
// Relink should bump Version
|
||||||
reg = await db.GetBoltcardRegistration(issuerKey, uid);
|
reg = await db.GetBoltcardRegistration(issuerKey, uid);
|
||||||
Assert.Equal((ppid, 0, 1), (reg.PullPaymentId, reg.Counter, reg.Version));
|
Assert.Equal((ppid, 0, 1), (reg.PullPaymentId, reg.Counter, reg.Version));
|
||||||
|
|
||||||
|
await db.LinkBoltcardToPullPayment(ppid, issuerKey, uid);
|
||||||
|
reg = await db.GetBoltcardRegistration(issuerKey, uid);
|
||||||
|
Assert.Equal((ppid, 0, 2), (reg.PullPaymentId, reg.Counter, reg.Version));
|
||||||
}
|
}
|
||||||
|
|
||||||
s.GoToStore(s.StoreId, StoreNavPages.PullPayments);
|
s.GoToStore(s.StoreId, StoreNavPages.PullPayments);
|
||||||
|
|
|
@ -21,7 +21,7 @@ public static class BoltcardDataExtensions
|
||||||
string onConflict = onExisting switch
|
string onConflict = onExisting switch
|
||||||
{
|
{
|
||||||
OnExistingBehavior.KeepVersion => "UPDATE SET ppid=excluded.ppid, version=boltcards.version",
|
OnExistingBehavior.KeepVersion => "UPDATE SET ppid=excluded.ppid, version=boltcards.version",
|
||||||
OnExistingBehavior.UpdateVersion => "UPDATE SET ppid=excluded.ppid, version=excluded.version+1",
|
OnExistingBehavior.UpdateVersion => "UPDATE SET ppid=excluded.ppid, version=boltcards.version+1",
|
||||||
_ => throw new NotSupportedException()
|
_ => throw new NotSupportedException()
|
||||||
};
|
};
|
||||||
return await conn.QueryFirstOrDefaultAsync<int>(
|
return await conn.QueryFirstOrDefaultAsync<int>(
|
||||||
|
|
Loading…
Add table
Reference in a new issue