c# - 交易搜索始终为空
问题描述
我尝试搜索所有交易,但我总是得到空集合。在我的贝宝帐户中,我得到了很多交易。
我尝试了任何其他请求,同样我从所有请求中得到空
BraintreeGateway gw = new BraintreeGateway("access_token$...");
var request = new TransactionSearchRequest().Status.IncludedIn(TransactionStatus.ALL);
var collection = gw.Transaction.Search(request);
foreach (Braintree.Transaction transaction in collection)
{
Console.WriteLine(transaction.Id);
}
解决方案
由于ALL
不是有效的交易状态,您不会收到任何结果。可能的状态在此处链接。要搜索所有交易,您需要遍历每个交易状态。这是一个例子:
request = new TransactionSearchRequest().
Status.IncludedIn(TransactionStatus.AUTHORIZED,
TransactionStatus.SUBMITTED_FOR_SETTLEMENT
...); // add other statuses
collection = gateway.Transaction.Search(request);
全面披露:我在布伦特里工作。如果您还有其他问题,请随时联系 支持人员。
推荐阅读
- scala - 在scala中,协变类型参数怎么可能是抽象类型的上限,而不是另一个不变类型参数?
- python - 如何使用 Selenium 和 Pyhton 在 iframe 中单击弹出窗口按钮
- mysql - SQL - 通过用户本身 - 或 - 他的组从多对多关系中获取记录
- java - 404状态返回请求
- c# - 使用 c# 客户端发送但未收到的电子邮件?
- variables - 如何使用变量拆分基于 kotlin 的大型 Gradle 构建文件?
- mysql - SQL - 按两个不同的值分组
- python - Python:打印 1 行帕斯卡三角形
- json - 如何管理多个项目的 JSON 模式?
- javascript - 在 WordPress 中使用 substr 删除第一个字符串字符