Can opt out required refund email from customer

This commit is contained in:
nicolas.dorier 2018-04-26 11:13:44 +09:00
parent 16f1791a9a
commit de8147d5dd
7 changed files with 19 additions and 1 deletions

View file

@ -232,6 +232,7 @@ namespace BTCPayServer.Controllers
OrderAmount = (accounting.TotalDue - accounting.NetworkFee).ToString(), OrderAmount = (accounting.TotalDue - accounting.NetworkFee).ToString(),
BtcDue = accounting.Due.ToString(), BtcDue = accounting.Due.ToString(),
CustomerEmail = invoice.RefundMail, CustomerEmail = invoice.RefundMail,
RequiresRefundEmail = storeBlob.RequiresRefundEmail,
ExpirationSeconds = Math.Max(0, (int)(invoice.ExpirationTime - DateTimeOffset.UtcNow).TotalSeconds), ExpirationSeconds = Math.Max(0, (int)(invoice.ExpirationTime - DateTimeOffset.UtcNow).TotalSeconds),
MaxTimeSeconds = (int)(invoice.ExpirationTime - invoice.InvoiceTime).TotalSeconds, MaxTimeSeconds = (int)(invoice.ExpirationTime - invoice.InvoiceTime).TotalSeconds,
MaxTimeMinutes = (int)(invoice.ExpirationTime - invoice.InvoiceTime).TotalMinutes, MaxTimeMinutes = (int)(invoice.ExpirationTime - invoice.InvoiceTime).TotalMinutes,

View file

@ -201,6 +201,7 @@ namespace BTCPayServer.Controllers
vm.LightningMaxValue = storeBlob.LightningMaxValue?.ToString() ?? ""; vm.LightningMaxValue = storeBlob.LightningMaxValue?.ToString() ?? "";
vm.OnChainMinValue = storeBlob.OnChainMinValue?.ToString() ?? ""; vm.OnChainMinValue = storeBlob.OnChainMinValue?.ToString() ?? "";
vm.AllowCoinConversion = storeBlob.AllowCoinConversion; vm.AllowCoinConversion = storeBlob.AllowCoinConversion;
vm.RequiresRefundEmail = storeBlob.RequiresRefundEmail;
vm.CustomCSS = storeBlob.CustomCSS?.AbsoluteUri; vm.CustomCSS = storeBlob.CustomCSS?.AbsoluteUri;
vm.CustomLogo = storeBlob.CustomLogo?.AbsoluteUri; vm.CustomLogo = storeBlob.CustomLogo?.AbsoluteUri;
return View(vm); return View(vm);
@ -247,6 +248,7 @@ namespace BTCPayServer.Controllers
} }
blob.DefaultLang = model.DefaultLang; blob.DefaultLang = model.DefaultLang;
blob.AllowCoinConversion = model.AllowCoinConversion; blob.AllowCoinConversion = model.AllowCoinConversion;
blob.RequiresRefundEmail = model.RequiresRefundEmail;
blob.LightningMaxValue = lightningMaxValue; blob.LightningMaxValue = lightningMaxValue;
blob.OnChainMinValue = onchainMinValue; blob.OnChainMinValue = onchainMinValue;
blob.CustomLogo = string.IsNullOrWhiteSpace(model.CustomLogo) ? null : new Uri(model.CustomLogo, UriKind.Absolute); blob.CustomLogo = string.IsNullOrWhiteSpace(model.CustomLogo) ? null : new Uri(model.CustomLogo, UriKind.Absolute);

View file

@ -214,6 +214,7 @@ namespace BTCPayServer.Data
{ {
InvoiceExpiration = 15; InvoiceExpiration = 15;
MonitoringExpiration = 60; MonitoringExpiration = 60;
RequiresRefundEmail = true;
} }
public bool NetworkFeeDisabled public bool NetworkFeeDisabled
{ {
@ -223,6 +224,9 @@ namespace BTCPayServer.Data
{ {
get; set; get; set;
} }
public bool RequiresRefundEmail { get; set; }
public string DefaultLang { get; set; } public string DefaultLang { get; set; }
[DefaultValue(60)] [DefaultValue(60)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]

View file

@ -24,6 +24,7 @@ namespace BTCPayServer.Models.InvoicingModels
public string BtcAddress { get; set; } public string BtcAddress { get; set; }
public string BtcDue { get; set; } public string BtcDue { get; set; }
public string CustomerEmail { get; set; } public string CustomerEmail { get; set; }
public bool RequiresRefundEmail { get; set; }
public int ExpirationSeconds { get; set; } public int ExpirationSeconds { get; set; }
public string Status { get; set; } public string Status { get; set; }
public string MerchantRefLink { get; set; } public string MerchantRefLink { get; set; }

View file

@ -31,6 +31,12 @@ namespace BTCPayServer.Models.StoreViewModels
[MaxLength(20)] [MaxLength(20)]
public string LightningMaxValue { get; set; } public string LightningMaxValue { get; set; }
[Display(Name = "Requires a refund email")]
public bool RequiresRefundEmail
{
get; set;
}
[Display(Name = "Do not propose on chain payment if the value of the invoice is below...")] [Display(Name = "Do not propose on chain payment if the value of the invoice is below...")]
[MaxLength(20)] [MaxLength(20)]
public string OnChainMinValue { get; set; } public string OnChainMinValue { get; set; }

View file

@ -38,6 +38,10 @@
<label asp-for="AllowCoinConversion"></label> <label asp-for="AllowCoinConversion"></label>
<input asp-for="AllowCoinConversion" type="checkbox" class="form-check" /> <input asp-for="AllowCoinConversion" type="checkbox" class="form-check" />
</div> </div>
<div class="form-group">
<label asp-for="RequiresRefundEmail"></label>
<input asp-for="RequiresRefundEmail" type="checkbox" class="form-check" />
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="LightningMaxValue"></label> <label asp-for="LightningMaxValue"></label>
<input asp-for="LightningMaxValue" class="form-control" /> <input asp-for="LightningMaxValue" class="form-control" />

View file

@ -108,7 +108,7 @@ $(document).ready(function () {
if (srvModel.expirationSeconds > 0) { if (srvModel.expirationSeconds > 0) {
progressStart(srvModel.maxTimeSeconds); // Progress bar progressStart(srvModel.maxTimeSeconds); // Progress bar
if (!validateEmail(srvModel.customerEmail)) if (srvModel.requiresRefundEmail && !validateEmail(srvModel.customerEmail))
emailForm(); // Email form Display emailForm(); // Email form Display
else else
hideEmailForm(); hideEmailForm();