Stripe.Net 21.4.1从“ BalanceService”对象中删除了“ List”方法

时间:2018-11-20 01:00:36

标签: c# stripe-payments

我将.Net的Stripe.Net nuget软件包从19. +升级到21.4.1,但是这样做之后,我必须对代码进行大量更改。我必须做的一项更改是删除对象名称中的所有Stripe。

例如StripeBalanceService-> BalanceService

执行此操作时,我注意到“ BalanceService”对象丢失了“ List”方法!我仍然在Stripe docs

中看到它

我是否在打包或更新方面缺少某些内容? 还是Stripe只是把我搞砸了??

以下是显示缺少方法的屏幕截图

enter image description here

这是“ BalanceService”对象可用内容的下拉列表。

enter image description here

这是我调用方法的代码

    private static void GetBalanceTranactionIds(string payoutId, ref List<string> balanceTransactionIds, string startingAfter)
    {
        var service = new BalanceService();
        var balanceOptions = new BalanceTransactionListOptions { Limit =100, PayoutId = payoutId };

        if (startingAfter != null)
            balanceOptions.StartingAfter = startingAfter;

        List<BalanceTransaction> balanceTransactions = service.List(balanceOptions);

        balanceTransactionIds.AddRange(balanceTransactions.Select(i => i.Id).ToList());

        if (balanceTransactions.Count() == 100)
            GetBalanceTranactionIds(payoutId, ref balanceTransactionIds, balanceTransactions.Last().Id);
    }

这里是没有列表的BalanceService对象。

public class BalanceService : Service<Balance>, ISingletonRetrievable<Balance>
{
    public BalanceService();
    public BalanceService(string apiKey);

    public override string BasePath { get; }

    public virtual Balance Get(RequestOptions requestOptions = null);
    public virtual Task<Balance> GetAsync(RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken));
}

1 个答案:

答案 0 :(得分:0)

类似BalanceTransaction的功能已从BalanceService.cs中提取并移至其自己的类。 您可以做类似

的操作
var service = new BalanceTransactionService();
var balanceOptions = new BalanceTransactionListOptions { Limit =100, PayoutId = payoutId }; 
service.BalanceTransactionService.ListAsync(balanceOptions );

更改参考:https://github.com/stripe/stripe-dotnet/commit/9c6e4e3c213fb8064e625a8e53b9bd306e641d6a#diff-3cef216515aac44aeefa3ba55153f755