1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 01:22:50 -05:00

process off session payment methods

This commit is contained in:
Kyle Spearrin
2019-08-09 14:06:07 -04:00
parent 3aea61cb63
commit 9686b4bf2b
2 changed files with 42 additions and 3 deletions

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Bit.Core.Utilities;
using Microsoft.AspNetCore.Authorization;
using Bit.Core;
using Stripe;
namespace Bit.Api.Controllers
{
@ -52,5 +53,19 @@ namespace Bit.Api.Controllers
var invoice = await _bitPayClient.CreateInvoiceAsync(model.ToBitpayClientInvoice(_globalSettings));
return invoice.Url;
}
[Authorize("Application")]
[HttpPost("~/setup-payment")]
[SelfHosted(NotSelfHostedOnly = true)]
public async Task<string> PostSetupPayment()
{
var options = new SetupIntentCreateOptions
{
Usage = "off_session"
};
var service = new SetupIntentService();
var setupIntent = await service.CreateAsync(options);
return setupIntent.ClientSecret;
}
}
}