Skip to content

Commit

Permalink
Merge pull request #58 from starkbank/feature/transfer-description
Browse files Browse the repository at this point in the history
Add description property to Transfer resource
  • Loading branch information
cdottori-stark authored Mar 22, 2021
2 parents 9c2af91 + 94db4a6 commit 9d0f745
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
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:
### Added
- Event.Attempt sub-resource to allow retrieval of information on failed webhook event delivery attempts
- Boleto.transaction_ids property to allow transaction tracking
- Transfer.description property to allow control over corresponding Transaction descriptions

## [2.8.0] - 2021-03-09
### Added
Expand Down
6 changes: 5 additions & 1 deletion starkbank/transfer/__transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Transfer(Resource):
- account_type [string, default "checking"]: Receiver bank account type. This parameter only has effect on Pix Transfers. ex: "checking", "savings" or "salary"
- external_id [string, default None]: 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, datetime.datetime or string, default now]: date or datetime when the transfer will be processed. May be pushed to next business day if necessary. ex: datetime.datetime(2020, 3, 10, 10, 30, 0, 0)
- description [string, default None]: optional description to override default description to be shown in the bank statement. ex: "Payment for service #1234"
- tags [list of strings]: list of strings for reference when searching for transfers. ex: ["employees", "monthly"]
## Attributes (return-only):
- id [string, default None]: unique id returned when the transfer is created. ex: "5656565656565656"
Expand All @@ -29,7 +30,9 @@ class Transfer(Resource):
- updated [datetime.datetime, default None]: latest update datetime for the transfer. ex: datetime.datetime(2020, 3, 10, 10, 30, 0, 0)
"""

def __init__(self, amount, name, tax_id, bank_code, branch_code, account_number, account_type=None, external_id=None, scheduled=None, transaction_ids=None, fee=None, tags=None, status=None, id=None, created=None, updated=None):
def __init__(self, amount, name, tax_id, bank_code, branch_code, account_number, account_type=None,
external_id=None, scheduled=None, description=None, transaction_ids=None, fee=None, tags=None,
status=None, id=None, created=None, updated=None):
Resource.__init__(self, id=id)

self.tax_id = tax_id
Expand All @@ -41,6 +44,7 @@ def __init__(self, amount, name, tax_id, bank_code, branch_code, account_number,
self.account_type = account_type
self.external_id = external_id
self.scheduled = check_datetime_or_date(scheduled)
self.description = description
self.tags = tags
self.fee = fee
self.status = status
Expand Down
1 change: 1 addition & 0 deletions tests/utils/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def generateExampleTransfersJson(n=1, randomSchedule=False):
transfer.tax_id = TaxIdGenerator.taxId()
transfer.account_type = choice(["checking", "savings", "salary"])
transfer.external_id = str(uuid4())
transfer.description = choice([None, "Test description"])
if randomSchedule:
transfer.scheduled = choice([date.today(), datetime.utcnow()]) + timedelta(days=randint(0, 10))
transfers.append(transfer)
Expand Down

0 comments on commit 9d0f745

Please sign in to comment.