Make sure the invoiceEvent is from a payment request.

This commit is contained in:
nicolas.dorier
2019-02-25 16:01:39 +09:00
parent d818baa6d1
commit 5bccd07d7d
2 changed files with 3 additions and 4 deletions

View File

@@ -116,9 +116,9 @@ namespace BTCPayServer.PaymentRequest
{ {
if (evt is InvoiceEvent invoiceEvent) if (evt is InvoiceEvent invoiceEvent)
{ {
var paymentRequestId = var paymentRequestId = PaymentRequestRepository.GetPaymentRequestIdFromOrderId(invoiceEvent.Invoice.OrderId);
PaymentRequestRepository.GetPaymentRequestIdFromOrderId(invoiceEvent.Invoice.OrderId); if (paymentRequestId == null)
return;
if (invoiceEvent.Name == InvoiceEvent.ReceivedPayment) if (invoiceEvent.Name == InvoiceEvent.ReceivedPayment)
{ {
await _PaymentRequestService.UpdatePaymentRequestStateIfNeeded(paymentRequestId); await _PaymentRequestService.UpdatePaymentRequestStateIfNeeded(paymentRequestId);

View File

@@ -35,7 +35,6 @@ namespace BTCPayServer.PaymentRequest
public async Task UpdatePaymentRequestStateIfNeeded(string id) public async Task UpdatePaymentRequestStateIfNeeded(string id)
{ {
var pr = await _PaymentRequestRepository.FindPaymentRequest(id, null); var pr = await _PaymentRequestRepository.FindPaymentRequest(id, null);
await UpdatePaymentRequestStateIfNeeded(pr); await UpdatePaymentRequestStateIfNeeded(pr);
} }