Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public void Order_CreateDirectiDEAL_SetsRequiredProperties()
        {
            // Act
            var order = OrderRequest.CreateDirectIdeal("3151", "orderid", "description", 1000, "EUR",
                                                       new PaymentOptions("notificationUrl", "successRedirectUrl", "cancelRedirectUrl"));

            // Assert
            Assert.IsNotNull(order.Type);
            Assert.IsNotNull(order.OrderId);
            Assert.IsNotNull(order.GatewayId);
            Assert.IsNotNull(order.Description);
            Assert.IsNotNull(order.CurrencyCode);
            Assert.IsNotNull(order.AmountInCents);
            Assert.IsNotNull(order.GatewayInfo);
            Assert.IsNotNull(order.GatewayInfo.IssuerId);
            Assert.IsNotNull(order.PaymentOptions);
            Assert.IsNotNull(order.PaymentOptions.NotificationUrl);
            Assert.IsNotNull(order.PaymentOptions.SuccessRedirectUrl);
            Assert.IsNotNull(order.PaymentOptions.CancelRedirectUrl);

            Assert.AreEqual(OrderType.Direct, order.Type);
            Assert.AreEqual("orderid", order.OrderId);
            Assert.AreEqual("iDEAL", order.GatewayId);
            Assert.AreEqual("description", order.Description);
            Assert.AreEqual(1000, order.AmountInCents);
            Assert.AreEqual("EUR", order.CurrencyCode);
            Assert.AreEqual("3151", order.GatewayInfo.IssuerId);
            Assert.AreEqual("notificationUrl", order.PaymentOptions.NotificationUrl);
            Assert.AreEqual("successRedirectUrl", order.PaymentOptions.SuccessRedirectUrl);
            Assert.AreEqual("cancelRedirectUrl", order.PaymentOptions.CancelRedirectUrl);
        }
Exemplo n.º 3
0
        public void Orders_CreateDirectOrder_IDEAL()
        {
            // Arrange
            var url          = Settings.MultiSafePayUrl;
            var apiKey       = Settings.ApiKey;
            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"));

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

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(orderRequest.OrderId, result.OrderId);
            Assert.IsFalse(String.IsNullOrEmpty(result.PaymentUrl));
        }
Exemplo n.º 4
0
        public void Orders_CreateOrder_TemporaryVariables()
        {
            // Arrange
            var url     = Settings.MultiSafePayUrl;
            var apiKey  = Settings.ApiKey;
            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);
        }