public void FindTransferTest()
        {
            BankAccount bank = PagarMeTestFixture.CreateTestBankAccount();

            bank.Save();
            Recipient recipient = PagarMeTestFixture.CreateRecipient(bank);

            recipient.Save();

            Transaction transaction = PagarMeTestFixture.CreateBoletoSplitRuleTransaction(recipient);

            transaction.Save();
            transaction.Status = TransactionStatus.Paid;
            transaction.Save();

            Transfer transfer = PagarMeTestFixture.CreateTestTransfer(bank.Id, recipient.Id);

            transfer.Save();

            Transfer transferReturned = PagarMeService.GetDefaultService().Transfers.Find(transfer.Id);

            Assert.IsTrue(transferReturned.Id.Equals(transfer.Id));
            Assert.IsTrue(transferReturned.Amount.Equals(transfer.Amount));
            Assert.IsTrue(transferReturned.DateCreated.Equals(transfer.DateCreated));
            Assert.IsTrue(transferReturned.Fee.Equals(transfer.Fee));
            Assert.IsTrue(transferReturned.Status.Equals(transfer.Status));
            Assert.IsTrue(transferReturned.Type.Equals(transfer.Type));
        }
 public void CreateTestTransferWithDifferentBankAccount()
 {
     Assert.ThrowsException <PagarMeException>(() =>
     {
         BankAccount bank = CreateTestBankAccount();
         bank.Save();
         Recipient recipient = CreateRecipientWithAnotherBankAccount();
         recipient.Save();
         Transfer transfer = PagarMeTestFixture.CreateTestTransfer(bank.Id, recipient.Id);
         transfer.Save();
     });
 }
Esempio n. 3
0
        public void FindAllPayablesTest()
        {
            Transaction transaction = PagarMeTestFixture.CreateTestCardTransactionWithInstallments();

            transaction.Save();


            Payable[] payables = transaction.Payables.FindAll(new Payable()).ToArray();

            foreach (var pay in payables)
            {
                Assert.IsTrue(pay.TransactionId.Equals(int.Parse(transaction.Id)));
            }
        }
Esempio n. 4
0
        public void FindPayableTest()
        {
            Transaction transaction = PagarMeTestFixture.CreateTestBoletoTransaction();

            transaction.Save();
            transaction.Status = TransactionStatus.Paid;
            transaction.Save();

            Payable payable         = transaction.Payables.FindAll(new Payable()).First();
            Payable payableReturned = PagarMeService.GetDefaultService().Payables.Find(payable.Id);

            Assert.IsTrue(payable.Id.Equals(payableReturned.Id));
            Assert.IsTrue(payable.Status.Equals(payableReturned.Status));
            Assert.IsTrue(payable.TransactionId.Equals(payableReturned.TransactionId));
        }
Esempio n. 5
0
        public void TestCreatePlan()
        {
            Plan plan = PagarMeTestFixture.CreateTestPlan();

            plan.Save();
            Assert.IsNotNull(plan.Id);
            Assert.AreEqual(plan.TrialDays, 0);
            Assert.AreEqual(plan.Days, 30);
            Assert.AreEqual(plan.Amount, 1099);
            Assert.AreEqual(plan.Color, "#787878");
            Assert.AreEqual(plan.InvoiceReminder, 3);

            var paymentMethod = new PaymentMethod[] { PaymentMethod.CreditCard };

            CollectionAssert.AreEqual(plan.PaymentMethods, paymentMethod);
        }
        public void CreateTransferTest()
        {
            BankAccount bank = PagarMeTestFixture.CreateTestBankAccount();

            bank.Save();
            Recipient recipient = PagarMeTestFixture.CreateRecipient(bank);

            recipient.Save();

            Transaction transaction = PagarMeTestFixture.CreateBoletoSplitRuleTransaction(recipient);

            transaction.Save();
            transaction.Status = TransactionStatus.Paid;
            transaction.Save();

            Transfer transfer = PagarMeTestFixture.CreateTestTransfer(bank.Id, recipient.Id);

            transfer.Save();
            Assert.IsTrue(transfer.Status == TransferStatus.PendingTransfer);
        }
        public void FindAllTransferTest()
        {
            BankAccount bank = PagarMeTestFixture.CreateTestBankAccount();

            bank.Save();
            Recipient recipient = PagarMeTestFixture.CreateRecipient(bank);

            recipient.Save();

            Transaction transaction = PagarMeTestFixture.CreateBoletoSplitRuleTransaction(recipient);

            transaction.Save();
            transaction.Status = TransactionStatus.Paid;
            transaction.Save();

            Transfer transfer = PagarMeTestFixture.CreateTestTransfer(bank.Id, recipient.Id);

            transfer.Save();

            var transfers = PagarMeService.GetDefaultService().Transfers.FindAll(new Transfer());

            Assert.IsTrue(transfers.Count() >= 1);
        }