mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-11 01:35:22 +01:00
make free invoices from pos redirect to receipt and make receipt reload fast on such case
This commit is contained in:
parent
8cb06f9c6c
commit
79836ef1de
2 changed files with 12 additions and 1 deletions
|
@ -240,6 +240,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
|
|||
}
|
||||
|
||||
var store = await _appService.GetStore(app);
|
||||
var storeBlob = store.GetStoreBlob();
|
||||
var posFormId = settings.FormId;
|
||||
var formData = await FormDataService.GetForm(posFormId);
|
||||
|
||||
|
@ -297,7 +298,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
|
|||
RedirectAutomatically = settings.RedirectAutomatically,
|
||||
SupportedTransactionCurrencies = paymentMethods,
|
||||
RequiresRefundEmail = requiresRefundEmail == RequiresRefundEmail.InheritFromStore
|
||||
? store.GetStoreBlob().RequiresRefundEmail
|
||||
? storeBlob.RequiresRefundEmail
|
||||
: requiresRefundEmail == RequiresRefundEmail.On,
|
||||
}, store, HttpContext.Request.GetAbsoluteRoot(),
|
||||
new List<string> { AppService.GetAppInternalTag(appId) },
|
||||
|
@ -355,6 +356,10 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
|
|||
meta.Merge(formResponseJObject);
|
||||
entity.Metadata = InvoiceMetadata.FromJObject(meta);
|
||||
});
|
||||
if (price is 0 && storeBlob.ReceiptOptions.Enabled is true)
|
||||
{
|
||||
return RedirectToAction(nameof(UIInvoiceController.InvoiceReceipt), "UIInvoice", new { invoiceId = invoice.Data.Id });
|
||||
}
|
||||
return RedirectToAction(nameof(UIInvoiceController.Checkout), "UIInvoice", new { invoiceId = invoice.Data.Id });
|
||||
}
|
||||
catch (BitpayHttpException e)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
Layout = null;
|
||||
ViewData["Title"] = $"Receipt from {Model.StoreName}";
|
||||
var isProcessing = Model.Status == InvoiceStatus.Processing;
|
||||
var isFreeInvoice = (Model.Status == InvoiceStatus.New && Model.Amount == 0);
|
||||
var isSettled = Model.Status == InvoiceStatus.Settled;
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
|
@ -25,6 +26,11 @@
|
|||
<script type="text/javascript">
|
||||
setTimeout(() => { window.location.reload(); }, 10000);
|
||||
</script>
|
||||
}else if (isFreeInvoice)
|
||||
{
|
||||
<script type="text/javascript">
|
||||
setTimeout(() => { window.location.reload(); }, 2000);
|
||||
</script>
|
||||
}
|
||||
<style>
|
||||
#InvoiceSummary { gap: var(--btcpay-space-l); }
|
||||
|
|
Loading…
Add table
Reference in a new issue