public void All_ReturnsAllPlans() { string planToken = $"plan{new Random().Next(1000000).ToString()}"; service.Post(service.MerchantPath() + "/plans/create_plan_for_tests", new PlanRequestForTests { BillingDayOfMonth = 1, BillingFrequency = 1, CurrencyIsoCode = "USD", Description = "a_test_plan", Id = planToken, Name = "dotnet_plan", NumberOfBillingCycles = 1, Price = 100.00M, TrialPeriod = false, }); List<Plan> collection = gateway.Plan.All(); Assert.IsNotEmpty(collection); Plan plan = collection.Find ( p => p.Id == planToken ); Assert.AreEqual("dotnet_plan", plan.Name); Assert.AreEqual(1, plan.BillingDayOfMonth); Assert.AreEqual(1, plan.BillingFrequency); Assert.AreEqual("USD", plan.CurrencyIsoCode); Assert.AreEqual("a_test_plan", plan.Description); Assert.AreEqual(1, plan.NumberOfBillingCycles); Assert.AreEqual(100.00M, plan.Price); Assert.AreEqual(false, plan.TrialPeriod); }
public void All_ReturnsAllAddOns() { string addOnId = $"dotnet_add_on{new Random().Next(1000000).ToString()}"; service.Post(service.MerchantPath() + "/modifications/create_modification_for_tests", new ModificationRequestForTests { Amount = 100.00M, Description = "a test add-on", Id = addOnId, Kind = "add_on", Name = "add_on_name", NeverExpires = false, NumberOfBillingCycles = 12 }); List<AddOn> collection = gateway.AddOn.All(); Assert.IsNotEmpty(collection); AddOn addOn = collection.Find ( a => a.Id == addOnId ); Assert.AreEqual(100.00M, addOn.Amount); Assert.AreEqual("a test add-on", addOn.Description); Assert.AreEqual(addOnId, addOn.Id); Assert.AreEqual("add_on", addOn.Kind); Assert.AreEqual("add_on_name", addOn.Name); Assert.AreEqual(false, addOn.NeverExpires); Assert.AreEqual(12, addOn.NumberOfBillingCycles); Assert.IsNotNull(addOn.CreatedAt); Assert.IsNotNull(addOn.UpdatedAt); }
public void All_ReturnsAllDiscounts() { string discountId = string.Format("dotnet_discount{0}", new Random().Next(1000000).ToString()); service.Post(service.MerchantPath() + "/modifications/create_modification_for_tests", new ModificationRequestForTests { Amount = 100M, Description = "a test discount", Id = discountId, Kind = "discount", Name = "discount_name", NeverExpires = false, NumberOfBillingCycles = 12 }); List<Discount> collection = gateway.Discount.All(); Assert.IsNotEmpty(collection); Discount discount = collection.Find ( delegate(Discount d) { return d.Id == discountId; } ); Assert.AreEqual(100M, discount.Amount); Assert.AreEqual("a test discount", discount.Description); Assert.AreEqual(discountId, discount.Id); Assert.AreEqual("discount", discount.Kind); Assert.AreEqual("discount_name", discount.Name); Assert.AreEqual(false, discount.NeverExpires); Assert.AreEqual(12, discount.NumberOfBillingCycles); Assert.IsNotNull(discount.CreatedAt); Assert.IsNotNull(discount.UpdatedAt); }
public static string Create3DSVerification(BraintreeService service, string merchantAccountId, ThreeDSecureRequestForTests request) { string url = "/three_d_secure/create_verification/" + merchantAccountId; NodeWrapper response = new NodeWrapper(service.Post(service.MerchantPath() + url, request)); Assert.IsTrue(response.IsSuccess()); return(response.GetString("three-d-secure-token")); }
public static string Generate3DSNonce(BraintreeService service, CreditCardRequest request) { string url = "/three_d_secure/create_nonce/" + MerchantAccountIDs.THREE_D_SECURE_MERCHANT_ACCOUNT_ID; NodeWrapper response = new NodeWrapper(service.Post(service.MerchantPath() + url, request)); Assert.IsTrue(response.IsSuccess()); return(response.GetString("nonce")); }
public static string CreateGrant(BraintreeGateway gateway, string merchantId, string scope) { var service = new BraintreeService(gateway.Configuration); XmlNode node = service.Post("/oauth_testing/grants", new OAuthGrantRequest { MerchantId = merchantId, Scope = scope }); return(node["code"].InnerText); }
public Result <PaymentMethodNonce> Create(string token) { var response = new NodeWrapper(service.Post(service.MerchantPath() + "/payment_methods/" + token + "/nonces")); return(new ResultImpl <PaymentMethodNonce>(response, gateway)); }
public static string CreateGrant(BraintreeGateway gateway, string merchantId, string scope) { var service = new BraintreeService(gateway.Configuration); XmlNode node = service.Post("/oauth_testing/grants", new OAuthGrantRequest { MerchantId = merchantId, Scope = scope }); return node["code"].InnerText; }
public static string Create3DSVerification(BraintreeService service, string merchantAccountId, ThreeDSecureRequestForTests request) { string url = "/three_d_secure/create_verification/" + merchantAccountId; NodeWrapper response = new NodeWrapper(service.Post(service.MerchantPath() + url, request)); Assert.IsTrue(response.IsSuccess()); return response.GetString("three-d-secure-token"); }