mirror of
https://github.com/bitwarden/server.git
synced 2025-05-20 19:14:32 -05:00
check bitpay invoice status of complete (#892)
This commit is contained in:
parent
1c04e30689
commit
7cc9ce7bd5
@ -66,10 +66,16 @@ namespace Bit.Billing.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
var invoice = await _bitPayClient.GetInvoiceAsync(model.Data.Id);
|
var invoice = await _bitPayClient.GetInvoiceAsync(model.Data.Id);
|
||||||
if (invoice == null || invoice.Status != "confirmed")
|
if (invoice == null)
|
||||||
{
|
{
|
||||||
// Request forged...?
|
// Request forged...?
|
||||||
_logger.LogWarning("Forged invoice detected. #" + model.Data.Id);
|
_logger.LogWarning("Invoice not found. #" + model.Data.Id);
|
||||||
|
return new BadRequestResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invoice.Status != "confirmed" && invoice.Status != "completed")
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Invoice status of '" + invoice.Status + "' is not acceptable. #" + invoice.Id);
|
||||||
return new BadRequestResult();
|
return new BadRequestResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +103,7 @@ namespace Bit.Billing.Controllers
|
|||||||
var transaction = await _transactionRepository.GetByGatewayIdAsync(GatewayType.BitPay, invoice.Id);
|
var transaction = await _transactionRepository.GetByGatewayIdAsync(GatewayType.BitPay, invoice.Id);
|
||||||
if (transaction != null)
|
if (transaction != null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Already processed this confirmed invoice. #" + invoice.Id);
|
_logger.LogWarning("Already processed this invoice. #" + invoice.Id);
|
||||||
return new OkResult();
|
return new OkResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user