Skip to content

Commit

Permalink
Merge pull request #50 from starkbank/add/transfer-metadata
Browse files Browse the repository at this point in the history
Add metadata attribute to Transfer resource
  • Loading branch information
xavier-stark authored Mar 22, 2023
2 parents d222364 + 80a0b29 commit 8feed60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Given a version number MAJOR.MINOR.PATCH, increment:

## [2.7.0] - 2023-03-16
### Added
- metadata attribute to Transfer resource
- updated, type and transaction_ids attribute to UtilityPayment resource
- workspace_id attribute to Boleto resource
- updated attribute to BoletoHolmes::Log resource
Expand Down
7 changes: 5 additions & 2 deletions lib/transfer/transfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ module StarkBank
# - fee [integer]: fee charged when transfer is created. 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, second is the chargeback). ex: ['19827356981273']
# - metadata [dictionary object]: dictionary object used to store additional information about the Transfer object.
# - 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)
class Transfer < StarkCore::Utils::Resource
attr_reader :amount, :name, :tax_id, :bank_code, :branch_code, :account_number, :account_type, :external_id, :scheduled, :description, :transaction_ids, :fee, :tags, :rules, :status, :id, :created, :updated
def initialize(amount:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type: nil, external_id: nil, scheduled: nil, description: nil, transaction_ids: nil, fee: nil, tags: nil, rules: nil, status: nil, id: nil, created: nil, updated: nil)
attr_reader :amount, :name, :tax_id, :bank_code, :branch_code, :account_number, :account_type, :external_id, :scheduled, :description, :transaction_ids, :metadata, :fee, :tags, :rules, :status, :id, :created, :updated
def initialize(amount:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type: nil, external_id: nil, scheduled: nil, description: nil, transaction_ids: nil, metadata: nil, fee: nil, tags: nil, rules: nil, status: nil, id: nil, created: nil, updated: nil)
super(id)
@amount = amount
@name = name
Expand All @@ -53,6 +54,7 @@ def initialize(amount:, name:, tax_id:, bank_code:, branch_code:, account_number
@fee = fee
@status = status
@transaction_ids = transaction_ids
@metadata = metadata
@created = StarkCore::Utils::Checks.check_datetime(created)
@updated = StarkCore::Utils::Checks.check_datetime(updated)
end
Expand Down Expand Up @@ -214,6 +216,7 @@ def self.resource
fee: json['fee'],
status: json['status'],
transaction_ids: json['transaction_ids'],
metadata: json['metadata'],
created: json['created'],
updated: json['updated']
)
Expand Down

0 comments on commit 8feed60

Please sign in to comment.