mirror of
https://github.com/D4M13N-D3V/comissions-app-core-api.git
synced 2025-03-14 10:04:55 +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 balance = _paymentService.GetBalance(Artist.StripeAccountId);
|
||||
var pendingBalance = _paymentService.GetPendingBalance(Artist.StripeAccountId);
|
||||
var result = new PayoutModel()
|
||||
{
|
||||
Enabled = account.PayoutsEnabled,
|
||||
Balance = balance,
|
||||
PendingBalance = pendingBalance,
|
||||
PayoutUrl = _paymentService.CreateDashboardUrl(Artist.StripeAccountId)
|
||||
};
|
||||
return Ok(result);
|
||||
|
@ -7,4 +7,5 @@ public class PayoutModel
|
||||
public double Balance { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public string PayoutUrl { get; set; }
|
||||
public double PendingBalance { get; set; }
|
||||
}
|
@ -13,4 +13,5 @@ public interface IPaymentService
|
||||
string CreateDashboardUrl(string accountId);
|
||||
Account GetAccount(string? artistStripeAccountId);
|
||||
double GetBalance(string accountId);
|
||||
double GetPendingBalance(string accountId);
|
||||
}
|
@ -152,4 +152,13 @@ public class StripePaymentServiceProvider:IPaymentService
|
||||
});
|
||||
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