1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-29 23:34:53 -05:00

handle invoice already paid error

This commit is contained in:
Kyle Spearrin 2019-06-17 08:15:56 -04:00
parent 7b27443e5f
commit 377e6ff697

View File

@ -471,9 +471,9 @@ namespace Bit.Billing.Controllers
return false; return false;
} }
var invoiceService = new InvoiceService();
try try
{ {
var invoiceService = new InvoiceService();
await invoiceService.UpdateAsync(invoice.Id, new InvoiceUpdateOptions await invoiceService.UpdateAsync(invoice.Id, new InvoiceUpdateOptions
{ {
Metadata = new Dictionary<string, string> Metadata = new Dictionary<string, string>
@ -488,7 +488,17 @@ namespace Bit.Billing.Controllers
catch(Exception e) catch(Exception e)
{ {
await _btGateway.Transaction.RefundAsync(transactionResult.Target.Id); await _btGateway.Transaction.RefundAsync(transactionResult.Target.Id);
throw e; if(e.Message.Contains("Invoice is already paid"))
{
await invoiceService.UpdateAsync(invoice.Id, new InvoiceUpdateOptions
{
Metadata = invoice.Metadata
});
}
else
{
throw e;
}
} }
return true; return true;