added method to check if the seller account has been fully onboarded

This commit is contained in:
Damien Ostler 2024-01-27 18:21:09 -05:00
parent fdfd81a857
commit 1fd4a3160a
3 changed files with 13 additions and 1 deletions

View File

@ -222,6 +222,10 @@ public class SellerProfileController : Controller
}
if(existingSellerProfile.StripeAccountId==null)
return BadRequest("Account does not have a payment account.");
if (_paymentService.SellerAccountIsOnboarded(existingSellerProfile.StripeAccountId) == false)
return BadRequest("Account has not finished onboarding.");
var result = _paymentService.CreateSellerAccountOnboardingUrl(existingSellerProfile.StripeAccountId);
return Ok(result);
}

View File

@ -5,5 +5,6 @@ namespace ArtPlatform.API.Services.Payment;
public interface IPaymentService
{
string CreateSellerAccount();
string CreateSellerAccountOnboardingUrl(string accountId);
string CreateSellerAccountOnboardingUrl(string accountId);
bool SellerAccountIsOnboarded(string accountId);
}

View File

@ -37,4 +37,11 @@ public class StripePaymentServiceProvider:IPaymentService
var url = service.Create(options);
return url.Url;
}
public bool SellerAccountIsOnboarded(string accountId)
{
var service = new AccountService();
var account = service.Get(accountId);
return account.Requirements.CurrentlyDue.Count == 0 && account.ChargesEnabled==true && account.DetailsSubmitted==true;
}
}