Skip to content

Commit

Permalink
Fixed #1 - skipping bank transfers in transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
mmohades committed May 13, 2020
1 parent 49bd5c0 commit 9ae0a3a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def requirements():

setup(
name='venmo-api',
version='0.1.3',
version='0.1.4',
author="Mark Mohades",
license="GNU General Public License v3",
url='https://github.com/mmohades/venmo',
Expand Down
4 changes: 4 additions & 0 deletions venmo_api/models/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def __init__(self, story_id, payment_id, date_completed, date_created,
@classmethod
def from_json(cls, json):

# Skip money transfers to/from bank accounts
if json.get("transfer"):
return None

parser = JSONSchema.transaction(json)
date_created = string_to_timestamp(parser.get_date_created())
date_updated = string_to_timestamp(parser.get_date_updated())
Expand Down
9 changes: 8 additions & 1 deletion venmo_api/utils/api_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ def __get_objs_from_json_list(json_list, data_type):
:param data_type: <class> Either User/Transaction
:return: <list> a list of <User>
"""
return [data_type.from_json(obj) for obj in json_list]
result = []
for obj in json_list:
data_obj = data_type.from_json(obj)
if not data_obj:
continue
result.append(data_obj)

return result


class Colors(Enum):
Expand Down

0 comments on commit 9ae0a3a

Please sign in to comment.