private static JudoPayApi Create(Credentials credentials, JudoEnvironment environment) { string baseUrl = null; switch (environment) { case JudoEnvironment.Live: baseUrl = LIVE_URL; break; case JudoEnvironment.Sandbox: baseUrl = SANDBOX_URL; break; } IHttpClientHelper httpClientHelper = DependencyService.Get<IHttpClientHelper>(); IClientService clientService = DependencyService.Get<IClientService>(); var nh = new NativeHandler(httpClientHelper.MessageHandler, credentials, XamarinLoggerFactory.Create(typeof(AuthorizationHandler)), Apiversionheader, API_VERSION, clientService); HttpClientWrapper httpClient = new HttpClientWrapper(nh); var connection = new Connection(httpClient, XamarinLoggerFactory.Create, baseUrl); var client = new Client(connection); return new JudoPayApi(XamarinLoggerFactory.Create, client); }
private static JudoPayApi Create(Credentials credentials, JudoEnvironment environment) { string baseUrl = null; switch (environment) { case JudoEnvironment.Live: baseUrl = LIVE_URL; break; case JudoEnvironment.Sandbox: baseUrl = SANDBOX_URL; break; } var httpClient = new HttpClientWrapper(new AuthorizationHandler(credentials, XamarinLoggerFactory.Create(typeof(AuthorizationHandler))), new VersioningHandler(Apiversionheader, API_VERSION)); var connection = new Connection(httpClient, XamarinLoggerFactory.Create, baseUrl); var client = new Client(connection); return(new JudoPayApi(XamarinLoggerFactory.Create, client)); }
public void UsingDefault(JudoEnvironment judoEnvironment, string expectedUrl) { var configuration = Substitute.For<IJudoConfiguration>(); var result = JudoPaymentsFactory.GetEnvironmentUrl(judoEnvironment, configuration); Assert.AreEqual(expectedUrl, result); }
public void UsingConfigSetting(JudoEnvironment judoEnvironment, string configKey, string expectedUrl) { var configuration = Substitute.For<IJudoConfiguration>(); configuration[configKey].Returns(expectedUrl); var result = JudoPaymentsFactory.GetEnvironmentUrl(judoEnvironment, configuration); Assert.AreEqual(expectedUrl, result); }
internal static string GetEnvironmentUrl(JudoEnvironment judoEnvironment) { string defaultValue = null; switch (judoEnvironment) { case JudoEnvironment.Sandbox: defaultValue = DEFAULT_SANDBOX_URL; break; case JudoEnvironment.Live: defaultValue = DEFAULT_LIVE_URL; break; } return(defaultValue); }
Judo BuildJudo(JudoEnvironment environment = JudoEnvironment.Sandbox) { // A! - on Android these properties are only customisable through styles.xml - see https://github.com/Judopay/Xamarin-Sample-App/wiki/Theme-reference var theme = new Theme { PageTitle = "Card details", ButtonLabel = "Authorize payment", ShowSecurityMessage = true, SecurityMessageTextColor = Color.Green, ButtonTextColor = Color.Orange, ButtonBackgroundColor = Color.DarkRed, BackgroundColor = Color.LightGray, EntryTextColor = Color.DarkOrange, LabelActiveTextColor = Color.Yellow, // A! LabelInactiveTextColor = Color.LightPink, // A! PlaceholderTextColor = Color.Fuchsia, // A! ErrorTextColor = Color.DarkRed, // A! OverlayBackgroundColor = Color.Black.MultiplyAlpha(0.7) }; return(new Judo { JudoId = "<JUDO_ID>", Token = "<API_TOKEN>", Secret = "<API_SECRET>", Environment = environment, Amount = 0.01m, Currency = Settings.Currency, MaestroAccepted = Settings.MaestroAllowed, AmexAccepted = Settings.AmexAllowed, AvsEnabled = Settings.AvsEnabled, ConsumerReference = "XamarinSdkConsumerRef", MetaData = new Dictionary <string, string> { { "SampleApp", "true" } }, //Theme = theme }); }
public void GetEnvironmentUrl(JudoEnvironment judoEnvironment, string expectedUrl) { var result = JudoPaymentsFactory.GetEnvironmentUrl(judoEnvironment); Assert.AreEqual(expectedUrl, result); }
public static JudoPayApi Create(JudoEnvironment environment, string oauthAccessToken) { return(Create(new Credentials(oauthAccessToken), environment)); }
public static JudoPayApi Create(JudoEnvironment environment, string token, string secret) { return(Create(new Credentials(token, secret), environment)); }
/// <summary> /// Creates an instance of the judopay api client with a custom base url, that will authenticate with your api token and secret. /// </summary> /// <param name="judoEnvironment">Either the sandbox (development/testing) or live environments</param> /// <param name="token">Your API token (from our merchant dashboard)</param> /// <param name="secret">Your API secret (from our merchant dashboard)</param> /// <param name="userAgent">The name and version number of the calling application, should be in the form PRODUCT/VERSION</param> /// <returns>Initialized instance of the Judopay api client</returns> public static JudoPayApi Create(JudoEnvironment judoEnvironment, string token, string secret, ProductInfoHeaderValue userAgent) { return(Create(new Credentials(token, secret), GetEnvironmentUrl(judoEnvironment), userAgent)); }
internal static string GetEnvironmentUrl(JudoEnvironment judoEnvironment, IJudoConfiguration configuration = null) { string key = null; string defaultValue = null; switch (judoEnvironment) { case JudoEnvironment.Sandbox: key = SandboxUrlKey; defaultValue = DEFAULT_SANDBOX_URL; break; case JudoEnvironment.Live: key = LiveUrlKey; defaultValue = DEFAULT_LIVE_URL; break; } return GetConfigValue(key, defaultValue, configuration ?? defaultConfigurationAccess); }
internal static JudoPayApi Create(Credentials credentials, JudoEnvironment judoEnvironment, string apiVersion) { return Create(credentials, GetEnvironmentUrl(judoEnvironment), apiVersion, null); }
/// <summary> /// Creates an instance of the judopay api client with a custom base url, that will authenticate with your api token and secret. /// </summary> /// <param name="judoEnvironment">Either the sandbox (development/testing) or live environments</param> /// <param name="token">Your API token (from our merchant dashboard)</param> /// <param name="secret">Your API secret (from our merchant dashboard)</param> /// <param name="userAgent">The name and version number of the calling application, should be in the form PRODUCT/VERSION</param> /// <returns>Initialized instance of the Judopay api client</returns> public static JudoPayApi Create(JudoEnvironment judoEnvironment, string token, string secret, ProductInfoHeaderValue userAgent) { return Create(new Credentials(token, secret), GetEnvironmentUrl(judoEnvironment), defaultConfigurationAccess, userAgent); }
/// <summary> /// Creates an instance of the judopay api client with a custom base url, that will authenticate with your api token and secret. /// </summary> /// <param name="judoEnvironment">Either the sandbox (development/testing) or live environments</param> /// <param name="token">Your API token (from our merchant dashboard)</param> /// <param name="secret">Your API secret (from our merchant dashboard)</param> /// <returns>Initialized instance of the Judopay api client</returns> public static JudoPayApi Create(JudoEnvironment judoEnvironment, string token, string secret) { return Create(token, secret, GetEnvironmentUrl(judoEnvironment), defaultConfigurationAccess); }
internal static JudoPayApi Create(Credentials credentials, JudoEnvironment judoEnvironment, string apiVersion) { return(Create(credentials, GetEnvironmentUrl(judoEnvironment), apiVersion, null)); }
public static JudoPayApi Create(JudoEnvironment environment, string token, string secret) { return Create(new Credentials(token, secret), environment); }
public static JudoPayApi Create(JudoEnvironment environment, string oauthAccessToken) { return Create(new Credentials(oauthAccessToken), environment); }
/// <summary> /// Creates an instance of the judopay api client with a custom base url, that will authenticate with your api token and secret. /// </summary> /// <param name="judoEnvironment">Either the sandbox (development/testing) or live environments</param> /// <param name="token">Your API token (from our merchant dashboard)</param> /// <param name="secret">Your API secret (from our merchant dashboard)</param> /// <returns>Initialized instance of the Judopay api client</returns> public static JudoPayApi Create(JudoEnvironment judoEnvironment, string token, string secret) { return(Create(token, secret, GetEnvironmentUrl(judoEnvironment))); }