Exemplo n.º 1
0
        public async Task GenerateTokenTestAsync()
        {
            var auth     = new JunoAuthorization(_clientId, _clientSecret);
            var response = await auth.GenerateTokenAsync();

            Assert.NotNull(response);
            Assert.NotNull(response.AccessToken);
            Assert.NotEmpty(response.AccessToken);
        }
Exemplo n.º 2
0
        public async Task GetBalanceTestAsync()
        {
            var auth          = new JunoAuthorization(_clientId, _clientSecret);
            var tokenResponse = await auth.GenerateTokenAsync();

            Assert.NotNull(tokenResponse);
            Assert.NotNull(tokenResponse.AccessToken);
            Assert.NotEmpty(tokenResponse.AccessToken);

            var balance         = new JunoBalance(tokenResponse.AccessToken, _privateToken);
            var balanceResponse = await balance.GetBalanceAsync();

            Assert.NotNull(balanceResponse);
        }
        public async Task CancelBillingBillTestAsync()
        {
            var auth          = new JunoAuthorization(_clientId, _clientSecret);
            var tokenResponse = await auth.GenerateTokenAsync();

            Assert.NotNull(tokenResponse);
            Assert.NotNull(tokenResponse.AccessToken);
            Assert.NotEmpty(tokenResponse.AccessToken);

            var charge         = new JunoCharge(tokenResponse.AccessToken, _privateToken);
            var chargeResponse = await charge.CancelBillingBillAsync("chr_BB8434E0E7905ACCE01834F0EFBC71AA");

            Assert.True(chargeResponse);
        }
        public async Task GetChargesTestAsync()
        {
            var auth          = new JunoAuthorization(_clientId, _clientSecret);
            var tokenResponse = await auth.GenerateTokenAsync();

            Assert.NotNull(tokenResponse);
            Assert.NotNull(tokenResponse.AccessToken);
            Assert.NotEmpty(tokenResponse.AccessToken);

            var charge         = new JunoCharge(tokenResponse.AccessToken, _privateToken);
            var chargeResponse = await charge.GetCharges();

            Assert.NotNull(chargeResponse);
        }
        public async Task GenerateBillingBillTestAsync()
        {
            var auth          = new JunoAuthorization(_clientId, _clientSecret);
            var tokenResponse = await auth.GenerateTokenAsync();

            Assert.NotNull(tokenResponse);
            Assert.NotNull(tokenResponse.AccessToken);
            Assert.NotEmpty(tokenResponse.AccessToken);

            var charge = new JunoCharge(tokenResponse.AccessToken, _privateToken);
            var body   = new ChargeRequest
            {
                Charge = new Charge
                {
                    Description = "Cobrança Test - XUnit",
                    References  = new List <string> {
                        "Uma simples referencia para teste 2 - XUnit"
                    },
                    Amount         = 22.45,
                    Fine           = 3,
                    Interest       = "2.4",
                    DueDate        = DateTime.Now.AddDays(10).ToString("yyyy-MM-dd"),
                    MaxOverdueDays = 3,
                    PaymentAdvance = true
                },
                Billing = new Billing
                {
                    Name     = "Joao da Silva Sauro",
                    Document = "82738475589",
                    Email    = "*****@*****.**",
                    Phone    = "+5581732141290",
                    //BirthDate = "1968-03-21",
                    Notify = false
                }
            };
            var chargeResponse = await charge.GenerateBillingBillAsync(body);

            if (chargeResponse is BillingBillResponseSuccess)
            {
                Assert.NotNull(((BillingBillResponseSuccess)chargeResponse).Embedded);
            }
            else if (chargeResponse is BillingBillResponseError)
            {
                Assert.NotNull(((BillingBillResponseError)chargeResponse).Error);
                Assert.NotEmpty(((BillingBillResponseError)chargeResponse).Error);
            }

            Assert.NotNull(null);
        }