Ejemplo n.º 1
0
        public static Payment CreateFuturePayment()
        {
            FuturePayment pay = new FuturePayment();

            pay.intent = "sale";
            CreditCard card = CreditCardTest.GetCreditCard();
            List <FundingInstrument> fundingInstruments = new List <FundingInstrument>();
            FundingInstrument        fundingInstrument  = new FundingInstrument();

            fundingInstrument.credit_card = card;
            fundingInstruments.Add(fundingInstrument);
            Payer payer = new Payer();

            payer.payment_method      = "credit_card";
            payer.funding_instruments = fundingInstruments;
            List <Transaction> transactionList = new List <Transaction>();
            Transaction        trans           = new Transaction();

            trans.amount = AmountTest.GetAmount();
            transactionList.Add(trans);
            pay.transactions = transactionList;
            pay.payer        = payer;
            Payment paymnt = pay.Create(UnitTestUtil.GetApiContext());

            return(paymnt);
        }
Ejemplo n.º 2
0
        public static Transactions GetTransactions()
        {
            Transactions transaction = new Transactions();

            transaction.amount = AmountTest.GetAmount();
            return(transaction);
        }
Ejemplo n.º 3
0
        public static Order GetOrder()
        {
            var order = new Order();

            order.amount = AmountTest.GetAmount();
            return(order);
        }
Ejemplo n.º 4
0
        public static Authorization GetAuthorization()
        {
            Authorization authorize = new Authorization();

            authorize.amount         = AmountTest.GetAmount();
            authorize.create_time    = "2013-01-15T15:10:05.123Z";
            authorize.id             = "007";
            authorize.parent_payment = "1000";
            authorize.state          = "Authorized";
            authorize.links          = LinksTest.GetLinksList();
            return(authorize);
        }
Ejemplo n.º 5
0
        public static Sale GetSale()
        {
            var sale = new Sale();

            sale.amount         = AmountTest.GetAmount();
            sale.id             = "102";
            sale.parent_payment = "103";
            sale.state          = "Approved";
            sale.create_time    = "2013-01-17T18:12:02.347Z";
            sale.links          = LinksTest.GetLinksList();
            return(sale);
        }
Ejemplo n.º 6
0
        public static Capture GetCapture()
        {
            Capture cap = new Capture();

            cap.amount         = AmountTest.GetAmount();
            cap.create_time    = "2013-01-15T15:10:05.123Z";
            cap.state          = "Authorized";
            cap.parent_payment = "1000";
            cap.links          = LinksTest.GetLinksList();
            cap.id             = "001";
            return(cap);
        }
Ejemplo n.º 7
0
        public static Transaction GetTransaction()
        {
            var transaction = new Transaction();

            transaction.description       = "Test Description";
            transaction.note_to_payee     = "Test note to payee";
            transaction.amount            = AmountTest.GetAmount();
            transaction.payee             = PayeeTest.GetPayee();
            transaction.item_list         = ItemListTest.GetItemList();
            transaction.related_resources = new List <RelatedResources>();
            transaction.related_resources.Add(RelatedResourcesTest.GetRelatedResources());
            return(transaction);
        }
Ejemplo n.º 8
0
        public static Refund GetRefund()
        {
            var refund = new Refund();

            refund.capture_id     = "101";
            refund.id             = "102";
            refund.parent_payment = "103";
            refund.sale_id        = "104";
            refund.state          = "Approved";
            refund.amount         = AmountTest.GetAmount();
            refund.create_time    = "2013-01-17T18:12:02.347Z";
            refund.links          = LinksTest.GetLinksList();
            return(refund);
        }
Ejemplo n.º 9
0
        public void AuthorizationObjectTest()
        {
            var authorization  = GetAuthorization();
            var expectedAmount = AmountTest.GetAmount();
            var actualAmount   = authorization.amount;

            Assert.AreEqual(expectedAmount.currency, actualAmount.currency);
            Assert.AreEqual(expectedAmount.details.fee, actualAmount.details.fee);
            Assert.AreEqual(expectedAmount.details.shipping, actualAmount.details.shipping);
            Assert.AreEqual(expectedAmount.details.subtotal, actualAmount.details.subtotal);
            Assert.AreEqual(expectedAmount.details.tax, actualAmount.details.tax);
            Assert.AreEqual(expectedAmount.total, actualAmount.total);
            Assert.AreEqual(authorization.id, "007");
            Assert.AreEqual(authorization.create_time, "2013-01-15T15:10:05.123Z");
            Assert.AreEqual(authorization.parent_payment, "1000");
            Assert.AreEqual(authorization.state, "Authorized");
        }
Ejemplo n.º 10
0
        public void CaptureObjectTest()
        {
            var cap      = GetCapture();
            var expected = AmountTest.GetAmount();
            var actual   = cap.amount;

            Assert.AreEqual(expected.currency, actual.currency);
            Assert.AreEqual(expected.details.fee, actual.details.fee);
            Assert.AreEqual(expected.details.shipping, actual.details.shipping);
            Assert.AreEqual(expected.details.subtotal, actual.details.subtotal);
            Assert.AreEqual(expected.details.tax, actual.details.tax);
            Assert.AreEqual(expected.total, actual.total);
            Assert.AreEqual(cap.create_time, "2013-01-15T15:10:05.123Z");
            Assert.AreEqual("001", cap.id);
            Assert.AreEqual("1000", cap.parent_payment);
            Assert.AreEqual("Authorized", cap.state);
        }