Closed will-holley closed 4 years ago
Thank you for opening an issue! Yes, I added the enum to make sure that other parts of the code wouldn't break by a transaction type that I haven't seen and supported in my code.
I've never seen a top_up
before. Do you know what is atop_up
and how does the JSON body look like? I'm currently skipping any transactions (refund and bank transfers) other than payment
. I can skip top_up
as well, but it helps to know what it is before doing it.
This may help you to see the transaction body:
r = requests.request(method="GET", url=f"https://api.venmo.com/v1/stories/target-or-actor/{user_id}", headers={"Authorization": f"Bearer {token}",
"User-Agent": "Venmo/7.29.1 (iPhone; iOS 12.0; Scale/2.0)"})
print('TEXT:', r.text)
Thanks for the quick response!
I discovered a few Transaction types that weren't accounted for: {'top_up', 'authorization', 'atm_withdrawal'}
which are all related to the Venmo debit card.
As a future proof change (because TransactionType
inherits from Enum
which is inherently brittle to upstream changes to the API), I suggest modifying transaction.py:50
to if transaction_type is not TransactionType.PAYMENT
.
I'll add the response json bodies here in a moment..
{'app': None,
'audience': 'private',
'authorization': None,
'comments': {'count': 0, 'data': []},
'date_created': '<REDACTED_PII_STRING>',
'date_updated': '<REDACTED_PII_STRING>',
'id': '<REDACTED_PII_STRING>',
'likes': {'count': 0, 'data': []},
'mentions': {'count': 0, 'data': []},
'note': None,
'payment': None,
'top_up': {'capture': {'amount_cents': 1959,
'authorization': {'acknowledged': False,
'amount': 1959,
'atm_fees': None,
'authorization_types': ['PURCHASE'],
'captures': [],
'created_at': '<REDACTED_PII_DATEIME_STRING>',
'decline': None,
'descriptor': '<REDACTED_PII_STRING>',
'id': '<REDACTED_PII_STRING>',
'is_venmo_card': True,
'merchant': {'braintree_merchant_id': '',
'datetime_created': '<REDACTED_PII_DATEIME_STRING>',
'datetime_updated': '<REDACTED_PII_DATEIME_STRING>',
'display_name': '<REDACTED_PII_STRING>',
'id': '<REDACTED_PII_STRING>',
'image_datetime_updated': '<REDACTED_PII_DATEIME_STRING>',
'image_url': 'https://venmo-merchant-images.s3.amazonaws.com/2008122511148975016/icon_512.png',
'is_subscription': False,
'paypal_merchant_id': ''},
'payment_method': {'assets': None,
'bank_account': None,
'card': None,
'default_transfer_destination': 'none',
'fee': None,
'id': '<REDACTED_PII_STRING>',
'image_url': None,
'last_four': None,
'merchant_payment_role': 'none',
'name': 'Venmo '
'balance',
'peer_payment_role': 'default',
'top_up_role': 'none',
'type': 'balance'},
'point_of_sale': {'city': '<REDACTED_PII_STRING>',
'state': '<REDACTED_PII_STRING>'},
'rewards': None,
'rewards_earned': False,
'status': 'captured',
'story_id': '<REDACTED_PII_STRING>',
'user': <UserCls>},
'authorization_id': '<REDACTED_PII_STRING>',
'datetime_created': '<REDACTED_PII_STRING>',
'id': '<REDACTED_PII_STRING>',
'payment_id': '<REDACTED_PII_STRING>',
'top_up': None},
'datetime_created': '<REDACTED_PII_STRING>',
'id': '<REDACTED_PII_STRING>',
'multiplier': 2,
'payout_amount': 2000,
'payout_id': '<REDACTED_PII_STRING>',
'top_up_settings': {'funding_source': {'assets': {'detail': '<REDACTED_PII_STRING>',
'thumbnail': '<REDACTED_PII_STRING>'},
'bank_account': {'bank': {'asset_name': '<REDACTED_PII_STRING>',
'name': '<REDACTED_PII_STRING>'},
'id': '<REDACTED_PII_STRING>',
'is_verified': True},
'card': None,
'default_transfer_destination': 'default',
'fee': None,
'id': '<REDACTED_PII_STRING>',
'image_url': '<REDACTED_PII_STRING>',
'instore_qrc_role': 'ineligible',
'last_four': '<REDACTED_PII_STRING>',
'merchant_payment_role': 'backup',
'name': '<REDACTED_PII_STRING>',
'peer_payment_role': 'backup',
'top_up_role': 'default',
'type': 'bank'},
'top_up_amount': 1000,
'weekly_reload_limit': 50000}},
'transfer': None,
'type': 'top_up'}
This is a great wrapper; thanks for working on it.
I am currently unable to access my transactions as
UserAPI.get_user_transactions(user_id=me.id)
raisesValueError: 'top_up' is not a valid TransactionType
.I preliminarily investigated whether this was a trivial fix by adding
TOP_UP = 'top_up'
to theTransactionType
class; anotherValueError
was thrown which leads me to believe that top ups follow a different schema than payments (which intuitively makes sense, as you're probably aware that a top up is not a transaction).I am going to keep digging into this.