Esempio n. 1
0
        public void AddLightningNode(string cryptoCode, LightningConnectionType connectionType)
        {
            string connectionString = null;

            if (connectionType == LightningConnectionType.Charge)
            {
                connectionString = "type=charge;server=" + Server.MerchantCharge.Client.Uri.AbsoluteUri;
            }
            else if (connectionType == LightningConnectionType.CLightning)
            {
                connectionString = "type=clightning;server=" + ((CLightningClient)Server.MerchantLightningD).Address.AbsoluteUri;
            }
            else if (connectionType == LightningConnectionType.LndREST)
            {
                connectionString = $"type=lnd-rest;server={Server.MerchantLnd.Swagger.BaseUrl};allowinsecure=true";
            }
            else
            {
                throw new NotSupportedException(connectionType.ToString());
            }

            Driver.FindElement(By.Id($"Modify-Lightning{cryptoCode}")).ForceClick();
            Driver.FindElement(By.Name($"ConnectionString")).SendKeys(connectionString);
            Driver.FindElement(By.Id($"save")).ForceClick();
        }
Esempio n. 2
0
        public async Task RegisterLightningNodeAsync(string cryptoCode, LightningConnectionType connectionType)
        {
            var storeController = this.GetController <StoresController>();

            string connectionString = null;

            if (connectionType == LightningConnectionType.Charge)
            {
                connectionString = "type=charge;server=" + parent.MerchantCharge.Client.Uri.AbsoluteUri;
            }
            else if (connectionType == LightningConnectionType.CLightning)
            {
                connectionString = "type=clightning;server=" + parent.MerchantLightningD.Address.AbsoluteUri;
            }
            else if (connectionType == LightningConnectionType.LndREST)
            {
                connectionString = $"type=lnd-rest;server={parent.MerchantLnd.Swagger.BaseUrl};allowinsecure=true";
            }
            else
            {
                throw new NotSupportedException(connectionType.ToString());
            }

            await storeController.AddLightningNode(StoreId, new LightningNodeViewModel()
            {
                ConnectionString = connectionString,
                SkipPortTest     = true
            }, "save", "BTC");

            if (storeController.ModelState.ErrorCount != 0)
            {
                Assert.False(true, storeController.ModelState.FirstOrDefault().Value.Errors[0].ErrorMessage);
            }
        }
Esempio n. 3
0
 public async Task RegisterLightningNodeAsync(string cryptoCode, LightningConnectionType connectionType)
 {
     var storeController = parent.PayTester.GetController <StoresController>(UserId);
     await storeController.AddLightningNode(StoreId, new LightningNodeViewModel()
     {
         Url = connectionType == LightningConnectionType.Charge ? parent.MerchantCharge.Client.Uri.AbsoluteUri :
               connectionType == LightningConnectionType.CLightning ? parent.MerchantLightningD.Address.AbsoluteUri
               : throw new NotSupportedException(connectionType.ToString())
     }, "save", "BTC");
Esempio n. 4
0
        public void ActivateLightning(LightningConnectionType internalNode)
        {
            var btc = NetworkProvider.GetNetwork <BTCPayNetwork>("BTC").NBitcoinNetwork;

            CustomerLightningD            = LightningClientFactory.CreateClient(GetEnvironment("TEST_CUSTOMERLIGHTNINGD", "type=clightning;server=tcp://127.0.0.1:30992/"), btc);
            MerchantLightningD            = LightningClientFactory.CreateClient(GetEnvironment("TEST_MERCHANTLIGHTNINGD", "type=clightning;server=tcp://127.0.0.1:30993/"), btc);
            MerchantCharge                = new ChargeTester(this, "TEST_MERCHANTCHARGE", "type=charge;server=http://127.0.0.1:54938/;api-token=foiewnccewuify;allowinsecure=true", "merchant_lightningd", btc);
            MerchantLnd                   = new LndMockTester(this, "TEST_MERCHANTLND", "http://*****:*****@127.0.0.1:35531/", "merchant_lnd", btc);
            PayTester.UseLightning        = true;
            PayTester.IntegratedLightning = GetLightningConnectionString(internalNode, true);
        }
Esempio n. 5
0
        /// <summary>
        /// Connect a customer LN node to the merchant LN node
        /// </summary>
        public void PrepareLightning(LightningConnectionType lndBackend)
        {
            ILightningInvoiceClient client = MerchantCharge.Client;

            if (lndBackend == LightningConnectionType.LndREST)
            {
                client = MerchantLnd.Client;
            }

            PrepareLightningAsync(client).GetAwaiter().GetResult();
        }
Esempio n. 6
0
 public void RegisterLightningNode(string cryptoCode, LightningConnectionType connectionType)
 {
     RegisterLightningNodeAsync(cryptoCode, connectionType).GetAwaiter().GetResult();
 }