bb_payments
BancoBrasilPayments - The Ruby gem for the the Banco do Brasil Payments API
Installation
Build a gem
To build the Ruby code into a gem:
gem build bb_payments.gemspec
Then either install the gem locally:
gem install ./bb_payments-1.0.0.gem
(for development, run gem install --dev ./bb_payments-1.0.0.gem
to install the development dependencies)
or publish the gem to a gem hosting service, e.g. RubyGems.
Finally add this to the Gemfile:
gem 'bb_payments', '~> 1.0.0'
Install from Git
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
gem 'bb_payments', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
Include the Ruby code directly
Include the Ruby code directly using -I
as follows:
ruby -Ilib script.rb
Getting Started
Please follow the installation procedure and then run the following code:
require 'bb_payments'
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::BankSlipsApi.new
id = 'id_example'
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
opts = {
agencia: 56,
conta: 56,
digito_conta: 'digito_conta_example'
}
begin
result = api_instance.consulta_pagamento_boleto(id, gw_dev_app_key, authorization, opts)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling BankSlipsApi->consulta_pagamento_boleto: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::BankSlipsApi.new
body = BancoBrasilPayments::RootTypeForBankSlipsBatchPayment.new
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
begin
result = api_instance.enviar_pagamento_boletos_lote(body, gw_dev_app_key, authorization)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling BankSlipsApi->enviar_pagamento_boletos_lote: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::BankSlipsApi.new
id = 'id_example'
begin
result = api_instance.sondagem_pagamento_boleto(id)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling BankSlipsApi->sondagem_pagamento_boleto: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::CancelApi.new
body = BancoBrasilPayments::RootTypeForBatchTransfersCancelRequestObject.new
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
begin
result = api_instance.cancelamento_transferencia_lote(body, gw_dev_app_key, authorization)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling CancelApi->cancelamento_transferencia_lote: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::CollectionFormsApi.new
id = 'id_example'
authorization = 'authorization_example'
gw_dev_app_key = 'gw_dev_app_key_example'
opts = {
agencia: 3.4,
conta_corrente: 3.4,
digito_verificador: 'digito_verificador_example'
}
begin
result = api_instance.consulta_pagamento_guia_lote(id, authorization, gw_dev_app_key, opts)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling CollectionFormsApi->consulta_pagamento_guia_lote: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::CollectionFormsApi.new
body = BancoBrasilPayments::BarcodeCollectionFormsRequestObject.new
begin
result = api_instance.envia_pagamento_guias_lote(body)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling CollectionFormsApi->envia_pagamento_guias_lote: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::CollectionFormsApi.new
id = 'id_example'
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
debit_branch_office = 56
debit_current_account = 56
check_digits_debit_current_account = 'check_digits_debit_current_account_example'
begin
result = api_instance.sondagem_pagamento_guia_lote(id, gw_dev_app_key, authorization, debit_branch_office, debit_current_account, check_digits_debit_current_account)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling CollectionFormsApi->sondagem_pagamento_guia_lote: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::ReturnedsApi.new
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
opts = {
payment_contract: 56,
debit_branch_office: 56,
debit_current_account: 56,
check_digits_debit_current_account: 'check_digits_debit_current_account_example',
status_description: 'status_description_example',
start_date: 56,
end_date: 56,
index: 56
}
begin
result = api_instance.consulta_pagamentos_retornados(gw_dev_app_key, authorization, opts)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling ReturnedsApi->consulta_pagamentos_retornados: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::BatchPaymentsApi.new
id = 'id_example'
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
begin
result = api_instance.consulta_pagamento_transferencias_lote(id, gw_dev_app_key, authorization)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling BatchPaymentsApi->consula_pagamento_transferencias_lote: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::BatchPaymentsApi.new
id = 'id_example'
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
opts = {
index: BancoBrasilPayments::BigDecimal.new
}
begin
result = api_instance.consulta_transferencia_lote(id, gw_dev_app_key, authorization, opts)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling BatchPaymentsApi->consulta_transferencia_lote: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::BatchPaymentsApi.new
body = BancoBrasilPayments::Body.new
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
begin
result = api_instance.envia_transferencias_lote(body, gw_dev_app_key, authorization)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling BatchPaymentsApi->envia_transferencias_lote: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::BatchPaymentsApi.new
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
start_date = 56
end_date = 56
opts = {
payment_contract: 56,
debit_branch_office: 56,
debit_current_account: 56,
check_digits_debit_current_account: 'check_digits_debit_current_account_example',
payment_type: 56,
request_status: 56,
index: 56
}
begin
result = api_instance.lista_transferencias_lote(gw_dev_app_key, authorization, start_date, end_date, opts)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling BatchPaymentsApi->lista_transferencias_lote: #{e}"
end
BancoBrasilPayments.configure do |config|
config.access_token = 'YOUR ACCESS TOKEN'
end
api_instance = BancoBrasilPayments::BatchPaymentsApi.new
id = 'id_example'
gw_dev_app_key = 'gw_dev_app_key_example'
authorization = 'authorization_example'
begin
result = api_instance.sondagem_transferencia_lote(id, gw_dev_app_key, authorization)
p result
rescue BancoBrasilPayments::ApiError => e
puts "Exception when calling BatchPaymentsApi->sondagem_transferencia_lote: #{e}"
end
Documentation for API Endpoints
All URIs are relative to https://api.desenv.bb.com.br/payments-vpn/v3
Documentation for Models
Documentation for Authorization
OAuth2-CC
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
License
Copyright (c) Hent. MIT License.