private void setClient()
        {
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];

            Client = new MultiSafepayClient(apiKey, url);
        }
Beispiel #2
0
        public void Orders_CreateOrder_StoreCustomVariables()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateDirectIdeal("3151", orderId, "product description", 1000, "EUR",
                 new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"));

            orderRequest.Var1 = "custom 1";
            orderRequest.Var2 = "custom 2";
            orderRequest.Var3 = "custom 3";

            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));

            // Act
            OrderResponse retrievedOrder = client.GetOrder(orderId);

            // Assert
            Assert.IsNotNull(retrievedOrder);
            Assert.AreEqual(orderRequest.Var1, retrievedOrder.Var1);
            Assert.AreEqual(orderRequest.Var2, retrievedOrder.Var2);
            Assert.AreEqual(orderRequest.Var3, retrievedOrder.Var3);
        }
Beispiel #3
0
        public void Orders_CreateOrder_StoreCustomVariables()
        {
            // Arrange
            var url     = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey  = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client  = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateDirectIdeal("3151", orderId, "product description", 1000, "EUR",
                                                              new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"));

            orderRequest.Var1 = "custom 1";
            orderRequest.Var2 = "custom 2";
            orderRequest.Var3 = "custom 3";

            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));

            // Act
            OrderResponse retrievedOrder = client.GetOrder(orderId);

            // Assert
            Assert.IsNotNull(retrievedOrder);
            Assert.AreEqual(orderRequest.Var1, retrievedOrder.Var1);
            Assert.AreEqual(orderRequest.Var2, retrievedOrder.Var2);
            Assert.AreEqual(orderRequest.Var3, retrievedOrder.Var3);
        }
