Beispiel #1
0
        public void Order_CreateRecurring_SetsRequiredProperties()
        {
            // Act
            var order = OrderRequest.CreateRecurring("recurringid", "orderid", "description", 1000, "EUR",
                                                     new PaymentOptions("notificationUrl", "successRedirectUrl", "cancelRedirectUrl"));

            // Assert
            Assert.IsNotNull(order.Type);
            Assert.IsNotNull(order.OrderId);
            Assert.IsNotNull(order.RecurringId);
            Assert.IsNotNull(order.Description);
            Assert.IsNotNull(order.CurrencyCode);
            Assert.IsNotNull(order.AmountInCents);
            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("recurringid", order.RecurringId);
            Assert.AreEqual("description", order.Description);
            Assert.AreEqual(1000, order.AmountInCents);
            Assert.AreEqual("EUR", order.CurrencyCode);
            Assert.AreEqual("notificationUrl", order.PaymentOptions.NotificationUrl);
            Assert.AreEqual("successRedirectUrl", order.PaymentOptions.SuccessRedirectUrl);
            Assert.AreEqual("cancelRedirectUrl", order.PaymentOptions.CancelRedirectUrl);
        }
Beispiel #2
0
        public void Orders_CreateDirectOrder_FromRecurringId()
        {
            // 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.CreateRecurring("9982091243241152", 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));
        }