本文整理汇总了C#中Braintree.SubscriptionSearchRequest类的典型用法代码示例。如果您正苦于以下问题:C# SubscriptionSearchRequest类的具体用法?C# SubscriptionSearchRequest怎么用?C# SubscriptionSearchRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SubscriptionSearchRequest类属于Braintree命名空间,在下文中一共展示了SubscriptionSearchRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Index
// GET: Subscriptions
public ActionResult Index()
{
var request = new SubscriptionSearchRequest();
ResourceCollection<Subscription> collection = gateway.Subscription.Search(request);
return View(collection);
}
开发者ID:malevolence,项目名称:PaymentsTesting,代码行数:8,代码来源:SubscriptionsController.cs
示例2: ToXML_EscapesGeneratedXMLForArrayElements
public void ToXML_EscapesGeneratedXMLForArrayElements()
{
SubscriptionSearchRequest request = new SubscriptionSearchRequest().
Ids.IncludedIn("<active");
TestHelper.AssertIncludes("<ids type=\"array\"><item><active</item></ids>", request.ToXml());
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:7,代码来源:RequestTest.cs
示例3: Search
/// <summary>
/// Search for subscriptions based on PlanId, DaysPastDue and Status
/// </summary>
/// <example>
/// Quick Start Example:
/// </example>
/// <code>
/// BraintreeGateway gateway = new BraintreeGateway(...);
/// gateway.Subscription.Search(delegate(SubscriptionSearchRequest search) {
/// search.PlanId().StartsWith("abc");
/// search.DaysPastDue().Is("30");
/// search.Status().IncludedIn(Subscription.Status.ACTIVE, Subscription.Status.CANCELED);
/// });
/// </code>
public virtual ResourceCollection<Subscription> Search(SubscriptionSearchRequest query)
{
var response = new NodeWrapper(service.Post(service.MerchantPath() + "/subscriptions/advanced_search_ids", query));
return new ResourceCollection<Subscription>(response, delegate(string[] ids) {
return FetchSubscriptions(query, ids);
});
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:22,代码来源:SubscriptionGateway.cs
示例4: FetchSubscriptions
private List<Subscription> FetchSubscriptions(SubscriptionSearchRequest query, string[] ids)
{
query.Ids.IncludedIn(ids);
var response = new NodeWrapper(service.Post(service.MerchantPath() + "/subscriptions/advanced_search", query));
var subscriptions = new List<Subscription>();
foreach (var node in response.GetList("subscription"))
{
subscriptions.Add(new Subscription(node, gateway));
}
return subscriptions;
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:13,代码来源:SubscriptionGateway.cs
示例5: FetchSubscriptions
private List<Subscription> FetchSubscriptions(SubscriptionSearchRequest query, String[] ids)
{
query.Ids.IncludedIn(ids);
NodeWrapper response = new NodeWrapper(Service.Post("/subscriptions/advanced_search", query));
List<Subscription> subscriptions = new List<Subscription>();
foreach (NodeWrapper node in response.GetList("subscription"))
{
subscriptions.Add(new Subscription(node, Service));
}
return subscriptions;
}
开发者ID:khorvat,项目名称:braintree_dotnet,代码行数:13,代码来源:SubscriptionGateway.cs
示例6: Search_OnPlanIdIncludedIn
public void Search_OnPlanIdIncludedIn()
{
SubscriptionRequest request1 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITH_TRIAL.Id,
Price = 5M
};
SubscriptionRequest request2 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITHOUT_TRIAL.Id,
Price = 5M
};
SubscriptionRequest request3 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.ADD_ON_DISCOUNT_PLAN.Id,
Price = 5M
};
Subscription subscription1 = gateway.Subscription.Create(request1).Target;
Subscription subscription2 = gateway.Subscription.Create(request2).Target;
Subscription subscription3 = gateway.Subscription.Create(request3).Target;
SubscriptionSearchRequest request = new SubscriptionSearchRequest().
PlanId.IncludedIn(PlanFixture.ADD_ON_DISCOUNT_PLAN.Id, PlanFixture.PLAN_WITH_TRIAL.Id).
Price.Is(5M);
ResourceCollection<Subscription> collection = gateway.Subscription.Search(request);
Assert.IsTrue(TestHelper.IncludesSubscription(collection, subscription1));
Assert.IsFalse(TestHelper.IncludesSubscription(collection, subscription2));
Assert.IsTrue(TestHelper.IncludesSubscription(collection, subscription3));
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:37,代码来源:SubscriptionTest.cs
示例7: Search_OnBillingCyclesRemainingIs
public void Search_OnBillingCyclesRemainingIs()
{
SubscriptionRequest request1 = new SubscriptionRequest
{
NumberOfBillingCycles = 5,
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITH_TRIAL.Id,
Price = 4M
};
SubscriptionRequest request2 = new SubscriptionRequest
{
NumberOfBillingCycles = 10,
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITH_TRIAL.Id,
Price = 4M
};
Subscription subscription1 = gateway.Subscription.Create(request1).Target;
Subscription subscription2 = gateway.Subscription.Create(request2).Target;
SubscriptionSearchRequest request = new SubscriptionSearchRequest().
BillingCyclesRemaining.Is(5).
Price.Is(4M);
ResourceCollection<Subscription> collection = gateway.Subscription.Search(request);
Assert.IsTrue(TestHelper.IncludesSubscription(collection, subscription1));
Assert.IsFalse(TestHelper.IncludesSubscription(collection, subscription2));
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:30,代码来源:SubscriptionTest.cs
示例8: Search_OnPrice
public void Search_OnPrice()
{
SubscriptionRequest request10 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITH_TRIAL.Id,
Price = 10M
};
SubscriptionRequest request20 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITH_TRIAL.Id,
Price = 20M
};
SubscriptionRequest request30 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITH_TRIAL.Id,
Price = 30M
};
Subscription subscription10 = gateway.Subscription.Create(request10).Target;
Subscription subscription20 = gateway.Subscription.Create(request20).Target;
Subscription subscription30 = gateway.Subscription.Create(request30).Target;
SubscriptionSearchRequest request = new SubscriptionSearchRequest().
Price.Between(15M, 20M);
ResourceCollection<Subscription> collection = gateway.Subscription.Search(request);
Assert.IsFalse(TestHelper.IncludesSubscription(collection, subscription10));
Assert.IsTrue(TestHelper.IncludesSubscription(collection, subscription20));
Assert.IsFalse(TestHelper.IncludesSubscription(collection, subscription30));
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:36,代码来源:SubscriptionTest.cs
示例9: Search_OnTransactionId
public void Search_OnTransactionId()
{
TestPlan triallessPlan = PlanFixture.PLAN_WITHOUT_TRIAL;
SubscriptionRequest request1 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = triallessPlan.Id,
Price = 7M
};
SubscriptionRequest request2 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = triallessPlan.Id,
Price = 7M
};
Subscription matchingSubscription = gateway.Subscription.Create(request1).Target;
Subscription nonMatchingSubscription = gateway.Subscription.Create(request2).Target;
SubscriptionSearchRequest request = new SubscriptionSearchRequest().
TransactionId.Is(matchingSubscription.Transactions[0].Id);
ResourceCollection<Subscription> collection = gateway.Subscription.Search(request);
Assert.IsTrue(TestHelper.IncludesSubscription(collection, matchingSubscription));
Assert.IsFalse(TestHelper.IncludesSubscription(collection, nonMatchingSubscription));
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:28,代码来源:SubscriptionTest.cs
示例10: Search_OnMerchantAccountIdWithBogusMerchantId
public void Search_OnMerchantAccountIdWithBogusMerchantId()
{
Random random = new Random();
String subscriptionId = random.Next(0, 100000).ToString();
var subscriptionRequest = new SubscriptionRequest
{
MerchantAccountId = MerchantAccountIDs.NON_DEFAULT_MERCHANT_ACCOUNT_ID,
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITH_TRIAL.Id,
Price = 2M,
Id = subscriptionId
};
gateway.Subscription.Create(subscriptionRequest);
var searchRequest = new SubscriptionSearchRequest().
MerchantAccountId.Is(MerchantAccountIDs.NON_DEFAULT_MERCHANT_ACCOUNT_ID).
Id.Is(subscriptionId).
Price.Is(2M);
var collection = gateway.Subscription.Search(searchRequest);
Assert.AreEqual(1, collection.MaximumCount);
searchRequest = new SubscriptionSearchRequest().
MerchantAccountId.IncludedIn(MerchantAccountIDs.NON_DEFAULT_MERCHANT_ACCOUNT_ID, "bogus_merchant_account_id").
Id.Is(subscriptionId).
Price.Is(2M);
collection = gateway.Subscription.Search(searchRequest);
Assert.AreEqual(1, collection.MaximumCount);
searchRequest = new SubscriptionSearchRequest().
MerchantAccountId.Is("bogus_merchant_account_id").
Id.Is(subscriptionId).
Price.Is(2M);
collection = gateway.Subscription.Search(searchRequest);
Assert.AreEqual(0, collection.MaximumCount);
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:42,代码来源:SubscriptionTest.cs
示例11: ToXml_DaysPastDueLessThanOrEqualTo
public void ToXml_DaysPastDueLessThanOrEqualTo()
{
SubscriptionSearchRequest request = new SubscriptionSearchRequest().DaysPastDue.LessThanOrEqualTo(4);
var xml = "<search><days-past-due><max>4</max></days-past-due></search>";
Assert.AreEqual(xml, request.ToXml());
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:6,代码来源:SubscriptionSearchRequestTest.cs
示例12: ToXml_IdIsNot
public void ToXml_IdIsNot()
{
SubscriptionSearchRequest request = new SubscriptionSearchRequest().Id.IsNot("30");
var xml = "<search><id><is-not>30</is-not></id></search>";
Assert.AreEqual(xml, request.ToXml());
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:6,代码来源:SubscriptionSearchRequestTest.cs
示例13: Search_OnInTrialPeriodIs
public void Search_OnInTrialPeriodIs()
{
SubscriptionRequest request1 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITH_TRIAL.Id
};
SubscriptionRequest request2 = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITHOUT_TRIAL.Id
};
Subscription trial = gateway.Subscription.Create(request1).Target;
Subscription noTrial = gateway.Subscription.Create(request2).Target;
SubscriptionSearchRequest request = new SubscriptionSearchRequest().
InTrialPeriod.Is(true);
ResourceCollection<Subscription> trialResults = gateway.Subscription.Search(request);
Assert.IsTrue(TestHelper.IncludesSubscription(trialResults, trial));
Assert.IsFalse(TestHelper.IncludesSubscription(trialResults, noTrial));
request = new SubscriptionSearchRequest().
InTrialPeriod.Is(false);
ResourceCollection<Subscription> noTrialResults = gateway.Subscription.Search(request);
Assert.IsTrue(TestHelper.IncludesSubscription(noTrialResults, noTrial));
Assert.IsFalse(TestHelper.IncludesSubscription(noTrialResults, trial));
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:33,代码来源:SubscriptionTest.cs
示例14: ToXml_PriceLessThanOrEqualTo
public void ToXml_PriceLessThanOrEqualTo()
{
SubscriptionSearchRequest request = new SubscriptionSearchRequest().Price.LessThanOrEqualTo(12.34M);
var xml = "<search><price><max>12.34</max></price></search>";
Assert.AreEqual(xml, request.ToXml());
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:6,代码来源:SubscriptionSearchRequestTest.cs
示例15: ToXml_BillingCyclesRemainingLessThanOrEqualTo
public void ToXml_BillingCyclesRemainingLessThanOrEqualTo()
{
SubscriptionSearchRequest request = new SubscriptionSearchRequest().BillingCyclesRemaining.LessThanOrEqualTo(12.34);
var xml = "<search><billing-cycles-remaining><max>12.34</max></billing-cycles-remaining></search>";
Assert.AreEqual(xml, request.ToXml());
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:6,代码来源:SubscriptionSearchRequestTest.cs
示例16: ToXml_PriceBetween
public void ToXml_PriceBetween()
{
SubscriptionSearchRequest request = new SubscriptionSearchRequest().Price.Between(1M, 2M);
var xml = "<search><price><min>1</min><max>2</max></price></search>";
Assert.AreEqual(xml, request.ToXml());
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:6,代码来源:SubscriptionSearchRequestTest.cs
示例17: ToXml_PriceIs
public void ToXml_PriceIs()
{
SubscriptionSearchRequest request = new SubscriptionSearchRequest().Price.Is(1M);
var xml = "<search><price><is>1</is></price></search>";
Assert.AreEqual(xml, request.ToXml());
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:6,代码来源:SubscriptionSearchRequestTest.cs
示例18: ToXml_BillingCyclesRemainingBetween
public void ToXml_BillingCyclesRemainingBetween()
{
SubscriptionSearchRequest request = new SubscriptionSearchRequest().BillingCyclesRemaining.Between(1, 2);
var xml = "<search><billing-cycles-remaining><min>1</min><max>2</max></billing-cycles-remaining></search>";
Assert.AreEqual(xml, request.ToXml());
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:6,代码来源:SubscriptionSearchRequestTest.cs
示例19: Search_OnDaysPastDueBetween
public void Search_OnDaysPastDueBetween()
{
SubscriptionRequest subscriptionRequest = new SubscriptionRequest
{
PaymentMethodToken = creditCard.Token,
PlanId = PlanFixture.PLAN_WITH_TRIAL.Id,
};
Subscription subscription = gateway.Subscription.Create(subscriptionRequest).Target;
MakePastDue(subscription, 3);
SubscriptionSearchRequest request = new SubscriptionSearchRequest().
DaysPastDue.Between(2, 10);
ResourceCollection<Subscription> collection = gateway.Subscription.Search(request);
Assert.IsTrue(collection.MaximumCount > 0);
foreach (Subscription foundSubscription in collection) {
Assert.IsTrue(foundSubscription.DaysPastDue >= 2 && foundSubscription.DaysPastDue <= 10);
}
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:21,代码来源:SubscriptionTest.cs
示例20: ToXml_IdEndsWith
public void ToXml_IdEndsWith()
{
SubscriptionSearchRequest request = new SubscriptionSearchRequest().Id.EndsWith("30");
var xml = "<search><id><ends-with>30</ends-with></id></search>";
Assert.AreEqual(xml, request.ToXml());
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:6,代码来源:SubscriptionSearchRequestTest.cs
注:本文中的Braintree.SubscriptionSearchRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论