Beispiel #4
0
        public void Orders_CreateOrder()
        {
            // Arrange
            var url     = Settings.MultiSafePayUrl;
            var apiKey  = Settings.ApiKey;
            var client  = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateRedirect(orderId, "product description", 1000, "EUR",
                                                           new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"));

            orderRequest.Customer = new Customer()
            {
                FirstName = "John",
                LastName  = "Doe",
                Address1  = "Kraanspoor 39",
                City      = "Amsterdam",
                Country   = "Netherlands",
                PostCode  = "1033SC"
            };

            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #5
0
        private void setClient()
        {
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;

            Client = new MultiSafepayClient(apiKey, url);
        }
        public void Orders_CreateFastCheckout_ShippingMethodPickup()
        {
            var url     = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey  = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client  = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateFastCheckoutOrder(orderId, "product description", 1000, "EUR",
                                                                    new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                                                                    new ShoppingCart
            {
                Items = new[]
                {
                    new ShoppingCartItem("Test Product", 10, 2, "EUR"),
                    new ShoppingCartItem("Test Product 2", 10, 2, "EUR")
                }
            },
                                                                    new CheckoutOptions()
            {
                ShippingMethods = new ShippingMethods()
                {
                    Pickup = new ShippingMethod("Pickup Shipping", 1000, "EUR")
                }
            });
            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #7
0
        public void Orders_CreateOrder()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();
            
            var orderRequest = OrderRequest.CreateRedirect(orderId, "product description", 1000, "EUR",
                new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"));
            
            orderRequest.Customer = new Customer()
            {
                FirstName = "John",
                LastName = "Doe",
                Address1 = "Kraanspoor 39",
                City = "Amsterdam",
                Country = "Netherlands",
                PostCode = "1033SC"
            };

            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #8
0
        public void Orders_CreateFastCheckout_ForeignCurrency()
        {
            var url     = Settings.MultiSafePayUrl;
            var apiKey  = Settings.ApiKey;
            var client  = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateFastCheckoutOrder(orderId, "product description", 1000, "GBP",
                                                                    new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                                                                    new ShoppingCart
            {
                Items = new[]
                {
                    new ShoppingCartItem("Test Product", 10, 2, "GBP"),
                    new ShoppingCartItem("Test Product 2", 10, 2, "GBP")
                }
            },
                                                                    new CheckoutOptions()
            {
                ShippingMethods = new ShippingMethods()
                {
                    FlatRateShippingMethods = new[] { new ShippingMethod("Shipping", 1000, "GBP") }
                }
            });
            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #9
0
        public void Orders_CreateFastCheckout_NoShippingMethod()
        {
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateFastCheckoutOrder(orderId, "product description", 1000, "EUR",
                new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                new ShoppingCart
                {
                    Items = new[]
                    {
                        new ShoppingCartItem("Test Product", 10, 2, "EUR"),
                        new ShoppingCartItem("Test Product 2", 10, 2, "EUR")
                    }
                },
                new CheckoutOptions()
                {
                    NoShippingMethod = true
                }
                );
            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #10
0
        public void Orders_PayAfterDeliveryOrderRedirect()
        {
            // Arrange
            var url     = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey  = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client  = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateRedirectPayAfterDeliveryOrder(orderId, "product description", 24200, "EUR",
                                                                                new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                                                                                GatewayInfo.PayAfterDelivery(new DateTime(1986, 08, 31), "NL39 RABO 0300 0652 64", "+31 (0)20 8500 500", "*****@*****.**", "referrer", "useragent"),
                                                                                new ShoppingCart
            {
                Items = new[]
                {
                    new ShoppingCartItem("Test Product", 200.0, 1, "EUR")
                }
            },
                                                                                new CheckoutOptions()
            {
                TaxTables = new TaxTables()
                {
                    DefaultTaxTable = new TaxTable()
                    {
                        Name  = "Default",
                        Rules = new[] { new TaxRateRule()
                                        {
                                            Rate = 0.21
                                        } },
                        ShippingTaxed = false
                    }
                }
            },
                                                                                new Customer()
            {
                FirstName   = "John",
                LastName    = "Doe",
                HouseNumber = "39",
                Address1    = "Kraanspoor",
                City        = "Amsterdam",
                Country     = "NL",
                PostCode    = "1033SC"
            }
                                                                                );

            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #11
0
        public void Issuers_GetIssuers()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateways = client.GetIssuers("iDEAL");

            // Assert
            Assert.IsNotNull(gateways);
        }
Beispiel #12
0
        public void Gateways_GetGateways_Locale()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateways = client.GetGateways("NL");

            // Assert
            Assert.IsNotNull(gateways);
        }
Beispiel #13
0
        public void Gateways_GetGateways_RestrictAmount()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateways = client.GetGateways(null, null, 50000);

            // Assert
            Assert.IsNotNull(gateways);
        }
Beispiel #14
0
        public void Gateways_GetGateways_RestrictAmount()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateways = client.GetGateways(null, null, 50000);

            // Assert
            Assert.IsNotNull(gateways);
        }
Beispiel #15
0
        public void Order_SetOrderInvoiceId()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.SetOrderInvoiceNumber("4f5b7db0-189a-4767-9a80-2c2fac455743", "testinvoiceid47843979438276493287");

            // Assert
            Assert.IsTrue(result.Success);
        }
Beispiel #16
0
        public void Orders_PayAfterDeliveryOrder_SetShippingStatus()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.UpdateOrderShippedStatus("22b29891-f2fa-493a-bacc-c78f0e090ddb", "tracktracecode", "carrier", DateTime.Now, "memo");

            // Assert
            Assert.IsTrue(result.Success);
        }
Beispiel #17
0
        public void Gateways_GetGateway()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateway = client.GetGateway("visa");

            // Assert
            Assert.AreEqual("VISA", gateway.Id);
        }
Beispiel #18
0
        public void Order_SetOrderInvoiceId()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.SetOrderInvoiceNumber("4f5b7db0-189a-4767-9a80-2c2fac455743", "testinvoiceid47843979438276493287");

            // Assert
            Assert.IsTrue(result.Success);
        }
Beispiel #19
0
        public void Orders_EinvoiceOrder_SetShippingStatus()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.UpdateOrderShippedStatus("fab3ae66-9502-47c3-ba50-a8328e976554", "tracktracecode", "carrier", DateTime.Now, "memo");

            // Assert
            Assert.IsTrue(result.Success);
        }
Beispiel #20
0
        public void Order_SetOrderInvoiceId()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.SetOrderInvoiceNumber("4f5b7db0-189a-4767-9a80-2c2fac455743", "testinvoiceid47843979438276493287");

            // Assert
            Assert.IsTrue(result.Success);
        }
        public void Issuers_GetIssuers()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateways = client.GetIssuers("iDEAL");

            // Assert
            Assert.IsNotNull(gateways);
        }
