mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Small payment request fixes (#5926)
* Do not crash payment request page on 0 amount * set email from form to payment request
This commit is contained in:
@@ -277,6 +277,10 @@ namespace BTCPayServer.Controllers
|
|||||||
if (FormDataService.Validate(form, ModelState))
|
if (FormDataService.Validate(form, ModelState))
|
||||||
{
|
{
|
||||||
prBlob.FormResponse = FormDataService.GetValues(form);
|
prBlob.FormResponse = FormDataService.GetValues(form);
|
||||||
|
if(string.IsNullOrEmpty(prBlob.Email) && form.GetFieldByFullName("buyerEmail") is { } emailField)
|
||||||
|
{
|
||||||
|
prBlob.Email = emailField.Value;
|
||||||
|
}
|
||||||
result.SetBlob(prBlob);
|
result.SetBlob(prBlob);
|
||||||
await _PaymentRequestRepository.CreateOrUpdatePaymentRequest(result);
|
await _PaymentRequestRepository.CreateOrUpdatePaymentRequest(result);
|
||||||
return RedirectToAction("PayPaymentRequest", new { payReqId });
|
return RedirectToAction("PayPaymentRequest", new { payReqId });
|
||||||
|
|||||||
@@ -118,7 +118,10 @@
|
|||||||
</p>
|
</p>
|
||||||
<dl class="mt-n1 mb-4" v-if="srvModel.amountCollected > 0 && srvModel.amountDue > 0">
|
<dl class="mt-n1 mb-4" v-if="srvModel.amountCollected > 0 && srvModel.amountDue > 0">
|
||||||
<div class="progress bg-light d-flex mb-3 d-print-none" style="height:5px">
|
<div class="progress bg-light d-flex mb-3 d-print-none" style="height:5px">
|
||||||
<div class="progress-bar bg-primary" role="progressbar" style="width:@(Model.AmountCollected/Model.Amount*100)%" v-bind:style="{ width: (srvModel.amountCollected/srvModel.amount*100) + '%' }"></div>
|
@{
|
||||||
|
var prcnt = Model.Amount == 0? 100: Model.AmountCollected / Model.Amount * 100;
|
||||||
|
}
|
||||||
|
<div class="progress-bar bg-primary" role="progressbar" style="width:@prcnt%" v-bind:style="{ width: (srvModel.amountCollected/srvModel.amount*100) + '%' }"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-wrap gap-3 align-items-center justify-content-between">
|
<div class="d-flex flex-wrap gap-3 align-items-center justify-content-between">
|
||||||
<div class="d-flex d-print-inline-block flex-column gap-1">
|
<div class="d-flex d-print-inline-block flex-column gap-1">
|
||||||
|
|||||||
Reference in New Issue
Block a user