mirror of
https://github.com/bitwarden/server
synced 2025-12-26 21:23:39 +00:00
[PM-25123] Remove VerifyBankAsync Code (#6355)
* refactor: remove VerifyBankAsync from interface and implementation * refactor: remove controller endpoint
This commit is contained in:
@@ -18,7 +18,6 @@ public interface IOrganizationService
|
||||
Task UpdateSubscription(Guid organizationId, int seatAdjustment, int? maxAutoscaleSeats);
|
||||
Task AutoAddSeatsAsync(Organization organization, int seatsToAdd);
|
||||
Task<string> AdjustSeatsAsync(Guid organizationId, int seatAdjustment);
|
||||
Task VerifyBankAsync(Guid organizationId, int amount1, int amount2);
|
||||
Task UpdateExpirationDateAsync(Guid organizationId, DateTime? expirationDate);
|
||||
Task UpdateAsync(Organization organization, bool updateBilling = false);
|
||||
Task<Organization> UpdateCollectionManagementSettingsAsync(Guid organizationId, OrganizationCollectionManagementSettings settings);
|
||||
|
||||
@@ -325,49 +325,6 @@ public class OrganizationService : IOrganizationService
|
||||
return paymentIntentClientSecret;
|
||||
}
|
||||
|
||||
public async Task VerifyBankAsync(Guid organizationId, int amount1, int amount2)
|
||||
{
|
||||
var organization = await GetOrgById(organizationId);
|
||||
if (organization == null)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(organization.GatewayCustomerId))
|
||||
{
|
||||
throw new GatewayException("Not a gateway customer.");
|
||||
}
|
||||
|
||||
var bankService = new BankAccountService();
|
||||
var customer = await _stripeAdapter.CustomerGetAsync(organization.GatewayCustomerId,
|
||||
new CustomerGetOptions { Expand = new List<string> { "sources" } });
|
||||
if (customer == null)
|
||||
{
|
||||
throw new GatewayException("Cannot find customer.");
|
||||
}
|
||||
|
||||
var bankAccount = customer.Sources
|
||||
.FirstOrDefault(s => s is BankAccount && ((BankAccount)s).Status != "verified") as BankAccount;
|
||||
if (bankAccount == null)
|
||||
{
|
||||
throw new GatewayException("Cannot find an unverified bank account.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var result = await bankService.VerifyAsync(organization.GatewayCustomerId, bankAccount.Id,
|
||||
new BankAccountVerifyOptions { Amounts = new List<long> { amount1, amount2 } });
|
||||
if (result.Status != "verified")
|
||||
{
|
||||
throw new GatewayException("Unable to verify account.");
|
||||
}
|
||||
}
|
||||
catch (StripeException e)
|
||||
{
|
||||
throw new GatewayException(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateExpirationDateAsync(Guid organizationId, DateTime? expirationDate)
|
||||
{
|
||||
var org = await GetOrgById(organizationId);
|
||||
|
||||
Reference in New Issue
Block a user