Beispiel #22
0
        public void Gateways_GetGateway()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateway = client.GetGateway("visa");

            // Assert
            Assert.AreEqual("VISA", gateway.Id);
        }
Beispiel #23
0
        public void Issuers_GetIssuers()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateways = client.GetIssuers("iDEAL");

            // Assert
            Assert.IsNotNull(gateways);
        }
Beispiel #24
0
        public void Gateways_GetGateway()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateway = client.GetGateway("visa");

            // Assert
            Assert.AreEqual("VISA", gateway.Id);
        }
Beispiel #25
0
        public void Gateways_GetGateways_RestrictAmount()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateways = client.GetGateways(null, null, 50000);

            // Assert
            Assert.IsNotNull(gateways);
        }
        public void Orders_PayAfterDeliveryOrder_SetShippingStatus()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.UpdateOrderShippedStatus("22b29891-f2fa-493a-bacc-c78f0e090ddb", "tracktracecode", "carrier", DateTime.Now, "memo");

            // Assert
            Assert.IsTrue(result.Success);
        }
Beispiel #27
0
        public void Orders_CreatePayAfterDeliveryOrder()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateDirectPayAfterDeliveryOrder(orderId, "product description", 24200, "EUR",
                new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                GatewayInfo.PayAfterDelivery(new DateTime(1986, 08, 31), "NL39 RABO 0300 0652 64", "+31 (0)20 8500 500", "*****@*****.**", "referrer", "useragent"),
                new ShoppingCart
                {
                    Items = new[]
                    {
                        new ShoppingCartItem("Test Product", 200.0, 1, "EUR")
                    }
                },
                new CheckoutOptions()
                {
                    TaxTables = new TaxTables()
                    {
                        DefaultTaxTable = new TaxTable()
                        {
                            Name = "Default",
                            Rules = new [] { new TaxRateRule() { Rate = 0.21 }},
                            ShippingTaxed = false
                        }
                    }
                },
                new Customer()
                    {
                        FirstName = "John",
                        LastName = "Doe",
                        HouseNumber = "39",
                        Address1 = "Kraanspoor",
                        City = "Amsterdam",
                        Country = "NL",
                        PostCode = "1033SC"
                    }
                );

            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsTrue(result.PaymentUrl.StartsWith("http://example.com/success?transactionid=")); // redirect to success URL

        }
Beispiel #28
0
        public void Transactions_CreateARefund()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.CreateRefund("546dd9aeb49aa", 100, "EUR", "This is a refund");

            // Assert
            Assert.IsNotNull(result);
            Assert.IsFalse(String.IsNullOrEmpty(result.TransactionId));
        }
        public void Orders_CreateFastCheckoutOrder()
        {
            // Arrange
            var url     = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey  = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client  = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateFastCheckoutOrder(orderId, "product description", 1000, "EUR",
                                                                    new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                                                                    new ShoppingCart
            {
                Items = new[]
                {
                    new ShoppingCartItem("Test Product", 10, 2, "EUR"),
                    new ShoppingCartItem("Test Product 2", 10, 1, "EUR")
                }
            },
                                                                    new CheckoutOptions()
            {
                NoShippingMethod = false,
                ShippingMethods  = new ShippingMethods()
                {
                    FlatRateShippingMethods = new List <ShippingMethod>
                    {
                        new ShippingMethod("test", 1.0, "EUR"),
                        new ShippingMethod("test2", 3.0, "EUR"),
                    }
                },
                TaxTables = new TaxTables()
                {
                    DefaultTaxTable = new TaxTable()
                    {
                        Name  = "Default",
                        Rules = new [] { new TaxRateRule()
                                         {
                                             Rate = 0.21
                                         } },
                        ShippingTaxed = true
                    }
                }
            });
            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #30
0
        public void Transactions_CreateARefund()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.CreateRefund("546dd9aeb49aa", 100, "EUR", "This is a refund");

            // Assert
            Assert.IsNotNull(result);
            Assert.IsFalse(String.IsNullOrEmpty(result.TransactionId));
        }
        public void Orders_RetriveOrder_OrderNotFound()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string orderId = "order id that doesn't exist";
            var          result  = client.GetOrder(orderId);

            // Assert
            Assert.IsNull(result);
        }
