Skip to content

Commit 4f11368

Browse files
committed
new: support for Wealthsimple Visa Infinite credit card account & transactions
Fixes #9
1 parent 679a21e commit 4f11368

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setuptools.setup(
44
name = 'WS-API',
55
packages = ['ws_api'],
6-
version = '0.16.0',
6+
version = '0.17.0',
77
license = 'GPL-3.0',
88
description = 'Access your Wealthsimple account using their (GraphQL) API.',
99
author = 'Guillaume Boudreau',

ws_api/wealthsimple_api.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ def _account_add_description(account):
350350
account['description'] = "Crypto"
351351
elif account['unifiedAccountType'] == 'SELF_DIRECTED_RRIF':
352352
account['description'] = f"RRIF: self-directed - {account['currency']}"
353+
elif account['unifiedAccountType'] == 'CREDIT_CARD':
354+
account['description'] = "Credit card"
353355
# TODO: Add other types as needed
354356

355357
def get_account_balances(self, account_id):
@@ -551,6 +553,23 @@ def _activity_add_description(self, act):
551553
type_ = act['type'].capitalize()
552554
act['description'] = f"{type_}"
553555

556+
elif act['type'] == 'CREDIT_CARD' and act['subType'] == 'PURCHASE':
557+
merchant = act['spendMerchant']
558+
status = '(Pending) ' if act['status'] == 'authorized' else '' # Posted purchase transactions have status = settled
559+
act['description'] = f"{status}Credit card purchase: {merchant}"
560+
561+
elif act['type'] == 'CREDIT_CARD' and act['subType'] == 'HOLD':
562+
merchant = act['spendMerchant']
563+
status = '(Pending) ' if act['status'] == 'authorized' else '' # Posted return transactions have subType = REFUND and status = settled
564+
act['description'] = f"{status}Credit card refund: {merchant}"
565+
566+
elif act['type'] == 'CREDIT_CARD' and act['subType'] == 'REFUND':
567+
merchant = act['spendMerchant']
568+
act['description'] = f"Credit card refund: {merchant}"
569+
570+
elif act['type'] == 'CREDIT_CARD' and act['subType'] == 'PAYMENT':
571+
act['description'] = "Credit card payment"
572+
554573
# TODO: Add other types as needed
555574

556575
def security_id_to_symbol(self, security_id: str) -> str:

0 commit comments

Comments
 (0)