コード例 #1
0
ファイル: OrderRequestTests.cs プロジェクト: supercs/.Net
        public void Order_CreateDirectBankTransfer_SetsRequiredProperties()
        {
            // Act
            var order = OrderRequest.CreateDirectBankTransfer("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.PaymentOptions);
            Assert.IsNull(order.GatewayInfo);
            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("BANKTRANS", order.GatewayId);
            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);
        }
コード例 #2
0
ファイル: DirectOrder.cs プロジェクト: hamletrp/AMultiSafepay
        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);
        }