mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Fix cart receipt + fix pos email form forwarding (#4917)
* Show correct array regardless of size fixes #4890 * Email provided to pos form was not forwarded to form fixes #4810 * Make invoice receipt url redirect to the invoice redirect url if receipt is not enabled When setting up a default email rule upon invoice settlement, you would link to the receipt page naturally. However, if using the payment requests, receipts are disabled as the payment request itself is the receipt. This commit makes the receipt url redirect to the invoice redirect url if available, and in the case of payment requests, it would mean the receipt url is the payment request url. fixes #4895 * Set the email address in the form when configured in the payment request * fix pay request email copy * fix payouts nav link fixes #4788 * Update BTCPayServer/Views/UIPaymentRequest/EditPaymentRequest.cshtml Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com> --------- Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
This commit is contained in:
parent
ccb4b9a9ba
commit
45b74e1ce5
@ -145,7 +145,10 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item" permission="@Policies.CanModifyStoreSettings">
|
||||
<a asp-area="" asp-controller="UIStorePullPayments" asp-action="Payouts" asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.IsActivePage(StoreNavPages.Payouts)" id="StoreNav-Payouts">
|
||||
<a asp-area=""
|
||||
asp-controller="UIStorePullPayments" asp-action="Payouts"
|
||||
asp-route-pullPaymentId=""
|
||||
asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.IsActivePage(StoreNavPages.Payouts)" id="StoreNav-Payouts">
|
||||
<vc:icon symbol="payouts"/>
|
||||
<span>Payouts</span>
|
||||
</a>
|
||||
|
@ -184,8 +184,14 @@ namespace BTCPayServer.Controllers
|
||||
var receipt = InvoiceDataBase.ReceiptOptions.Merge(store.GetStoreBlob().ReceiptOptions, i.ReceiptOptions);
|
||||
|
||||
if (receipt.Enabled is not true)
|
||||
{
|
||||
if (i.RedirectURL is not null)
|
||||
{
|
||||
return Redirect(i.RedirectURL.ToString());
|
||||
}
|
||||
return NotFound();
|
||||
|
||||
}
|
||||
var storeBlob = store.GetStoreBlob();
|
||||
var vm = new InvoiceReceiptViewModel
|
||||
{
|
||||
|
@ -235,6 +235,14 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
|
||||
var form = Form.Parse(formData.Config);
|
||||
if (!string.IsNullOrEmpty(prBlob.Email))
|
||||
{
|
||||
var emailField = form.GetFieldByFullName("buyerEmail");
|
||||
if (emailField is not null)
|
||||
{
|
||||
emailField.Value = prBlob.Email;
|
||||
}
|
||||
}
|
||||
if (Request.Method == "POST" && Request.HasFormContentType)
|
||||
{
|
||||
form.ApplyValuesFromForm(Request.Form);
|
||||
|
@ -253,15 +253,15 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
|
||||
{
|
||||
var vm = new PostRedirectViewModel
|
||||
{
|
||||
AspAction = nameof(POSForm),
|
||||
AspController = "UIPointOfSale",
|
||||
RouteParameters = new Dictionary<string, string> { { "appId", appId } },
|
||||
FormParameters = new MultiValueDictionary<string, string>(Request.Form.Select(pair => new KeyValuePair<string, IReadOnlyCollection<string>>(pair.Key, pair.Value)))
|
||||
FormUrl = Url.Action(nameof(POSForm), "UIPointOfSale", new {appId, buyerEmail = email}),
|
||||
FormParameters = new MultiValueDictionary<string, string>(Request.Form.Select(pair =>
|
||||
new KeyValuePair<string, IReadOnlyCollection<string>>(pair.Key, pair.Value)))
|
||||
};
|
||||
if (viewType.HasValue)
|
||||
{
|
||||
vm.RouteParameters.Add("viewType", viewType.Value.ToString());
|
||||
}
|
||||
|
||||
return View("PostRedirect", vm);
|
||||
}
|
||||
|
||||
@ -405,6 +405,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
|
||||
var store = await _appService.GetStore(app);
|
||||
var storeBlob = store.GetStoreBlob();
|
||||
var form = Form.Parse(formData.Config);
|
||||
form.ApplyValuesFromForm(Request.Query);
|
||||
var vm = new FormViewModel
|
||||
{
|
||||
StoreName = store.StoreName,
|
||||
|
@ -30,24 +30,7 @@
|
||||
}
|
||||
</td>
|
||||
}
|
||||
else if (value is Dictionary<string, object>subItems)
|
||||
{
|
||||
@* This is the array case *@
|
||||
if (subItems.Count == 1 && subItems.First().Value is string str2)
|
||||
{
|
||||
<th class="w-150px">@key</th>
|
||||
<td>
|
||||
@if (IsValidURL(str2))
|
||||
{
|
||||
<a href="@str2" target="_blank" rel="noreferrer noopener">@str2</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
@subItems.First().Value?.ToString()
|
||||
}
|
||||
</td>
|
||||
}
|
||||
else if (subItems.Count > 0)
|
||||
else if (value is Dictionary<string, object> {Count: > 0 } subItems)
|
||||
{
|
||||
<td colspan="2" >
|
||||
@{
|
||||
@ -55,10 +38,9 @@
|
||||
Write(key);
|
||||
Write(Html.Raw($"</h{Model.Level + 3}>"));
|
||||
}
|
||||
<partial name="PosData" model="(subItems, Model.Level + 1)"/>
|
||||
<partial name="PosData" model="@((subItems, Model.Level + 1))"/>
|
||||
</td>
|
||||
}
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
|
@ -86,7 +86,7 @@
|
||||
<label asp-for="Email" class="form-label"></label>
|
||||
<input type="email" asp-for="Email" placeholder="Firstname Lastname <email@example.com>" class="form-control" />
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
<div id="PaymentRequestEmailHelpBlock" class="form-text">Receive updates for this payment request.</div>
|
||||
+ <div id="PaymentRequestEmailHelpBlock" class="form-text">The recipient's email. This will send notification mails to the recipient, as configured by the <a asp-action="StoreEmails" asp-controller="UIStores" asp-route-storeId="@Model.StoreId">email rules</a>, and include the email in the invoice export data.</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="FormId" class="form-label"></label>
|
||||
|
Loading…
Reference in New Issue
Block a user