1
0
mirror of https://github.com/bitwarden/server synced 2025-12-17 16:53:23 +00:00

refund if something screws up

This commit is contained in:
Kyle Spearrin
2019-02-03 00:05:35 -05:00
parent 9e14af3223
commit 7675478daa

View File

@@ -406,6 +406,8 @@ namespace Bit.Billing.Controllers
return false; return false;
} }
try
{
var invoiceService = new InvoiceService(); var invoiceService = new InvoiceService();
await invoiceService.UpdateAsync(invoice.Id, new InvoiceUpdateOptions await invoiceService.UpdateAsync(invoice.Id, new InvoiceUpdateOptions
{ {
@@ -417,6 +419,13 @@ namespace Bit.Billing.Controllers
} }
}); });
await invoiceService.PayAsync(invoice.Id, new InvoicePayOptions { PaidOutOfBand = true }); await invoiceService.PayAsync(invoice.Id, new InvoicePayOptions { PaidOutOfBand = true });
}
catch(Exception e)
{
await _btGateway.Transaction.RefundAsync(transactionResult.Target.Id);
throw e;
}
return true; return true;
} }