Esempio n. 1
0
        public async Task Update_account_information_configurations_with_success()
        {
            // Arrange
            SimpleResponseMessage response;
            var request = new BankVerificationRequestMessage(AvailableBanks.Santander, "1111", "99999999-9", BankAccountTypeAbbreviation.CC, true);

            // Act && Assert
            using (IApiResources apiClient = new APIResource())
                using (var client = new Account(apiClient))
                {
                    response = await client.UpdateBankAccoutDataAsync(request, "74c265aedbfaea379bc0148fae9b5526").ConfigureAwait(false);
                }

            Assert.That(response.Success, Is.True);
        }
Esempio n. 2
0
        public async Task Request_withdraw()
        {
            // Arrange
            AccountRequestWithdrawResponse response;

            // Act && Assert
            using (IApiResources apiClient = new APIResource())
                using (var client = new Account(apiClient))
                {
                    var value = 5.00m;
                    response = await client.RequestWithdrawAsync("74c265aedbfaea379bc0148fae9b5526", value, "74c265aedbfaea379bc0148fae9b5526").ConfigureAwait(false);

                    Assert.That(response.WithdrawValue, Is.EqualTo(value));
                }
        }
Esempio n. 3
0
        public async Task Get_a_created_account()
        {
            // Arrange
            var requestAccountVerify = new VerifyAccountRequestMessage(expectedResponse.Data, true);
            var request         = new Fixture().Build <GetAccountResponseMessage>().Create();
            var responseContent = JsonConvert.SerializeObject(request);

            GetAccountResponseMessage response;

            // Act
            using (IHttpClientWrapper stubHttpClient = new StubHttpClient(new StringContent(responseContent, Encoding.UTF8, "application/json")))
                using (IApiResources apiClient = new APIResource(stubHttpClient))
                    using (var client = new Account(apiClient))
                    {
                        response = await client.GetAsync(request.AccountId, "any-user-token").ConfigureAwait(false);
                    }

            // Assert
            response.ShouldBeEquivalentTo(request);
        }
Esempio n. 4
0
        public async Task PrepareTests()
        {
            var request = new AccountRequestMessage {
                Name = "*****@*****.**", CommissionPercent = 10
            };

            var responseContent = JsonConvert.SerializeObject(new Fixture().Build <AccountModel>()
                                                              .With(a => a.Name, request.Name)
                                                              .Create());

            using (IHttpClientWrapper stubHttpClient = new StubHttpClient(new StringContent(responseContent, Encoding.UTF8, "application/json")))
                using (IApiResources apiClient = new APIResource(stubHttpClient))
                    using (var client = new MarketPlace(apiClient))
                    {
                        response = await client.CreateUnderAccountAsync(request).ConfigureAwait(false);
                    }

            var address     = new Fixture().Build <AddressModel>().Create();
            var fullAddress = $"{address.Street}, {address.Number} - {address.City} - {address.State}/{address.Country}";

            expectedResponse = new VerifyAccountResponseMessage
            {
                AccountId = response.AccountId,
                Data      = new AccountModel(fullAddress)
                {
                    PriceRange              = "Entre R$ 100,00 e R$ 500,00",
                    PhysicalProducts        = false,
                    BusinessDescription     = "Negócios online",
                    PersonType              = Constants.PersonType.INDIVIDUAL_PERSON,
                    AcceptAutomaticTransfer = true,
                    CPF               = "42753418306",
                    Name              = "Meu Cliente",
                    Phone             = "2199999999",
                    Bank              = Constants.SupportedBanks.CAIXA_ECONOMICA,
                    AccountType       = Constants.BankAccountType.CHECKING_ACCOUNT,
                    BankAgency        = "1520",
                    BankAccountNumber = "00100021066-6"
                },
            };
        }