mirror of
				https://github.com/D4M13N-D3V/comissions-app-core-api.git
				synced 2025-10-31 01:25:27 +00:00 
			
		
		
		
	fix: added pending balance
This commit is contained in:
		
							parent
							
								
									eba1de0cd0
								
							
						
					
					
						commit
						ce3b019cfa
					
				| @ -85,10 +85,12 @@ public class ArtistController : Controller | |||||||
| 
 | 
 | ||||||
|         var account = _paymentService.GetAccount(Artist.StripeAccountId); |         var account = _paymentService.GetAccount(Artist.StripeAccountId); | ||||||
|         var balance = _paymentService.GetBalance(Artist.StripeAccountId); |         var balance = _paymentService.GetBalance(Artist.StripeAccountId); | ||||||
|  |         var pendingBalance = _paymentService.GetPendingBalance(Artist.StripeAccountId); | ||||||
|         var result = new PayoutModel() |         var result = new PayoutModel() | ||||||
|         { |         { | ||||||
|             Enabled = account.PayoutsEnabled, |             Enabled = account.PayoutsEnabled, | ||||||
|             Balance = balance, |             Balance = balance, | ||||||
|  |             PendingBalance = pendingBalance, | ||||||
|             PayoutUrl =  _paymentService.CreateDashboardUrl(Artist.StripeAccountId) |             PayoutUrl =  _paymentService.CreateDashboardUrl(Artist.StripeAccountId) | ||||||
|         }; |         }; | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
|  | |||||||
| @ -7,4 +7,5 @@ public class PayoutModel | |||||||
|     public double Balance { get; set; } |     public double Balance { get; set; } | ||||||
|     public bool Enabled { get; set; } |     public bool Enabled { get; set; } | ||||||
|     public string PayoutUrl { get; set; } |     public string PayoutUrl { get; set; } | ||||||
|  |     public double PendingBalance { get; set; } | ||||||
| } | } | ||||||
| @ -13,4 +13,5 @@ public interface IPaymentService | |||||||
|     string CreateDashboardUrl(string accountId); |     string CreateDashboardUrl(string accountId); | ||||||
|     Account GetAccount(string? artistStripeAccountId); |     Account GetAccount(string? artistStripeAccountId); | ||||||
|     double GetBalance(string accountId); |     double GetBalance(string accountId); | ||||||
|  |     double GetPendingBalance(string accountId); | ||||||
| } | } | ||||||
| @ -152,4 +152,13 @@ public class StripePaymentServiceProvider:IPaymentService | |||||||
|         }); |         }); | ||||||
|         return balance.Available[0].Amount/100; |         return balance.Available[0].Amount/100; | ||||||
|     } |     } | ||||||
|  |     public double GetPendingBalance(string accountId) | ||||||
|  |     { | ||||||
|  |         var balanceService = new BalanceService(); | ||||||
|  |         var balance = balanceService.Get(new RequestOptions() | ||||||
|  |         { | ||||||
|  |             StripeAccount = accountId | ||||||
|  |         }); | ||||||
|  |         return balance.Pending[0].Amount/100; | ||||||
|  |     } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Damien Ostler
						Damien Ostler