Class: StarkInfra::CreditNote::Transfer
- Inherits:
-
Utils::Resource
- Object
- Utils::SubResource
- Utils::Resource
- StarkInfra::CreditNote::Transfer
- Defined in:
- lib/creditnote/creditnote.rb
Overview
# CreditNote::Transfer object
Transfer sent to the credit receiver after the contract is signed.
## Parameters (required):
-
name [string]: receiver full name. ex: ‘Anthony Edward Stark’
-
tax_id [string]: receiver tax ID (CPF or CNPJ) with or without formatting. ex: ‘01234567890’ or ‘20.018.183/0001-80’
-
bank_code [string]: code of the receiver bank institution in Brazil. ex: ‘20018183’
-
branch_code [string]: receiver bank account branch. Use ‘-’ in case there is a verifier digit. ex: ‘1357-9’
-
account_number [string]: receiver bank account number. Use ‘-’ before the verifier digit. ex: ‘876543-2’
## Parameters (optional):
-
account_type [string, default ‘checking’]: Receiver bank account type. This parameter only has effect on Pix Transfers. ex: ‘checking’, ‘savings’, ‘salary’ or ‘payment’
-
tags [list of strings, default nil]: list of strings for reference when searching for transfers. ex: [‘employees’, ‘monthly’]
## Attributes (return-only):
-
amount [integer]: amount in cents to be transferred. ex: 1234 (= R$ 12.34)
-
external_id [string]: url safe string that must be unique among all your transfers. Duplicated external_ids will cause failures. By default, this parameter will block any transfer that repeats amount and receiver information on the same date. ex: ‘my-internal-id-123456’
-
scheduled [DateTime, Date or string]: date or datetime when the transfer will be processed. May be pushed to next business day if necessary. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
-
description [string]: optional description to override default description to be shown in the bank statement. ex: ‘Payment for service #1234’
-
id [string]: unique id returned when the transfer is created. ex: ‘5656565656565656’
-
fee [integer]: fee charged when the Transfer is processed. ex: 200 (= R$ 2.00)
-
status [string]: current transfer status. ex: ‘success’ or ‘failed’
-
transaction_ids [list of strings]: ledger Transaction IDs linked to this Transfer (if there are two, the second is the chargeback). ex: [‘19827356981273’]
-
created [DateTime]: creation datetime for the transfer. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
-
updated [DateTime]: latest update datetime for the transfer. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
Instance Attribute Summary collapse
-
#account_number ⇒ Object
readonly
Returns the value of attribute account_number.
-
#account_type ⇒ Object
readonly
Returns the value of attribute account_type.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#bank_code ⇒ Object
readonly
Returns the value of attribute bank_code.
-
#branch_code ⇒ Object
readonly
Returns the value of attribute branch_code.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#external_id ⇒ Object
readonly
Returns the value of attribute external_id.
-
#fee ⇒ Object
readonly
Returns the value of attribute fee.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#scheduled ⇒ Object
readonly
Returns the value of attribute scheduled.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#tax_id ⇒ Object
readonly
Returns the value of attribute tax_id.
-
#transaction_ids ⇒ Object
readonly
Returns the value of attribute transaction_ids.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
Attributes inherited from Utils::Resource
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, tax_id:, bank_code:, branch_code:, account_number:, account_type: nil, tags: nil, id: nil, amount: nil, external_id: nil, scheduled: nil, description: nil, fee: nil, status: nil, created: nil, updated: nil, transaction_ids: nil) ⇒ Transfer
constructor
A new instance of Transfer.
Methods inherited from Utils::SubResource
Constructor Details
#initialize(name:, tax_id:, bank_code:, branch_code:, account_number:, account_type: nil, tags: nil, id: nil, amount: nil, external_id: nil, scheduled: nil, description: nil, fee: nil, status: nil, created: nil, updated: nil, transaction_ids: nil) ⇒ Transfer
Returns a new instance of Transfer.
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/creditnote/creditnote.rb', line 295 def initialize( name:, tax_id:, bank_code:, branch_code:, account_number:, account_type: nil, tags: nil, id: nil, amount: nil, external_id: nil, scheduled: nil, description: nil, fee: nil, status: nil, created: nil, updated: nil, transaction_ids: nil ) super(id) @name = name @tax_id = tax_id @bank_code = bank_code @branch_code = branch_code @account_number = account_number @account_type = account_type @tags = @amount = amount @external_id = external_id @scheduled = scheduled @description = description @fee = fee @status = status @transaction_ids = transaction_ids @created = StarkInfra::Utils::Checks.check_datetime(created) @updated = StarkInfra::Utils::Checks.check_datetime(updated) end |
Instance Attribute Details
#account_number ⇒ Object (readonly)
Returns the value of attribute account_number.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def account_number @account_number end |
#account_type ⇒ Object (readonly)
Returns the value of attribute account_type.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def account_type @account_type end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def amount @amount end |
#bank_code ⇒ Object (readonly)
Returns the value of attribute bank_code.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def bank_code @bank_code end |
#branch_code ⇒ Object (readonly)
Returns the value of attribute branch_code.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def branch_code @branch_code end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def created @created end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def description @description end |
#external_id ⇒ Object (readonly)
Returns the value of attribute external_id.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def external_id @external_id end |
#fee ⇒ Object (readonly)
Returns the value of attribute fee.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def fee @fee end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def name @name end |
#scheduled ⇒ Object (readonly)
Returns the value of attribute scheduled.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def scheduled @scheduled end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def status @status end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def @tags end |
#tax_id ⇒ Object (readonly)
Returns the value of attribute tax_id.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def tax_id @tax_id end |
#transaction_ids ⇒ Object (readonly)
Returns the value of attribute transaction_ids.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def transaction_ids @transaction_ids end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
294 295 296 |
# File 'lib/creditnote/creditnote.rb', line 294 def updated @updated end |
Class Method Details
.resource ⇒ Object
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/creditnote/creditnote.rb', line 320 def self.resource { resource_name: 'Transfer', resource_maker: proc { |json| Transfer.new( id: json['id'], tax_id: json['tax_id'], name: json['name'], bank_code: json['bank_code'], branch_code: json['branch_code'], account_number: json['account_number'], amount: json['amount'], account_type: json['account_type'], external_id: json['external_id'], scheduled: json['scheduled'], description: json['description'], tags: json['tags'], fee: json['fee'], status: json['status'], created: json['created'], updated: json['updated'], transaction_ids: json['transaction_ids'] ) } } end |