Inheritance: Recurly.RecurlyEntity
コード例 #1
0
        public void CreateTransactionNewAccount()
        {
            String a = Factories.GetMockAccountName();
            Account acct = new Account(a, "New Txn", "User",
                "4111111111111111", DateTime.Now.Month, DateTime.Now.Year + 1);

            Transaction t = new Transaction(acct, 5000, "USD");

            t.Create();

            Assert.IsNotNull(t.CreatedAt);
        }
コード例 #2
0
        public void RefundTransactionFull()
        {
            String a = Factories.GetMockAccountName();
            Account acct = new Account(a, "New Txn", "User",
                "4111111111111111", DateTime.Now.Month, DateTime.Now.Year + 1);

            Transaction t = new Transaction(acct, 5000, "USD");

            t.Create();

            t.Refund();

            Assert.AreEqual(t.Status, Transaction.TransactionState.voided);
        }
コード例 #3
0
        public void LookupTransaction()
        {
            String a = Factories.GetMockAccountName();
            Account acct = new Account(a, "New Txn", "User",
                "4111111111111111", DateTime.Now.Month, DateTime.Now.Year + 1);

            Transaction t = new Transaction(acct, 5000, "USD");

            t.Create();

            Transaction t2 = Transaction.Get(t.Uuid);

            Assert.AreEqual(t, t2);
        }
コード例 #4
0
        public void CreateTransactionExistingAccountNewBillingInfo()
        {
            String a = Factories.GetMockAccountName();
            Account acct = new Account(a, "Change Billing Info", "User",
                "4111111111111111", DateTime.Now.Month, DateTime.Now.Year + 1);
            acct.Create();

            acct.BillingInfo = Factories.NewBillingInfo(acct);

            Transaction t = new Transaction(acct, 5000, "USD");

            t.Create();

            Assert.IsNotNull(t.CreatedAt);
        }
コード例 #5
0
        public void ListAllTransactions()
        {
            for (int x = 0; x < 5; x++)
            {
                String a = Factories.GetMockAccountName();
                Account acct = new Account(a, "New Txn", "User",
                    "4111111111111111", DateTime.Now.Month, DateTime.Now.Year + 1);
                acct.Create();

                Transaction t = new Transaction(acct.AccountCode, 3000 + x, "USD");

                t.Create();

            }

            TransactionList list = TransactionList.GetTransactions();

            Assert.IsTrue(list.Count > 0);
        }
コード例 #6
0
        public void LookupCouponInvoice()
        {
            string s = Factories.GetMockCouponCode();
            Dictionary<string, int> discounts = new Dictionary<string,int>();
            discounts.Add("USD",1000);
            Coupon c = new Coupon(s, Factories.GetMockCouponName(), discounts);
            c.Create();

            string act = Factories.GetMockAccountName();
            Account acct = new Account(s, "John", "Doe", "4111111111111111", DateTime.Now.Month, DateTime.Now.Year + 2);
            acct.Create();

            CouponRedemption cr = acct.RedeemCoupon(s, "USD");

            Transaction t = new Transaction(acct, 5000, "USD");
            t.Create();

            CouponRedemption cr2 = Invoice.Get(t.Invoice.Value).GetCoupon();

            Assert.AreEqual(cr, cr2);
        }
コード例 #7
0
        public void ListTransactionsForAccount()
        {
            String a = Factories.GetMockAccountName();
            Account acct = new Account(a, "New Txn", "User",
                "4111111111111111", DateTime.Now.Month, DateTime.Now.Year + 1);
            acct.Create();

            Transaction t = new Transaction(acct.AccountCode, 3000, "USD");
            t.Create();

            Transaction t2 = new Transaction(acct.AccountCode, 200, "USD");
            t2.Create();

            TransactionList list = acct.GetTransactions();
            Assert.IsTrue(list.Count > 0);
        }
コード例 #8
0
        public static Transaction Get(string transactionId)
        {
            var transaction = new Transaction();

            var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Get,
                Transaction.UrlPrefix + Uri.EscapeUriString(transactionId),
                transaction.ReadXml);

            return statusCode == HttpStatusCode.NotFound ? null : transaction;
        }
コード例 #9
0
 public bool Equals(Transaction transaction)
 {
     return Uuid == transaction.Uuid;
 }
コード例 #10
0
        public void RefundTransactionPartial()
        {
            String a = Factories.GetMockAccountName();
            Account acct = new Account(a, "New Txn", "User",
                "4111111111111111", DateTime.Now.Month, DateTime.Now.Year + 1);

            Transaction t = new Transaction(acct, 5000, "USD");

            t.Create();

            t.Refund(2500);

            Assert.Fail("Need to check for a new refund transaction.");
        }
コード例 #11
0
        public static Transaction Get(string transactionId)
        {
            Transaction transaction = new Transaction();

            HttpStatusCode statusCode = Client.PerformRequest(Client.HttpRequestMethod.Get,
                UrlPrefix + System.Uri.EscapeUriString(transactionId),
                new Client.ReadXmlDelegate(transaction.ReadXml));

            if (statusCode == HttpStatusCode.NotFound)
                return null;

            return transaction;
        }