Skip to content

Commit

Permalink
Feature update function to Deposit resource
Browse files Browse the repository at this point in the history
  • Loading branch information
wendel-stark committed Oct 19, 2023
1 parent 92efb29 commit 7e5e271
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions starkbank/deposit/__deposit.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def update(id, amount=None, user=None):
"""# Update Deposit entity
Update the Deposit by passing its id to be partially or fully reversed.
## Parameters (required):
- id [string]: Deposit id. ex: '5656565656565656'
- id [string]: Deposit id. ex: "5656565656565656"
## Parameters (optional):
- amount [string]: The new amount of the Deposit. If the amount = 0 the Deposit will be fully reversed
- amount [string, default None]: The new amount of the Deposit. If the amount = 0 the Deposit will be fully reversed
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkbank.user was set before function call
## Return:
- target Deposit with updated attributes
Expand Down
11 changes: 6 additions & 5 deletions tests/sdk/test_deposit.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,22 @@ def test_success(self):
print(deposit)


if __name__ == '__main__':
main()


class TestDepositInfoPatch(TestCase):

def test_success_amount(self):
deposits = starkbank.deposit.query(status="created", limit=1)
deposit_amount = 0
for deposit in deposits:
self.assertIsNotNone(deposit.id)
print(deposit)
updated_deposit = starkbank.deposit.update(
deposit.id,
amount=deposit_amount,
)
print(updated_deposit)
self.assertEqual(updated_deposit.amount, deposit_amount)


if __name__ == '__main__':
main()


0 comments on commit 7e5e271

Please sign in to comment.