Пример #1
0
        /// <summary>
        /// Cria uma carteira de cliente
        /// </summary>
        /// <param name="bankBilletAccountData">dados da conta</param>
        /// <returns>Conta criada com sucesso</returns>
        /// <see cref="http://api.boletosimples.com.br/reference/v1/bank_billet_accounts/#criar-carteira"/>
        public async Task <ApiResponse <BankBilletAccount> > PostAsync(BankBilletAccount bankBilletAccountData)
        {
            var request = _requestBuilder.To(_client.Connection.GetBaseUri(), BANK_BILLET_ACCOUNTS_API)
                          .WithMethod(HttpMethod.Post)
                          .AndOptionalContent(bankBilletAccountData)
                          .Build();

            return(await _client.SendAsync <BankBilletAccount>(request));
        }
Пример #2
0
        /// <summary>
        /// Enviar CNAB
        /// </summary>
        /// <param name="fileName">nome do arquivo</param>
        /// <param name="file">conteudo do arquivo</param>
        /// <see cref="http://api.boletosimples.com.br/reference/v1/discharges/#enviar-cnab"/>
        /// <returns>Modelo que representa o arquivo de retorno</returns>
        public async Task <ApiResponse <Discharge> > PostAsync(string fileName, Stream file)
        {
            var request = _requestBuilder.To(_client.Connection.GetBaseUri(), DISCHARGE_API)
                          .WithMethod(HttpMethod.Post)
                          .AppendFileContent("discharge[file]", fileName, file)
                          .Build();

            return(await _client.SendAsync <Discharge>(request));
        }
Пример #3
0
        /// <summary>
        /// Cria um carnê
        /// </summary>
        /// <param name="installment">dados do carne</param>
        /// <returns>Carnê criado com sucesso</returns>
        /// <see cref="http://api.boletosimples.com.br/reference/v1/installments/#criar-carnê"/>
        public async Task <ApiResponse <Installment> > PostAsync(Installment installment)
        {
            var request = _requestBuilder.To(_client.Connection.GetBaseUri(), INSTALLMENTS_API)
                          .WithMethod(HttpMethod.Post)
                          .AndOptionalContent(installment)
                          .Build();

            return(await _client.SendAsync <Installment>(request));
        }
Пример #4
0
        /// <summary>
        /// Cria uma assinatura
        /// </summary>
        /// <param name="customerSubscription">dados da assinatura</param>
        /// <returns>Assinatura criada com sucesso</returns>
        /// <see cref="http://api.boletosimples.com.br/reference/v1/customer_subscriptions/#criar-assinatura"/>
        public async Task <ApiResponse <CustomerSubscription> > PostAsync(CustomerSubscription customerSubscription)
        {
            var request = _requestBuilder.To(_client.Connection.GetBaseUri(), CUSTOMER_SUBSCRIPTION_API)
                          .WithMethod(HttpMethod.Post)
                          .AndOptionalContent(customerSubscription)
                          .Build();

            return(await _client.SendAsync <CustomerSubscription>(request));
        }
Пример #5
0
        /// <summary>
        /// Criar CNAB(Remessa)
        /// </summary>
        /// <param name="remittance">nome do arquivo</param>
        /// <see cref="http://api.boletosimples.com.br/reference/v1/remittances/#criar-cnab"/>
        /// <returns>Modelo que representa o arquivo de remessa</returns>
        public async Task <ApiResponse <Remittance> > PostAsync(Remittance remittance)
        {
            var request = _requestBuilder.To(_client.Connection.GetBaseUri(), REMITTANCE_API)
                          .WithMethod(HttpMethod.Post)
                          .AndOptionalContent(remittance)
                          .Build();

            return(await _client.SendAsync <Remittance>(request));
        }
Пример #6
0
        // TODO: Implementar fluxo com OAuth

        /*
         * public async Task<ApiResponse<UserInfoResponseMessage>> GetOAuthToken()
         * {
         *  var request = _requestBuilder.To(new Uri("http://locahost"))
         *                               .WithMethod(HttpMethod.Get)
         *                               .AndOptionalContent(new StringContent(""))
         *                               .Build();
         *
         *  return await _client.SendAsync<UserInfoResponseMessage>(request);
         * }
         */

        /// <summary>
        /// Obtem informação do usuário pelo token de acesso
        /// </summary>
        /// <returns>Informações gerais do usuário</returns>
        /// <see cref="http://api.boletosimples.com.br/authentication/token/"/>
        public async Task <ApiResponse <UserInfo> > GetUserInfoAsync()
        {
            var request = _requestBuilder.To(_client.Connection.GetBaseUri(), "/userinfo")
                          .WithMethod(HttpMethod.Get)
                          .Build();

            return(await _client.SendAsync <UserInfo>(request));
        }
Пример #7
0
        /// <summary>
        /// Informações do evento
        /// </summary>
        /// <param name="id">id do evento</param>
        /// <returns>Obtêm informações do evento</returns>
        /// <see cref="http://api.boletosimples.com.br/reference/v1/events/#informações-do-evento"/>
        public async Task <ApiResponse <EventData> > GetAsync(int id)
        {
            var request = _requestBuilder.To(_client.Connection.GetBaseUri(), $"{EVENTS_API}/{id}")
                          .WithMethod(HttpMethod.Get)
                          .Build();

            return(await _client.SendAsync <EventData>(request));
        }