mirror of
				https://github.com/D4M13N-D3V/art_platform.git
				synced 2025-11-03 19:15:39 +00:00 
			
		
		
		
	added method to check if the seller account has been fully onboarded
This commit is contained in:
		
							parent
							
								
									fdfd81a857
								
							
						
					
					
						commit
						1fd4a3160a
					
				@ -222,6 +222,10 @@ public class SellerProfileController : Controller
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        if(existingSellerProfile.StripeAccountId==null)
 | 
					        if(existingSellerProfile.StripeAccountId==null)
 | 
				
			||||||
            return BadRequest("Account does not have a payment account.");
 | 
					            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);
 | 
					        var result = _paymentService.CreateSellerAccountOnboardingUrl(existingSellerProfile.StripeAccountId);
 | 
				
			||||||
        return Ok(result);
 | 
					        return Ok(result);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -5,5 +5,6 @@ namespace ArtPlatform.API.Services.Payment;
 | 
				
			|||||||
public interface IPaymentService
 | 
					public interface IPaymentService
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    string CreateSellerAccount();
 | 
					    string CreateSellerAccount();
 | 
				
			||||||
    string CreateSellerAccountOnboardingUrl(string accountId);
 | 
					    string CreateSellerAccountOnboardingUrl(string accountId); 
 | 
				
			||||||
 | 
					    bool SellerAccountIsOnboarded(string accountId);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -37,4 +37,11 @@ public class StripePaymentServiceProvider:IPaymentService
 | 
				
			|||||||
        var url = service.Create(options);
 | 
					        var url = service.Create(options);
 | 
				
			||||||
        return url.Url;
 | 
					        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;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user