コード例 #1
0
 public void TesTransferList()
 {
     OpenpayAPI openpayAPI = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
     SearchParams filters = new SearchParams();
     filters.CreationLte = new DateTime(2014, 1, 8);
     filters.Amount = 10.0m;
     List<Transfer> transfers =  openpayAPI.TransferService.List(customer_id, filters);
     Assert.AreEqual(2, transfers.Count);
 }
コード例 #2
0
 public void TesFeeList()
 {
     OpenpayAPI openpayAPI = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
     SearchParams filters = new SearchParams();
     filters.CreationLte = new DateTime(2014, 1, 8);
     filters.Amount = 6.0m;
     List<Fee> transfers = openpayAPI.FeeService.List(filters);
     Assert.AreEqual(3, transfers.Count);
 }
コード例 #3
0
 public void TestCustomer_List()
 {
     SearchParams search = new SearchParams();
     search.Limit = 3;
     OpenpayAPI openpayAPI = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
     List<Customer> customers = openpayAPI.CustomerService.List(search);
     Assert.IsNotNull(customers);
     Assert.AreEqual(3, customers.Count);
 }
コード例 #4
0
 public void TestMerchantList()
 {
     SearchParams search = new SearchParams();
     search.CreationLte = new DateTime(2014, 1, 7);
     search.Amount = 9.99M;
     OpenpayAPI openpayAPI = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
     List<Charge> charges= openpayAPI.ChargeService.List(search);
     Assert.AreEqual(3, charges.Count);
     foreach (Charge charge in charges)
     {
         Assert.AreEqual(true, charge.Conciliated);
     }
 }
コード例 #5
0
        public void TestChargeToMerchantAndGetByOrderId()
        {
            Random random = new Random();
            ChargeRequest request = new ChargeRequest();
            request.Method = "card";
            request.Card = GetCardInfo();
            request.OrderId = random.Next(0, 10000000).ToString();
            request.Description = "Testing from .Net with new card";
            request.Amount = new Decimal(9.99);

            Customer customer = new Customer();
            customer.Name = "Openpay";
            customer.LastName = "Test";
            customer.PhoneNumber = "1234567890";
            customer.Email = "*****@*****.**";

            request.Customer = customer;

            OpenpayAPI openpayAPI = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
            Charge charge = openpayAPI.ChargeService.Create(request);
            Assert.IsNotNull(charge);

            SearchParams search = new SearchParams();
            search.OrderId = request.OrderId;
            List<Charge> charges = openpayAPI.ChargeService.List(search);
            Assert.AreEqual(1, charges.Count);
            Assert.AreEqual(charge.Id, charges[0].Id);
        }