Ejemplo n.º 1
0
        public void SettingSandboxModeShouldUseSandboxUrl()
        {
            var expectedSandboxUrl = "https://sandbox.gateway.sezzle.com/v1/";
            var config             = new SezzleConfig(String.Empty, String.Empty, true);

            Assert.AreEqual(expectedSandboxUrl, config.ApiUrl);
        }
Ejemplo n.º 2
0
        public void NotSettingSandboxModeShouldUseProductionUrl()
        {
            var expectedProductionUrl = "https://gateway.sezzle.com/v1/";
            var config = new SezzleConfig(String.Empty, String.Empty, false);

            Assert.AreEqual(expectedProductionUrl, config.ApiUrl);
        }
Ejemplo n.º 3
0
        public async Task Setup()
        {
            var appSettings = ConfigurationManager.AppSettings;

            var publicKey  = appSettings["SezzleApiPublicKey"];
            var privateKey = appSettings["SezzleApiPrivateKey"];

            SezzleConfig = new SezzleConfig(publicKey, privateKey, true);
            var auth = new Auth(SezzleConfig);

            AuthResponse = await auth.RequestToken();
        }
Ejemplo n.º 4
0
        public async Task CanGetTokenWithPublicAndPrivateKeys()
        {
            var appSettings = ConfigurationManager.AppSettings;

            var publicKey  = appSettings["SezzleApiPublicKey"];
            var privateKey = appSettings["SezzleApiPrivateKey"];

            var config       = new SezzleConfig(publicKey, privateKey, true);
            var auth         = new Auth(config);
            var authResponse = await auth.RequestToken();

            Assert.IsNotNull(authResponse);
            Assert.IsNotEmpty(authResponse.Token);

            Console.WriteLine(authResponse.Token);
            Console.WriteLine(authResponse.ExpirationDate);
        }
Ejemplo n.º 5
0
        protected SezzleApi(string endpoint, SezzleConfig sezzleConfig, AuthResponse authResponse)
        {
            SezzleConfig = sezzleConfig;
            AuthResponse = authResponse;

            var handler = new HttpClientHandler();

            if (handler.SupportsAutomaticDecompression)
            {
                handler.AutomaticDecompression = DecompressionMethods.GZip |
                                                 DecompressionMethods.Deflate;
            }

            Client = new HttpClient(handler)
            {
                BaseAddress = new Uri(new Uri(SezzleConfig.ApiUrl), endpoint)
            };
        }
Ejemplo n.º 6
0
 public Configuration(string endpoint, SezzleConfig sezzleConfig, AuthResponse authResponse) : base(endpoint, sezzleConfig, authResponse)
 {
 }
Ejemplo n.º 7
0
 public Configuration(SezzleConfig config, AuthResponse auth) : base("configuration/", config, auth)
 {
 }
Ejemplo n.º 8
0
 public Configuration(SezzleConfig config) : this(config, null)
 {
 }
Ejemplo n.º 9
0
 internal SezzleApi(string endpoint, SezzleConfig sezzleConfig) : this(endpoint, sezzleConfig, null)
 {
 }
Ejemplo n.º 10
0
 public Checkouts(string endpoint, SezzleConfig sezzleConfig, AuthResponse authResponse) : base(endpoint, sezzleConfig, authResponse)
 {
 }
Ejemplo n.º 11
0
 public Checkouts(SezzleConfig config, AuthResponse auth) : base("checkouts/", config, auth)
 {
 }
Ejemplo n.º 12
0
 public Checkouts(SezzleConfig config) : this(config, null)
 {
 }
Ejemplo n.º 13
0
 public Orders(string endpoint, SezzleConfig sezzleConfig, AuthResponse authResponse) : base(endpoint, sezzleConfig, authResponse)
 {
 }
Ejemplo n.º 14
0
 public Orders(SezzleConfig config, AuthResponse auth) : base("orders/", config, auth)
 {
 }
Ejemplo n.º 15
0
 public Orders(SezzleConfig config) : this(config, null)
 {
 }