mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-20 15:34:24 +01:00
generate 7 digit pairing code, notify parent windows of checkout
This commit is contained in:
@@ -58,7 +58,13 @@ namespace BTCPayServer.Authentication
|
||||
|
||||
public async Task<string> CreatePairingCodeAsync()
|
||||
{
|
||||
string pairingCodeId = Encoders.Base58.EncodeData(RandomUtils.GetBytes(6));
|
||||
string pairingCodeId = null;
|
||||
while(true)
|
||||
{
|
||||
pairingCodeId = Encoders.Base58.EncodeData(RandomUtils.GetBytes(6));
|
||||
if(pairingCodeId.Length == 7) // woocommerce plugin check for exactly 7 digits
|
||||
break;
|
||||
}
|
||||
using(var ctx = _Factory.CreateContext())
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
@@ -155,9 +155,15 @@ $("#copy-tab").click(function () {
|
||||
// Should connect using webhook ?
|
||||
// If notification received
|
||||
|
||||
var oldStatus = status;
|
||||
updateState(status);
|
||||
|
||||
function updateState(status) {
|
||||
if (oldStatus != status)
|
||||
{
|
||||
oldStatus = status;
|
||||
window.parent.postMessage({ "invoiceId": invoiceId, "status": status }, "*");
|
||||
}
|
||||
if (status == "complete" ||
|
||||
status == "paidOver" ||
|
||||
status == "confirmed" ||
|
||||
|
||||
Reference in New Issue
Block a user