class StarkBank::BrcodePreview

# BrcodePreview object

A BrcodePreview is used to get information from a BR Code you received to check the informations before paying it.

## Attributes (return-only):

Attributes

account_number[R]
account_type[R]
allow_change[R]
amount[R]
bank_code[R]
branch_code[R]
name[R]
reconciliation_id[R]
status[R]
tax_id[R]

Public Class Methods

new(status:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type:, allow_change:, amount:, reconciliation_id:) click to toggle source
# File lib/brcode_preview/brcode_preview.rb, line 25
def initialize(status:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type:, allow_change:, amount:, reconciliation_id:)
  @status = status
  @name = name
  @tax_id = tax_id
  @bank_code = bank_code
  @branch_code = branch_code
  @account_number = account_number
  @account_type = account_type
  @allow_change = allow_change
  @amount = amount
  @reconciliation_id = reconciliation_id
end
query(limit: nil, brcodes: nil, user: nil) click to toggle source

# BrcodePreview is DEPRECATED: Please use PaymentPreview instead. Retrieve BrcodePreviews

Receive a generator of BrcodePreview objects previously created in the Stark Bank API

## Parameters (optional):

  • brcodes [list of strings]: List of brcodes to preview. ex: %w[00020126580014br.gov.bcb.pix0136a629532e-7693-4846-852d-1bbff817b5a8520400005303986540510.005802BR5908T'Challa6009Sao Paulo62090505123456304B14A]

  • user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call

## Return:

# File lib/brcode_preview/brcode_preview.rb, line 49
def self.query(limit: nil, brcodes: nil, user: nil)
  warn "[DEPRECATION] `BrcodePreview` is deprecated.  Please use `PaymentPreview` instead."
  StarkBank::Utils::Rest.get_stream(
    user: user,
    limit: nil,
    brcodes: brcodes,
    **resource
  )
end
resource() click to toggle source
# File lib/brcode_preview/brcode_preview.rb, line 59
def self.resource
  {
    resource_name: 'BrcodePreview',
    resource_maker: proc { |json|
      BrcodePreview.new(
        status: json['status'],
        name: json['name'],
        tax_id: json['tax_id'],
        bank_code: json['bank_code'],
        branch_code: json['branch_code'],
        account_number: json['account_number'],
        account_type: json['account_type'],
        allow_change: json['allow_change'],
        amount: json['amount'],
        reconciliation_id: json['reconciliation_id']
      )
    }
  }
end