Beispiel #32
0
        public void Orders_RetriveOrder_OrderNotFound()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string orderId = "order id that doesn't exist";
            var          result  = client.GetOrder(orderId);

            // Assert
            Assert.IsNull(result);
        }
Beispiel #33
0
        public void Transactions_CreateARefund()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.CreateRefund("546dd9aeb49aa", 100, "EUR", "This is a refund");

            // Assert
            Assert.IsNotNull(result);
            Assert.IsFalse(String.IsNullOrEmpty(result.TransactionId));
        }
Beispiel #34
0
        public void Transactions_CaptureOrder()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.CaptureOrder("62756f57-f24d-403e-b6ed-3c53961dc801", 500, null, "Order Shipped");

            // Assert
            Assert.IsNotNull(result);
            Assert.IsNotNull(result.TransactionId);
        }
Beispiel #35
0
        public void Transactions_VoidOrder()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var result = client.VoidOrder("62756f57-f24d-403e-b6ed-3c53961dc801", "Order Canceled");

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Success);
        }
Beispiel #36
0
        public void Orders_RetriveOrder_OrderNotFound()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string orderId = "order id that doesn't exist";
            var result = client.GetOrder(orderId);

            // Assert
            Assert.IsNull(result);
        }
        public void Orders_RetrieveOrder()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string orderId = "298f61a3-7104-4d22-a129-de9293091ee5";
            var          result  = client.GetOrder(orderId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderId, result.OrderId);
        }
Beispiel #38
0
        public void Transactions_RetrieveTransaction()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string transactionId = "2242232";
            var          result        = client.GetTransaction(transactionId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(transactionId, result.TransactionId);
        }
        public void Orders_RetrieveOrder()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string orderId = "298f61a3-7104-4d22-a129-de9293091ee5";
            var          result  = client.GetOrder(orderId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderId, result.OrderId);
        }
Beispiel #40
0
        public void Orders_RetrieveOrder()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string orderId = "2669a4d2-064e-4bb6-bc38-684d108783f0";
            var result = client.GetOrder(orderId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderId, result.OrderId);
        }
Beispiel #41
0
        public void Orders_RetrieveOrder()
        {
            // Arrange
            var url    = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string orderId = "2669a4d2-064e-4bb6-bc38-684d108783f0";
            var          result  = client.GetOrder(orderId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderId, result.OrderId);
        }
Beispiel #42
0
        public void Transactions_RetrieveTransaction()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string transactionId = "2242232";
            var result = client.GetTransaction(transactionId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(transactionId, result.TransactionId);
        }
        public void Orders_RetrieveOrderWithShoppingCart()
        {
            // Arrange
            var url    = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            const string orderId = "a2b9a099-67b0-4a99-938c-1fb430ab1a33";
            var          result  = client.GetOrder(orderId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderId, result.OrderId);
            Assert.IsNotNull(result.ShoppingCart.Items[0]);
        }
Beispiel #44
0
        public void Orders_CreateFastCheckoutOrder()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateFastCheckoutOrder(orderId, "product description", 1000, "EUR",
                new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                new ShoppingCart
                {
                    Items = new[]
                    {
                        new ShoppingCartItem("Test Product", 10, 2, "EUR"),
                        new ShoppingCartItem("Test Product 2", 10, 1, "EUR")
                    }
                },
                new CheckoutOptions()
                {
                    NoShippingMethod = false,
                    ShippingMethods = new ShippingMethods()
                    {
                        FlatRateShippingMethods = new List<ShippingMethod>
                        {
                            new ShippingMethod("test", 1.0, "EUR"),
                            new ShippingMethod("test2", 3.0, "EUR"),
                        }
                    },
                    TaxTables = new TaxTables()
                    {
                        DefaultTaxTable = new TaxTable()
                        {
                            Name = "Default",
                            Rules = new [] { new TaxRateRule() { Rate = 0.21 }},
                            ShippingTaxed = true
                        }
                    }
                });
            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #45
