EfiBankApiIntegration 1.0.8

dotnet add package EfiBankApiIntegration --version 1.0.8                
NuGet\Install-Package EfiBankApiIntegration -Version 1.0.8                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EfiBankApiIntegration" Version="1.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EfiBankApiIntegration --version 1.0.8                
#r "nuget: EfiBankApiIntegration, 1.0.8"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EfiBankApiIntegration as a Cake Addin
#addin nuget:?package=EfiBankApiIntegration&version=1.0.8

// Install EfiBankApiIntegration as a Cake Tool
#tool nuget:?package=EfiBankApiIntegration&version=1.0.8                

efipay-api-integration

Api para integração com o Efí Bank

Permite integração com a plataforma Efí Bank para geração de boletos e consulta de cobranças.

Pré-requisitos

Será necessário obter os valores para as seguintes variáveis para execução dos exemplos abaixo:

  • Menu > API > Aplicações > [Nome da aplicação criada] string _clientId = ""; string _clientSecret = "";

Obtendo um token de acesso:

var auth = new EfiBankAuthorization(_efiBankbaseUrl);
var authResponse = auth.Authorize("Client_Id_**", "Client_Secret_**");

_accessToken = authResponse!.AccessToken;

Gerar boleto de cobrança para Pessoa Física:

var charge = new EfiBankBankingBillet(_efiBankbaseUrl);

var chargeItem = new ChargeItem
{
    Name = "Produto Teste",
    Value = 1090,
    Amount = 2
};
var chargePayment = new PFChargePayment
{
    BankingBillet = new PFBankingBilletRequest
    {
        ExpireAt = DateTime.UtcNow.AddDays(3),
        Customer = new PFChargeCustomer
        {
            Name = "Nome Cliente",
            Email = TEST_EMAIL,
            CPF = "14014603059",
            Birth = new DateTime(1977, 01, 15),
            PhoneNumber = "62986070247"
        }
    }
};
var chargeRequest = new PFChargeRequest
{
    Items = new List<ChargeItem> { chargeItem },
    Payment = chargePayment
};
var chargeResponse = charge.GenerateCharge(_accessToken, chargeRequest);

if (chargeResponse is ChargeResponseSuccess) {
    // Successo!!
} else if (chargeResponse is ChargeResponseError) {
    // Erro!!
}

Gerar boleto de cobrança para Pessoa Jurídica:

var charge = new EfiBankBankingBillet(_efiBankbaseUrl);

var chargeItem = new ChargeItem
{
    Name = "Produto Teste",
    Value = 1090,
    Amount = 2
};
var chargePayment = new PJChargePayment
{
    BankingBillet = new PJBankingBilletRequest
    {
        ExpireAt = DateTime.UtcNow.AddDays(3),
        Customer = new PJChargeCustomer
        {
            Email = TEST_EMAIL,
            PhoneNumber = "62986070247",
            JuridicalPerson = new JuridicalPersonRequest
            {
                CorporateName = "Nome da Empresa",
                CNPJ = "99794567000144"
            }
        }
    }
};
var chargeRequest = new PJChargeRequest
{
    Items = new List<ChargeItem> { chargeItem },
    Payment = chargePayment
};
var chargeResponse = charge.GenerateCharge(_accessToken, chargeRequest);

Obtendo detalhes do boleto gerado

var charge = new EfiBankBankingBillet(_efiBankbaseUrl);
var chargeId = "43878314";

var chargeResponse = charge.GetChargeById(_accessToken, chargeId);

Alterar data de vencimento do boleto gerado

var charge = new EfiBankBankingBillet(_efiBankbaseUrl);
var chargeId = "43879035";

var chargeResponse = charge.ChangeChargeExpireAt(_accessToken, chargeId, DateTime.UtcNow.AddDays(5));

if (chargeResponse is ChargeResponseSuccess) {
    // Successo!!
} else if (chargeResponse is ChargeResponseError) {
    // Erro!!
}

Reenviar boleto gerado por e-mail

var charge = new EfiBankBankingBillet(_efiBankbaseUrl);
var chargeId = "43879035";

var chargeResponse = charge.ResendChargeToEmail(_accessToken, chargeId, "mar***@gmail.com");

Marcar boleto como pago

var charge = new EfiBankBankingBillet(_efiBankbaseUrl);
var chargeId = "43879033";

var chargeResponse = charge.SettleChargeById(_accessToken, chargeId);

adicionar histórico ao boleto gerado

var charge = new EfiBankBankingBillet(_efiBankbaseUrl);
var chargeId = "43879035";

var chargeResponse = charge.AddHistoryToCharge(_accessToken, chargeId, "Adicionado pelo teste unitário.");

Cancelar boleto gerado

var charge = new EfiBankBankingBillet(_efiBankbaseUrl);
var chargeId = "43878849";

var chargeResponse = charge.CancelChargeById(_accessToken, chargeId);
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.8 274 11/10/2023