コード例 #1
0
ファイル: KondutoTest.cs プロジェクト: wmaschette/dotnet-sdk
        public void PostNonCreditIntegrationTest()
        {
            Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE");

            KondutoCustomer Customer = new KondutoCustomer
            {
                Id    = "28372",
                Name  = "KdtUser",
                Email = "*****@*****.**"
            };

            KondutoOrder order = new KondutoOrder
            {
                Id          = ((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString(),
                Visitor     = "38a9412f0b01b4dd1762ae424169a3e490d75c7a",
                TotalAmount = 100.00,
                Customer    = Customer,
                Payments    = KondutoPaymentFactory.CreateNonCreditPayments(),
                Analyze     = true
            };

            try
            {
                konduto.Analyze(order);
                Assert.IsTrue(order.Recommendation != KondutoRecommendation.none);
            }
            catch (KondutoException ex)
            {
                Assert.Fail("Konduto exception shouldn't happen here.");
            }
        }
コード例 #2
0
        public void CreditSerializeTest()
        {
            String expectedJSON = KondutoUtils.GetFirstJArrayElement(Properties.Resources.payments);
            String actualJSON   = null;
            KondutoCreditCardPayment payment = KondutoPaymentFactory.CreateCreditCardPayment();

            try
            {
                actualJSON = payment.ToJson();
            }
            catch (KondutoInvalidEntityException e)
            {
                Assert.Fail("address should be valid");
            }

            Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed");

            KondutoCreditCardPayment paymentFromJSON = KondutoModel.FromJson <KondutoCreditCardPayment>(expectedJSON);

            Assert.AreEqual(payment, paymentFromJSON, "address deserialization failed");
        }
コード例 #3
0
        public void TransferSerializeTest()
        {
            JArray a                       = JArray.Parse(Properties.Resources.payments);
            String expectedJSON            = a[3].ToString();
            String actualJSON              = null;
            KondutoTransferPayment payment = KondutoPaymentFactory.CreateTransferPayment();

            try
            {
                actualJSON = payment.ToJson();
            }
            catch (KondutoInvalidEntityException e)
            {
                Assert.Fail("payment should be valid");
            }

            Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed");

            KondutoTransferPayment paymentFromJSON = KondutoModel.FromJson <KondutoTransferPayment>(expectedJSON);

            Assert.AreEqual(payment, paymentFromJSON, "payment deserialization failed");
        }