move payjoin settings to store settings from checkout experience

This commit is contained in:
Kukks 2020-03-17 08:43:42 +01:00
parent fc88a867fa
commit d90ffb2254
6 changed files with 16 additions and 17 deletions

View file

@ -163,15 +163,15 @@ namespace BTCPayServer.Tests
public async Task EnablePayJoin()
{
var storeController = parent.PayTester.GetController<StoresController>(UserId, StoreId);
var checkoutExperienceVM =
Assert.IsType<CheckoutExperienceViewModel>(Assert
.IsType<ViewResult>(storeController.CheckoutExperience()).Model);
var storeVM =
Assert.IsType<StoreViewModel>(Assert
.IsType<ViewResult>(storeController.UpdateStore()).Model);
checkoutExperienceVM.PayJoinEnabled = true;
storeVM.PayJoinEnabled = true;
Assert.Equal(nameof(storeController.CheckoutExperience),
Assert.Equal(nameof(storeController.UpdateStore),
Assert.IsType<RedirectToActionResult>(
await storeController.CheckoutExperience(checkoutExperienceVM)).ActionName);
await storeController.UpdateStore(storeVM)).ActionName);
}
public GenerateWalletResponse GenerateWalletResponseV { get; set; }

View file

@ -381,7 +381,6 @@ namespace BTCPayServer.Controllers
vm.LightningMaxValue = storeBlob.LightningMaxValue?.ToString() ?? "";
vm.LightningAmountInSatoshi = storeBlob.LightningAmountInSatoshi;
vm.RedirectAutomatically = storeBlob.RedirectAutomatically;
vm.PayJoinEnabled = storeBlob.PayJoinEnabled;
return View(vm);
}
void SetCryptoCurrencies(CheckoutExperienceViewModel vm, Data.StoreData storeData)
@ -442,7 +441,6 @@ namespace BTCPayServer.Controllers
blob.LightningMaxValue = lightningMaxValue;
blob.LightningAmountInSatoshi = model.LightningAmountInSatoshi;
blob.RedirectAutomatically = model.RedirectAutomatically;
blob.PayJoinEnabled = model.PayJoinEnabled;
if (CurrentStore.SetStoreBlob(blob))
{
needUpdate = true;
@ -481,6 +479,7 @@ namespace BTCPayServer.Controllers
vm.InvoiceExpiration = storeBlob.InvoiceExpiration;
vm.LightningDescriptionTemplate = storeBlob.LightningDescriptionTemplate;
vm.PaymentTolerance = storeBlob.PaymentTolerance;
vm.PayJoinEnabled = storeBlob.PayJoinEnabled;
return View(vm);
}
@ -575,7 +574,7 @@ namespace BTCPayServer.Controllers
blob.InvoiceExpiration = model.InvoiceExpiration;
blob.LightningDescriptionTemplate = model.LightningDescriptionTemplate ?? string.Empty;
blob.PaymentTolerance = model.PaymentTolerance;
blob.PayJoinEnabled = model.PayJoinEnabled;
if (CurrentStore.SetStoreBlob(blob))
{
needUpdate = true;

View file

@ -57,9 +57,6 @@ namespace BTCPayServer.Models.StoreViewModels
[Display(Name = "Redirect invoice to redirect url automatically after paid")]
public bool RedirectAutomatically { get; set; }
[Display(Name = "Enable BIP79 Payjoin/P2EP")]
public bool PayJoinEnabled { get; set; }
public void SetLanguages(LanguageService langService, string defaultLang)
{

View file

@ -86,6 +86,9 @@ namespace BTCPayServer.Models.StoreViewModels
[Display(Name = "Description template of the lightning invoice")]
public string LightningDescriptionTemplate { get; set; }
[Display(Name = "Enable BIP79 Payjoin/P2EP")]
public bool PayJoinEnabled { get; set; }
public class LightningNode
{

View file

@ -68,11 +68,6 @@
<label asp-for="RedirectAutomatically" class="form-check-label"></label>
<span asp-validation-for="RedirectAutomatically" class="text-danger"></span>
</div>
<div class="form-check">
<input asp-for="PayJoinEnabled" type="checkbox" class="form-check-input" />
<label asp-for="PayJoinEnabled" class="form-check-label"></label>
<span asp-validation-for="PayJoinEnabled" class="text-danger"></span>
</div>
<div class="form-check">
<input asp-for="ShowRecommendedFee" type="checkbox" class="form-check-input" />
<label asp-for="ShowRecommendedFee" class="form-check-label"></label>

View file

@ -81,6 +81,11 @@
</select>
<span asp-validation-for="SpeedPolicy" class="text-danger"></span>
</div>
<div class="form-check">
<input asp-for="PayJoinEnabled" type="checkbox" class="form-check-input"/>
<label asp-for="PayJoinEnabled" class="form-check-label"></label>
<span asp-validation-for="PayJoinEnabled" class="text-danger"></span>
</div>
<div class="form-group">
<h5>Derivation Scheme</h5>
<span>The DerivationScheme represents the destination of the funds received by your invoice on chain.</span>