public void Constructor_RaisesDownForMaintenanceExceptionIfDownForMaintenance() { BraintreeGateway gateway = new BraintreeGateway() { Environment = Environment.DEVELOPMENT, MerchantId = "integration_merchant_id", PublicKey = "integration_public_key", PrivateKey = "integration_private_key" }; service = new BraintreeService(gateway.Configuration); Exception exception = null; try { CustomerRequest trParams = new CustomerRequest(); CustomerRequest request = new CustomerRequest { FirstName = "John", LastName = "Doe" }; string queryString = TestHelper.QueryStringForTR(trParams, request, service.BaseMerchantURL() + "/test/maintenance", service); gateway.TransparentRedirect.ConfirmCustomer(queryString); } catch (Exception localException) { exception = localException; } Assert.IsNotNull(exception); Assert.IsInstanceOf(typeof(DownForMaintenanceException), exception); }
public void Constructor_RaisesDownForMaintenanceExceptionIfDownForMaintenance() { BraintreeGateway gateway = new BraintreeGateway() { Environment = Environment.DEVELOPMENT, MerchantId = "integration_merchant_id", PublicKey = "integration_public_key", PrivateKey = "integration_private_key" }; BraintreeService service = new BraintreeService(gateway.Configuration); try { CustomerRequest trParams = new CustomerRequest(); CustomerRequest request = new CustomerRequest { FirstName = "John", LastName = "Doe" }; String queryString = TestHelper.QueryStringForTR(trParams, request, service.BaseMerchantURL() + "/test/maintenance", service); gateway.Customer.ConfirmTransparentRedirect(queryString); Assert.Fail("Expected DownForMaintenanceException"); } catch (Braintree.Exceptions.DownForMaintenanceException) { // expected } }
public void BaseMerchantURL_ReturnsDevelopmentURL() { BraintreeService service = new BraintreeService(new Configuration( Environment.DEVELOPMENT, "integration_merchant_id", "integration_public_key", "integration_private_key" )); var host = System.Environment.GetEnvironmentVariable("GATEWAY_HOST") ?? "localhost"; var port = System.Environment.GetEnvironmentVariable("GATEWAY_PORT") ?? "3000"; var expected = String.Format("http://{0}:{1}/merchants/integration_merchant_id", host, port); Assert.AreEqual(expected, service.BaseMerchantURL()); }
public void BaseMerchantURL_ReturnsDevelopmentURL() { BraintreeService service = new BraintreeService(new Configuration( Environment.DEVELOPMENT, "integration_merchant_id", "integration_public_key", "integration_private_key" )); var host = System.Environment.GetEnvironmentVariable("GATEWAY_HOST") ?? "localhost"; var port = System.Environment.GetEnvironmentVariable("GATEWAY_PORT") ?? "3000"; var expected = string.Format("http://{0}:{1}/merchants/integration_merchant_id", host, port); Assert.AreEqual(expected, service.BaseMerchantURL()); }
public void ConfigurationWithStringEnvironment_Initializes() { Configuration config = new Configuration( "development", "integration_merchant_id", "integration_public_key", "integration_private_key" ); BraintreeService service = new BraintreeService(config); var host = System.Environment.GetEnvironmentVariable("GATEWAY_HOST") ?? "localhost"; var port = System.Environment.GetEnvironmentVariable("GATEWAY_PORT") ?? "3000"; var expected = string.Format("http://{0}:{1}/merchants/integration_merchant_id", host, port); Assert.AreEqual(expected, service.BaseMerchantURL()); }
public void BaseMerchantURL_ReturnsProductionURL() { BraintreeService service = new BraintreeService(new Configuration( Environment.PRODUCTION, "integration_merchant_id", "integration_public_key", "integration_private_key" )); Assert.AreEqual("https://api.braintreegateway.com:443/merchants/integration_merchant_id", service.BaseMerchantURL()); }
public void BaseMerchantURL_ReturnsSandboxURL() { BraintreeService service = new BraintreeService(new Configuration( Environment.SANDBOX, "integration_merchant_id", "integration_public_key", "integration_private_key" )); Assert.AreEqual("https://api.sandbox.braintreegateway.com:443/merchants/integration_merchant_id", service.BaseMerchantURL()); }
public void BaseMerchantURL_ReturnsProductionURL() { BraintreeService service = new BraintreeService(new Configuration( Environment.PRODUCTION, "integration_merchant_id", "integration_public_key", "integration_private_key" )); Assert.AreEqual("https://api.braintreegateway.com:443/merchants/integration_merchant_id", service.BaseMerchantURL()); }
public void BaseMerchantURL_ReturnsSandboxURL() { BraintreeService service = new BraintreeService(new Configuration( Environment.SANDBOX, "integration_merchant_id", "integration_public_key", "integration_private_key" )); Assert.AreEqual("https://api.sandbox.braintreegateway.com:443/merchants/integration_merchant_id", service.BaseMerchantURL()); }
public void ConfigurationWithStringEnvironment_Initializes() { Configuration config = new Configuration( "development", "integration_merchant_id", "integration_public_key", "integration_private_key" ); BraintreeService service = new BraintreeService(config); var host = System.Environment.GetEnvironmentVariable("GATEWAY_HOST") ?? "localhost"; var port = System.Environment.GetEnvironmentVariable("GATEWAY_PORT") ?? "3000"; var expected = string.Format("http://{0}:{1}/merchants/integration_merchant_id", host, port); Assert.AreEqual(expected, service.BaseMerchantURL()); }
public void TransparentRedirectURLForCreate_ReturnsCorrectValue() { Assert.AreEqual(service.BaseMerchantURL() + "/payment_methods/all/create_via_transparent_redirect_request", gateway.CreditCard.TransparentRedirectURLForCreate()); }
public void TransparentRedirectURL_ReturnsCorrectValue() { Assert.AreEqual(service.BaseMerchantURL() + "/transparent_redirect_requests", gateway.TransparentRedirect.Url); }