public async Task <IActionResult> Configure(string storeId, string cryptoCode)
    {
        if (!_onChainAutomatedPayoutSenderFactory.GetSupportedPaymentMethods().Any(id =>
                                                                                   id.CryptoCode.Equals(cryptoCode, StringComparison.InvariantCultureIgnoreCase)))
        {
            TempData.SetStatusMessageModel(new StatusMessageModel()
            {
                Severity = StatusMessageModel.StatusSeverity.Error,
                Message  = $"This processor cannot handle {cryptoCode}."
            });
            return(RedirectToAction("ConfigureStorePayoutProcessors", "UiPayoutProcessors"));
        }
        var wallet = HttpContext.GetStoreData().GetDerivationSchemeSettings(_btcPayNetworkProvider, cryptoCode);

        if (wallet?.IsHotWallet is not true)
        {
            TempData.SetStatusMessageModel(new StatusMessageModel()
            {
                Severity = StatusMessageModel.StatusSeverity.Error,
                Message  = $"Either your {cryptoCode} wallet is not configured, or it is not a hot wallet. This processor cannot function until a hot wallet is configured in your store."
            });
        }
        var activeProcessor =
            (await _payoutProcessorService.GetProcessors(
                 new PayoutProcessorService.PayoutProcessorQuery()
        {
            Stores = new[] { storeId },
            Processors = new [] { _onChainAutomatedPayoutSenderFactory.Processor },
            PaymentMethods = new[]
            {
                new PaymentMethodId(cryptoCode, BitcoinPaymentType.Instance).ToString()
            }
        }))
            .FirstOrDefault();

        return(View(new OnChainTransferViewModel(activeProcessor is null? new AutomatedPayoutBlob() : OnChainAutomatedPayoutProcessor.GetBlob(activeProcessor))));
    }
コード例 #2
0
    public async Task <IActionResult> Configure(string storeId, string cryptoCode)
    {
        if (!_lightningAutomatedPayoutSenderFactory.GetSupportedPaymentMethods().Any(id =>
                                                                                     id.CryptoCode.Equals(cryptoCode, StringComparison.InvariantCultureIgnoreCase)))
        {
            TempData.SetStatusMessageModel(new StatusMessageModel()
            {
                Severity = StatusMessageModel.StatusSeverity.Error,
                Message  = $"This processor cannot handle {cryptoCode}."
            });
            return(RedirectToAction("ConfigureStorePayoutProcessors", "UiPayoutProcessors"));
        }
        var activeProcessor =
            (await _payoutProcessorService.GetProcessors(
                 new PayoutProcessorService.PayoutProcessorQuery()
        {
            Stores = new[] { storeId },
            Processors = new [] { _lightningAutomatedPayoutSenderFactory.Processor },
            PaymentMethods = new[]
            {
                new PaymentMethodId(cryptoCode, LightningPaymentType.Instance).ToString()
            }
        }))
            .FirstOrDefault();

        return(View(new LightningTransferViewModel(activeProcessor is null? new AutomatedPayoutBlob() : OnChainAutomatedPayoutProcessor.GetBlob(activeProcessor))));
    }