mirror of
https://github.com/bitwarden/server.git
synced 2025-04-28 00:02:26 -05:00

* Revert "Add git blame entry (#2226)" This reverts commit 239286737d15cb84a893703ee5a8b33a2d67ad3d. * Revert "Turn on file scoped namespaces (#2225)" This reverts commit 34fb4cca2aa78deb84d4cbc359992a7c6bba7ea5.
33 lines
955 B
C#
33 lines
955 B
C#
using Bit.Core.Exceptions;
|
|
|
|
namespace Bit.Core.Services
|
|
{
|
|
public class StripeSyncService : IStripeSyncService
|
|
{
|
|
private readonly IStripeAdapter _stripeAdapter;
|
|
|
|
public StripeSyncService(IStripeAdapter stripeAdapter)
|
|
{
|
|
_stripeAdapter = stripeAdapter;
|
|
}
|
|
|
|
public async Task UpdateCustomerEmailAddress(string gatewayCustomerId, string emailAddress)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(gatewayCustomerId))
|
|
{
|
|
throw new InvalidGatewayCustomerIdException();
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(emailAddress))
|
|
{
|
|
throw new InvalidEmailException();
|
|
}
|
|
|
|
var customer = await _stripeAdapter.CustomerGetAsync(gatewayCustomerId);
|
|
|
|
await _stripeAdapter.CustomerUpdateAsync(customer.Id,
|
|
new Stripe.CustomerUpdateOptions { Email = emailAddress });
|
|
}
|
|
}
|
|
}
|