本文整理汇总了C#中Braintree.TransactionSearchRequest类的典型用法代码示例。如果您正苦于以下问题:C# TransactionSearchRequest类的具体用法?C# TransactionSearchRequest怎么用?C# TransactionSearchRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionSearchRequest类属于Braintree命名空间,在下文中一共展示了TransactionSearchRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
// GET api/<controller>
public IEnumerable<SimpleTransaction> Get(string pub, string priv, string merchant, long from, long to)
{
var gateway = new BraintreeGateway
{
Environment = Braintree.Environment.SANDBOX,
MerchantId = merchant,
PublicKey = pub,
PrivateKey = priv
};
var fromDate = FromUnixTime(from);
var toDate = FromUnixTime(to).AddDays(1);
var request = new TransactionSearchRequest().SubmittedForSettlementAt.Between(fromDate, toDate);
ResourceCollection<Transaction> collection = gateway.Transaction.Search(request);
return (from Transaction transaction in collection
select new SimpleTransaction
{
Id = transaction.Id,
MerchantAccountId = transaction.MerchantAccountId,
Status = transaction.Status.ToString(),
Amount = transaction.Amount,
TaxAmount = transaction.TaxAmount,
CreatedAt = transaction.CreatedAt,
CurrencyIsoCode = transaction.CurrencyIsoCode
}).ToList();
}
示例2: Transactions
public ResourceCollection<Transaction> Transactions()
{
var gateway = new TransactionGateway(this.gateway);
var searchRequest = new TransactionSearchRequest().
Ids.IncludedIn(TransactionIds.ToArray());
return gateway.Search(searchRequest);
}
示例3: Transactions
public ResourceCollection<Transaction> Transactions()
{
TransactionGateway gateway = new TransactionGateway(service);
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
Ids.IncludedIn(TransactionIds.ToArray());
return gateway.Search(searchRequest);
}
示例4: Search_OnMultipleStatuses
public void Search_OnMultipleStatuses()
{
TransactionRequest request = new TransactionRequest
{
Amount = SandboxValues.TransactionAmount.AUTHORIZE,
CreditCard = new TransactionCreditCardRequest
{
Number = SandboxValues.CreditCardNumber.VISA,
ExpirationDate = "05/2010"
},
Options = new TransactionOptionsRequest
{
SubmitForSettlement = true
}
};
Transaction transaction = gateway.Transaction.Sale(request).Target;
DateTime threeDaysEarlier = DateTime.Now.AddDays(-3);
DateTime oneDayEarlier = DateTime.Now.AddDays(-1);
DateTime oneDayLater = DateTime.Now.AddDays(1);
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
AuthorizedAt.Between(oneDayEarlier, oneDayLater).
SubmittedForSettlementAt.Between(oneDayEarlier, oneDayLater);
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
AuthorizedAt.Between(threeDaysEarlier, oneDayEarlier).
SubmittedForSettlementAt.Between(threeDaysEarlier, oneDayEarlier);
Assert.AreEqual(0, gateway.Transaction.Search(searchRequest).MaximumCount);
}
示例5: Search_OnAuthorizationExpiredStatus
public void Search_OnAuthorizationExpiredStatus()
{
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
Status.Is(TransactionStatus.AUTHORIZATION_EXPIRED);
ResourceCollection<Transaction> results = gateway.Transaction.Search(searchRequest);
Assert.IsTrue(results.MaximumCount > 0);
Assert.AreEqual(TransactionStatus.AUTHORIZATION_EXPIRED, results.FirstItem.Status);
}
示例6: Search_OnProcessorDeclinedAt
public void Search_OnProcessorDeclinedAt()
{
TransactionRequest request = new TransactionRequest
{
Amount = SandboxValues.TransactionAmount.DECLINE,
CreditCard = new TransactionCreditCardRequest
{
Number = SandboxValues.CreditCardNumber.VISA,
ExpirationDate = "05/2010"
}
};
Transaction transaction = gateway.Transaction.Sale(request).Transaction;
DateTime threeDaysEarlier = DateTime.Now.AddDays(-3);
DateTime oneDayEarlier = DateTime.Now.AddDays(-1);
DateTime oneDayLater = DateTime.Now.AddDays(1);
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
ProcessorDeclinedAt.Between(oneDayEarlier, oneDayLater);
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
ProcessorDeclinedAt.GreaterThanOrEqualTo(oneDayEarlier);
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
ProcessorDeclinedAt.LessThanOrEqualTo(oneDayLater);
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
ProcessorDeclinedAt.Between(threeDaysEarlier, oneDayEarlier);
Assert.AreEqual(0, gateway.Transaction.Search(searchRequest).MaximumCount);
}
示例7: Search
public virtual ResourceCollection<Transaction> Search(TransactionSearchRequest query)
{
var response = new NodeWrapper(service.Post(service.MerchantPath() + "/transactions/advanced_search_ids", query));
if (response.GetName() == "search-results") {
return new ResourceCollection<Transaction>(response, delegate(string[] ids) {
return FetchTransactions(query, ids);
});
} else {
throw new DownForMaintenanceException();
}
}
示例8: Search_OnDisputeDate
public void Search_OnDisputeDate()
{
DateTime disputeDate = DateTime.Parse("2014-03-01");
DateTime threeDaysEarlier = disputeDate.AddDays(-3);
DateTime oneDayEarlier = disputeDate.AddDays(-1);
DateTime oneDayLater = disputeDate.AddDays(1);
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
Id.Is("disputedtransaction").
DisputeDate.Between(oneDayEarlier, oneDayLater);
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is("2disputetransaction").
DisputeDate.GreaterThanOrEqualTo(oneDayEarlier);
Assert.AreEqual(2, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is("disputedtransaction").
DisputeDate.LessThanOrEqualTo(oneDayLater);
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is("disputedtransaction").
DisputeDate.Between(threeDaysEarlier, oneDayEarlier);
Assert.AreEqual(0, gateway.Transaction.Search(searchRequest).MaximumCount);
}
示例9: Search_OnAuthorizationExpiredAt
public void Search_OnAuthorizationExpiredAt()
{
DateTime threeDaysEarlier = DateTime.Now.AddDays(-3);
DateTime oneDayEarlier = DateTime.Now.AddDays(-1);
DateTime oneDayLater = DateTime.Now.AddDays(1);
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
AuthorizationExpiredAt.Between(threeDaysEarlier, oneDayEarlier);
Assert.AreEqual(0, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
AuthorizationExpiredAt.Between(oneDayEarlier, oneDayLater);
var results = gateway.Transaction.Search(searchRequest);
Assert.IsTrue(results.MaximumCount > 0);
Assert.AreEqual(TransactionStatus.AUTHORIZATION_EXPIRED, results.FirstItem.Status);
}
示例10: Search_PaymentInstrumentTypeIsApplePay
public void Search_PaymentInstrumentTypeIsApplePay()
{
TransactionRequest request = new TransactionRequest
{
Amount = SandboxValues.TransactionAmount.AUTHORIZE,
PaymentMethodNonce = Nonce.ApplePayVisa
};
Transaction transaction = gateway.Transaction.Sale(request).Target;
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
PaymentInstrumentType.Is("ApplePayDetail");
ResourceCollection<Transaction> collection = gateway.Transaction.Search(searchRequest);
Assert.AreEqual(collection.FirstItem.PaymentInstrumentType, PaymentInstrumentType.APPLE_PAY_CARD);
}
示例11: Search_OnAmount
public void Search_OnAmount()
{
TransactionRequest request = new TransactionRequest
{
Amount = 1000M,
CreditCard = new TransactionCreditCardRequest
{
Number = SandboxValues.CreditCardNumber.VISA,
ExpirationDate = "05/2010"
}
};
Transaction transaction = gateway.Transaction.Sale(request).Target;
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
Amount.Between(500M, 1500M);
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
Amount.GreaterThanOrEqualTo(500M);
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
Amount.LessThanOrEqualTo(1500M);
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
Amount.Between(500M, 900M);
Assert.AreEqual(0, gateway.Transaction.Search(searchRequest).MaximumCount);
}
示例12: Search_PaymentInstrumentTypeIsCreditCard
public void Search_PaymentInstrumentTypeIsCreditCard()
{
TransactionRequest request = new TransactionRequest
{
Amount = SandboxValues.TransactionAmount.AUTHORIZE,
CreditCard = new TransactionCreditCardRequest
{
Number = SandboxValues.CreditCardNumber.VISA,
ExpirationDate = "05/2010"
}
};
Transaction transaction = gateway.Transaction.Sale(request).Target;
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
PaymentInstrumentType.Is("CreditCardDetail");
ResourceCollection<Transaction> collection = gateway.Transaction.Search(searchRequest);
Assert.AreEqual(collection.FirstItem.PaymentInstrumentType,PaymentInstrumentType.CREDIT_CARD);
}
示例13: Search_PaymentInstrumentTypeIsPayPal
public void Search_PaymentInstrumentTypeIsPayPal()
{
TransactionRequest request = new TransactionRequest
{
Amount = SandboxValues.TransactionAmount.AUTHORIZE,
PaymentMethodNonce = Nonce.PayPalOneTimePayment
};
Transaction transaction = gateway.Transaction.Sale(request).Target;
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
PaymentInstrumentType.Is("PayPalDetail");
ResourceCollection<Transaction> collection = gateway.Transaction.Search(searchRequest);
Assert.AreEqual(collection.FirstItem.PaymentInstrumentType, PaymentInstrumentType.PAYPAL_ACCOUNT);
}
示例14: Search_OnTextNodeOperators
public void Search_OnTextNodeOperators() {
var request = new TransactionRequest
{
Amount = 1000M,
CreditCard = new TransactionCreditCardRequest
{
Number = "4111111111111111",
ExpirationDate = "05/2012",
CardholderName = "Tom Smith"
}
};
Transaction transaction = gateway.Transaction.Sale(request).Target;
var searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
CreditCardCardholderName.StartsWith("Tom");
ResourceCollection<Transaction> collection = gateway.Transaction.Search(searchRequest);
Assert.AreEqual(1, collection.MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
CreditCardCardholderName.EndsWith("Smith");
collection = gateway.Transaction.Search(searchRequest);
Assert.AreEqual(1, collection.MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
CreditCardCardholderName.Contains("m Sm");
collection = gateway.Transaction.Search(searchRequest);
Assert.AreEqual(1, collection.MaximumCount);
searchRequest = new TransactionSearchRequest().
Id.Is(transaction.Id).
CreditCardCardholderName.IsNot("Tom Smith");
collection = gateway.Transaction.Search(searchRequest);
Assert.AreEqual(0, collection.MaximumCount);
}
示例15: Search_OnPayPalFields
public void Search_OnPayPalFields()
{
var request = new TransactionRequest
{
Amount = SandboxValues.TransactionAmount.AUTHORIZE,
PaymentMethodNonce = Nonce.PayPalOneTimePayment
};
var transactionResult = gateway.Transaction.Sale(request);
Assert.IsTrue(transactionResult.IsSuccess());
var searchRequest = new TransactionSearchRequest().
Id.Is(transactionResult.Target.Id).
PayPalPaymentId.StartsWith("PAY").
PayPalAuthorizationId.StartsWith("SALE").
PayPalPayerEmail.Is("[email protected]");
Assert.AreEqual(1, gateway.Transaction.Search(searchRequest).MaximumCount);
}