0
        public void Orders_CreateDirectOrder_BankTransfer()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();
            var orderRequest = OrderRequest.CreateDirectBankTransfer(orderId, "product description", 1000, "EUR",
                new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"));

            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsTrue(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #46
0
        public void Orders_CreateFastCheckoutOrder_SetCustomerData()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateFastCheckoutOrder(orderId, "product description", 1000, "EUR",
                new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                new ShoppingCart
                {
                    Items = new[]
                    {
                        new ShoppingCartItem("Test Product", 10, 2, "EUR"),
                        new ShoppingCartItem("Test Product 2", 10, 2, "EUR")
                    }
                },
                new CheckoutOptions()
                {
                    NoShippingMethod = true
                });

            orderRequest.Customer = new Customer()
            {
                Email = "*****@*****.**",
                Country = "Netherlands",
                FirstName = "John",
                LastName = "Doe",
                HouseNumber = "39B",
                City = "Amsterdam",
                PostCode = "1234",
                Address1 = "Kraanspoor"
            };

            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Beispiel #47
0
        public void Orders_CreateKlarnaOrder()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateDirectKlarnaOrder(orderId, "product description", 1210, "EUR",
                new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                GatewayInfo.Klarna(new DateTime(1970, 12, 12), "male", "+31 (0)20 8500 500", "*****@*****.**"),
                new ShoppingCart
                {
                    Items = new[]
                    {
                        new ShoppingCartItem("10001", "Test Product", 10.0, 1, "EUR")
                    }
                },
                new CheckoutOptions()
                {
                    TaxTables = new TaxTables()
                    {
                        DefaultTaxTable = new TaxTable()
                        {
                            Name = "Default",
                            Rules = new[] { new TaxRateRule() { Rate = 0.21 } },
                            ShippingTaxed = false
                        }
                    }
                },
                new Customer()
                    {
                        FirstName = "Testperson-nl",
                        LastName = "Approved",
                        HouseNumber = "1/XI",
                        Address1 = "Neherkade",
                        City = "Gravenhage",
                        Country = "NL",
                        PostCode = "2521VA",
                    },
               new DeliveryAddress()
                    {
                        FirstName = "Testperson-nl",
                        LastName = "Approved",
                        HouseNumber = "1/XI",
                        Address1 = "Neherkade",
                        City = "Gravenhage",
                        Country = "NL",
                        PostCode = "2521VA",
                    }
                );

            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsTrue(result.PaymentUrl.StartsWith("http://example.com/success?transactionid=")); // redirect to success URL

        }
Beispiel #48
0
        public void Orders_CreateFastCheckoutOrder_PredefinedCustomFields()
        {
            // Arrange
            var url = ConfigurationManager.AppSettings["MultiSafepayAPI"];
            var apiKey = ConfigurationManager.AppSettings["MultiSafepayAPIKey"];
            var client = new MultiSafepayClient(apiKey, url);
            var orderId = Guid.NewGuid().ToString();

            var orderRequest = OrderRequest.CreateFastCheckoutOrder(orderId, "product description", 1000, "EUR",
                new PaymentOptions("http://example.com/notify", "http://example.com/success", "http://example.com/failed"),
                new ShoppingCart
                {
                    Items = new[]
                    {
                        new ShoppingCartItem("Test Product", 10, 2, "EUR"),
                        new ShoppingCartItem("Test Product 2", 10, 2, "EUR")
                    }
                },
                new CheckoutOptions()
                {
                    NoShippingMethod = true
                });
            orderRequest.CustomFields = new []
            {
                new CustomField("acceptagreements", StandardCustomField.acceptagreements), 
                new CustomField("birthday", StandardCustomField.birthday),
                new CustomField("chamberofcommerce", StandardCustomField.chamberofcommerce),
                new CustomField("comment", StandardCustomField.comment),
                new CustomField("companyname", StandardCustomField.companyname),
                new CustomField("driverslicense", StandardCustomField.driverslicense),
                new CustomField("mobilephonenumber", StandardCustomField.mobilephonenumber),
                new CustomField("newsletter", StandardCustomField.newsletter),
                new CustomField("passportnumber", StandardCustomField.passportnumber),
                new CustomField("phonenumber", StandardCustomField.phonenumber),
                new CustomField("salutation", StandardCustomField.salutation),
                new CustomField("sex", StandardCustomField.sex),
                new CustomField("vatnumber", StandardCustomField.vatnumber)
            };
            // Act
            var result = client.CreateOrder(orderRequest);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }