Skip to content

Commit ed5e427

Browse files
[PM-25123] Remove VerifyBankAsync Code (#6355)
* refactor: remove VerifyBankAsync from interface and implementation * refactor: remove controller endpoint
1 parent 8c238ce commit ed5e427

File tree

3 files changed

+0
-56
lines changed

3 files changed

+0
-56
lines changed

src/Api/Billing/Controllers/OrganizationsController.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,18 +211,6 @@ public async Task<PaymentResponseModel> PostSeat(Guid id, [FromBody] Organizatio
211211
return new PaymentResponseModel { Success = true, PaymentIntentClientSecret = result };
212212
}
213213

214-
[HttpPost("{id:guid}/verify-bank")]
215-
[SelfHosted(NotSelfHostedOnly = true)]
216-
public async Task PostVerifyBank(Guid id, [FromBody] OrganizationVerifyBankRequestModel model)
217-
{
218-
if (!await currentContext.EditSubscription(id))
219-
{
220-
throw new NotFoundException();
221-
}
222-
223-
await organizationService.VerifyBankAsync(id, model.Amount1.Value, model.Amount2.Value);
224-
}
225-
226214
[HttpPost("{id}/cancel")]
227215
public async Task PostCancel(Guid id, [FromBody] SubscriptionCancellationRequestModel request)
228216
{

src/Core/AdminConsole/Services/IOrganizationService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public interface IOrganizationService
1818
Task UpdateSubscription(Guid organizationId, int seatAdjustment, int? maxAutoscaleSeats);
1919
Task AutoAddSeatsAsync(Organization organization, int seatsToAdd);
2020
Task<string> AdjustSeatsAsync(Guid organizationId, int seatAdjustment);
21-
Task VerifyBankAsync(Guid organizationId, int amount1, int amount2);
2221
Task UpdateExpirationDateAsync(Guid organizationId, DateTime? expirationDate);
2322
Task UpdateAsync(Organization organization, bool updateBilling = false);
2423
Task<Organization> UpdateCollectionManagementSettingsAsync(Guid organizationId, OrganizationCollectionManagementSettings settings);

src/Core/AdminConsole/Services/Implementations/OrganizationService.cs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -325,49 +325,6 @@ await _mailService.SendOrganizationMaxSeatLimitReachedEmailAsync(organization,
325325
return paymentIntentClientSecret;
326326
}
327327

328-
public async Task VerifyBankAsync(Guid organizationId, int amount1, int amount2)
329-
{
330-
var organization = await GetOrgById(organizationId);
331-
if (organization == null)
332-
{
333-
throw new NotFoundException();
334-
}
335-
336-
if (string.IsNullOrWhiteSpace(organization.GatewayCustomerId))
337-
{
338-
throw new GatewayException("Not a gateway customer.");
339-
}
340-
341-
var bankService = new BankAccountService();
342-
var customer = await _stripeAdapter.CustomerGetAsync(organization.GatewayCustomerId,
343-
new CustomerGetOptions { Expand = new List<string> { "sources" } });
344-
if (customer == null)
345-
{
346-
throw new GatewayException("Cannot find customer.");
347-
}
348-
349-
var bankAccount = customer.Sources
350-
.FirstOrDefault(s => s is BankAccount && ((BankAccount)s).Status != "verified") as BankAccount;
351-
if (bankAccount == null)
352-
{
353-
throw new GatewayException("Cannot find an unverified bank account.");
354-
}
355-
356-
try
357-
{
358-
var result = await bankService.VerifyAsync(organization.GatewayCustomerId, bankAccount.Id,
359-
new BankAccountVerifyOptions { Amounts = new List<long> { amount1, amount2 } });
360-
if (result.Status != "verified")
361-
{
362-
throw new GatewayException("Unable to verify account.");
363-
}
364-
}
365-
catch (StripeException e)
366-
{
367-
throw new GatewayException(e.Message);
368-
}
369-
}
370-
371328
public async Task UpdateExpirationDateAsync(Guid organizationId, DateTime? expirationDate)
372329
{
373330
var org = await GetOrgById(organizationId);

0 commit comments

Comments
 (0)