コード例 #1
0
        public void ConstructorAndFields()
        {
            BilletDetails obj = new BilletDetails();

            Assert.IsNotNull(obj);
            Assert.IsNull(obj.BankAccount);
            Assert.IsNull(obj.OurNumber);
            Assert.IsNull(obj.BarcodeNumber);
            Assert.IsNull(obj.Portfolio);

            obj.BankAccount   = "1234-0 / 9438905";
            obj.OurNumber     = "000010083241 5";
            obj.BarcodeNumber = "03393744100000176459694818900001008324150102";
            obj.Portfolio     = "CARTEIRA DE COB.";
            Assert.AreEqual("1234-0 / 9438905", obj.BankAccount);
            Assert.AreEqual("000010083241 5", obj.OurNumber);
            Assert.AreEqual("03393744100000176459694818900001008324150102", obj.BarcodeNumber);
            Assert.AreEqual("CARTEIRA DE COB.", obj.Portfolio);
        }
コード例 #2
0
        public void ToStringTest()
        {
            Charge obj = new Charge();

            obj.Description     = "Charge description";
            obj.Reference       = "Reference number";
            obj.Amount          = decimal.MaxValue;
            obj.DueDate         = new DateTime(2018, 2, 17);
            obj.Installments    = int.MaxValue;
            obj.MaxOverdueDays  = int.MaxValue;
            obj.Fine            = decimal.MaxValue;
            obj.Interest        = decimal.MaxValue;
            obj.Discount        = new Discount();
            obj.Payer           = new Payer();
            obj.BillingAddress  = new Address();
            obj.NotifyPayer     = true;
            obj.NotificationUrl = "http://www.notification.br/url";
            obj.ReferralToken   = "ABC123";
            obj.FeeSchemaToken  = "XPTO7890";
            obj.SplitRecipient  = "123.456.789-00";
            obj.PaymentTypes    = new PaymentType[] { PaymentType.BOLETO, PaymentType.CREDIT_CARD };
            obj.CreditCard      = new CreditCard();
            obj.PaymentAdvance  = false;
            obj.CreditCardHash  = "HASH11223344";
            obj.Code            = "11223344";
            obj.Link            = "https://www.boletobancario.com/link";
            obj.PayNumber       = "23700.123456.789123.546543.79810000012345";
            obj.CheckoutUrl     = "https://www.boletobancario.com/checkout";

            BilletDetails billetDetails = new BilletDetails();

            billetDetails.BankAccount   = "1234-0 / 9438905";
            billetDetails.OurNumber     = "000010083241 5";
            billetDetails.BarcodeNumber = "03393744100000176459694818900001008324150102";
            billetDetails.Portfolio     = "CARTEIRA DE COB.";
            obj.BilletDetails           = billetDetails;

            obj.Payments = new Payment[2];
            Payment payment1 = new Payment();

            payment1.Id     = long.MaxValue;
            payment1.Amount = decimal.MaxValue;
            payment1.Date   = new DateTime(2018, 2, 17);
            payment1.Fee    = decimal.MaxValue;
            payment1.Type   = PaymentType.CREDIT_CARD;
            payment1.Status = PaymentStatus.DECLINED;
            obj.Payments[0] = payment1;
            Payment payment2 = new Payment();

            payment2.Id     = long.MaxValue;
            payment2.Amount = decimal.MaxValue;
            payment2.Date   = new DateTime(2018, 2, 17);
            payment2.Fee    = decimal.MaxValue;
            payment2.Type   = PaymentType.BOLETO;
            payment2.Status = PaymentStatus.CONFIRMED;
            obj.Payments[1] = payment2;

            Assert.AreEqual("Description: Charge description" + Environment.NewLine +
                            "Reference: Reference number" + Environment.NewLine +
                            "Amount: 79228162514264337593543950335" + Environment.NewLine +
                            "DueDate: 17/02/2018" + Environment.NewLine +
                            "Installments: 2147483647" + Environment.NewLine +
                            "MaxOverdueDays: 2147483647" + Environment.NewLine +
                            "Fine: 79228162514264337593543950335" + Environment.NewLine +
                            "Interest: 79228162514264337593543950335" + Environment.NewLine +
                            "Discount: Amount: 0" + Environment.NewLine +
                            "Days: 0" + Environment.NewLine + Environment.NewLine +
                            "Payer: Email: " + Environment.NewLine +
                            "SecondaryEmail: " + Environment.NewLine +
                            "Phone: " + Environment.NewLine +
                            "Name: " + Environment.NewLine +
                            "CpfCnpj: " + Environment.NewLine +
                            "BirthDate: " + Environment.NewLine + Environment.NewLine +
                            "BillingAddress: Street: " + Environment.NewLine +
                            "Number: " + Environment.NewLine +
                            "Complement: " + Environment.NewLine +
                            "Neighborhood: " + Environment.NewLine +
                            "City: " + Environment.NewLine +
                            "State: " + Environment.NewLine +
                            "Postcode: " + Environment.NewLine + Environment.NewLine +
                            "NotifyPayer: True" + Environment.NewLine +
                            "NotificationUrl: http://www.notification.br/url" + Environment.NewLine +
                            "ReferralToken: ABC123" + Environment.NewLine +
                            "FeeSchemaToken: XPTO7890" + Environment.NewLine +
                            "SplitRecipient: 123.456.789-00" + Environment.NewLine +
                            "PaymentTypes: [" + Environment.NewLine +
                            "BOLETO," + Environment.NewLine +
                            "CREDIT_CARD] " + Environment.NewLine +
                            "CreditCard: Number: " + Environment.NewLine +
                            "HolderName: " + Environment.NewLine +
                            "SecurityCode: " + Environment.NewLine +
                            "ExpirationMonth: " + Environment.NewLine +
                            "ExpirationYear: " + Environment.NewLine + Environment.NewLine +
                            "PaymentAdvance: False" + Environment.NewLine +
                            "CreditCardHash: HASH11223344" + Environment.NewLine +
                            "Code: 11223344" + Environment.NewLine +
                            "Link: https://www.boletobancario.com/link" + Environment.NewLine +
                            "PayNumber: 23700.123456.789123.546543.79810000012345" + Environment.NewLine +
                            "CheckoutUrl: https://www.boletobancario.com/checkout" + Environment.NewLine +
                            "BilletDetails: BankAccount: 1234-0 / 9438905" + Environment.NewLine +
                            "OurNumber: 000010083241 5" + Environment.NewLine +
                            "BarcodeNumber: 03393744100000176459694818900001008324150102" + Environment.NewLine +
                            "Portfolio: CARTEIRA DE COB." + Environment.NewLine + Environment.NewLine +
                            "Payments: [" + Environment.NewLine +
                            "Id: 9223372036854775807" + Environment.NewLine +
                            "Amount: 79228162514264337593543950335" + Environment.NewLine +
                            "Date: 17/02/2018" + Environment.NewLine +
                            "Fee: 79228162514264337593543950335" + Environment.NewLine +
                            "Type: CREDIT_CARD" + Environment.NewLine +
                            "Status: DECLINED" + Environment.NewLine +
                            "," + Environment.NewLine +
                            "Id: 9223372036854775807" + Environment.NewLine +
                            "Amount: 79228162514264337593543950335" + Environment.NewLine +
                            "Date: 17/02/2018" + Environment.NewLine +
                            "Fee: 79228162514264337593543950335" + Environment.NewLine +
                            "Type: BOLETO" + Environment.NewLine +
                            "Status: CONFIRMED" + Environment.NewLine +
                            "] " + Environment.NewLine, obj.ToString());
        }