Skip to content

Support additional activity feed transaction type / subType pairs #7

@aGrimRepoMan

Description

@aGrimRepoMan

Could the activity feed transation type / subType pairs listed below be added to method _activity_add_description() in wealthsimple_api.py?
They currently generate the "Unknown activity" message when encountered by the test client.

Pasted below are the associated activity dicts as displayed by the test client. I indicate any dict key value redactions I made by:
<redacted1>, <redacted2>, etc.
I also suggest potential approach, but I'm sure you'll have better ones!

  1. 'DEPOSIT' / 'AFT' & 'WITHDRAWAL' / 'AFT'
    ▪ Activity dict:
    Unknown activity: {'accountId': 'ca-cash-msb-<redacted1>', 'aftOriginatorName': '<redacted2>', 'aftTransactionCategory': None, 'aftTransactionType': 'investment', 'amount': '<redacted3>', 'amountSign': 'positive', 'assetQuantity': None, 'assetSymbol': None, 'canonicalId': 'funding_intent-<redacted4>-ca-cash-msb-<redacted1>', 'currency': 'CAD', 'eTransferEmail': None, 'eTransferName': None, 'externalCanonicalId': 'funding_intent-redacted4', 'identityId': 'identity-<redacted5>', 'institutionName': None, 'occurredAt': '<redacted6>', 'p2pHandle': None, 'p2pMessage': None, 'spendMerchant': None, 'securityId': None, 'billPayCompanyName': None, 'billPayPayeeNickname': None, 'redactedExternalAccountNumber': None, 'opposingAccountId': None, 'status': 'completed', 'subType': 'AFT', 'type': 'DEPOSIT', 'strikePrice': None, 'contractType': None, 'expiryDate': None, 'chequeNumber': None, 'provisionalCreditAmount': None, 'primaryBlocker': None, 'interestRate': None, 'frequency': 'ONE_TIME', 'counterAssetSymbol': None, 'rewardProgram': None, 'counterPartyCurrency': None, 'counterPartyCurrencyAmount': None, 'counterPartyName': None, 'fxRate': None, 'fees': None, 'reference': None, '__typename': 'ActivityFeedItem', 'description': 'DEPOSIT: AFT'}

    ▪ Potential approach:

        # Refs:
        #   https://www.payments.ca/payment-resources/iso-20022/automatic-funds-transfer
        #   https://www.payments.ca/compelling-new-evidence-strong-link-between-aft-and-canadas-cheque-decline
        # 2nd ref states: "AFTs are electronic direct credit or direct debit
        # transactions, commonly known in Canada as direct deposits or pre-
        # authorized debits (PADs)."
        elif act['type'] in ('DEPOSIT', 'WITHDRAWAL') and act['subType'] == 'AFT':
            type_ = 'Direct deposit' if act['type'] == 'DEPOSIT' else 'Pre-authorized debit'
            direction = 'from' if type_ == 'Direct deposit' else 'to'
            institution = act['aftOriginatorName'] if act['aftOriginatorName'] else act['externalCanonicalId']
            act['description'] = f"{type_}: {direction} {institution}"       
  1. 'WITHDRAWAL' / 'BILL_PAY'
    ▪ Activity Dict:
    Unknown activity: {'accountId': 'ca-cash-msb-<redacted1>', 'aftOriginatorName': None, 'aftTransactionCategory': None, 'aftTransactionType': None, 'amount': '<redacted2>', 'amountSign': 'negative', 'assetQuantity': None, 'assetSymbol': None, 'canonicalId': 'funding_intent-<redacted3>-ca-cash-msb-<redacted1>', 'currency': 'CAD', 'eTransferEmail': None, 'eTransferName': None, 'externalCanonicalId': 'funding_intent-<redacted3>', 'identityId': 'identity-<redacted4>', 'institutionName': None, 'occurredAt': '<redacted5>', 'p2pHandle': None, 'p2pMessage': None, 'spendMerchant': None, 'securityId': None, 'billPayCompanyName': '<Acme Utility Company', 'billPayPayeeNickname': None, 'redactedExternalAccountNumber': '∙∙∙∙<further-redacted6>', 'opposingAccountId': None, 'status': 'completed', 'subType': 'BILL_PAY', 'type': 'WITHDRAWAL', 'strikePrice': None, 'contractType': None, 'expiryDate': None, 'chequeNumber': None, 'provisionalCreditAmount': None, 'primaryBlocker': None, 'interestRate': None, 'frequency': 'ONE_TIME', 'counterAssetSymbol': None, 'rewardProgram': None, 'counterPartyCurrency': None, 'counterPartyCurrencyAmount': None, 'counterPartyName': None, 'fxRate': None, 'fees': None, 'reference': None, '__typename': 'ActivityFeedItem', 'description': 'WITHDRAWAL: BILL_PAY'}

    ▪ Potential approach:

        elif act['type'] == 'WITHDRAWAL' and act['subType'] == 'BILL_PAY':
            type_ = act['type'].capitalize()
            name = act['billPayPayeeNickname']
            if not name:
                name = act['billPayCompanyName']
            number = act['redactedExternalAccountNumber']
            act['description'] = f"{type_}: Bill pay {name} {number}"

Note: If in the future WS API implemented “FetchFundingMethods” graphQL operation, it might be possible to retrieve & display the fully unredacted account number (by searching the returned list of client's Bill Payee information for company match via key "fullAccountNumber")?

  1. 'P2P_PAYMENT' / 'SEND' & 'P2P_PAYMENT' / 'SEND_RECEIVED'
    ▪ Activity Dict:
    Unknown activity: {'accountId': 'ca-cash-msb-<redacted1>', 'aftOriginatorName': None, 'aftTransactionCategory': None, 'aftTransactionType': None, 'amount': '<redacted2>', 'amountSign': 'positive', 'assetQuantity': None, 'assetSymbol': None, 'canonicalId': 'payment-<redacted3>', 'currency': 'CAD', 'eTransferEmail': None, 'eTransferName': None, 'externalCanonicalId': 'payment-<redacted3>', 'identityId': 'identity-<redacted4>', 'institutionName': None, 'occurredAt': '<redacted5>', 'p2pHandle': '<redacted6>', 'p2pMessage': '<redacted7>', 'spendMerchant': None, 'securityId': None, 'billPayCompanyName': None, 'billPayPayeeNickname': None, 'redactedExternalAccountNumber': None, 'opposingAccountId': None, 'status': 'accepted', 'subType': 'SEND_RECEIVED', 'type': 'P2P_PAYMENT', 'strikePrice': None, 'contractType': None, 'expiryDate': None, 'chequeNumber': None, 'provisionalCreditAmount': None, 'primaryBlocker': None, 'interestRate': None, 'frequency': None, 'counterAssetSymbol': None, 'rewardProgram': None, 'counterPartyCurrency': None, 'counterPartyCurrencyAmount': None, 'counterPartyName': None, 'fxRate': None, 'fees': None, 'reference': None, '__typename': 'ActivityFeedItem', 'description': 'P2P_PAYMENT: SEND_RECEIVED'}

    ▪ Potential approach:

        elif act['type'] == 'P2P_PAYMENT' and act['subType'] in ('SEND', 'SEND_RECEIVED'):
            direction = 'sent to' if act['subType'] == 'SEND' else 'received from'
            p2pHandle = act['p2pHandle']
            act['description'] = f"Cash {direction} {p2pHandle}"
  1. 'INCENTIVE_BONUS' / 'PROMOTION'
    ▪ Activity Dict
    Unknown activity: {'accountId': 'ca-cash-msb-<redacted1>', 'aftOriginatorName': 'ACME HYDRO COMPANY', 'aftTransactionCategory': None, 'aftTransactionType': 'misc_payments', 'amount': '<redacted2>', 'amountSign': 'negative', 'assetQuantity': None, 'assetSymbol': None, 'canonicalId': 'funding_intent-<redacted3>-ca-cash-msb-<redacted1>', 'currency': 'CAD', 'eTransferEmail': None, 'eTransferName': None, 'externalCanonicalId': 'funding_intent-<redacted3>', 'identityId': 'identity-<redacted4>', 'institutionName': None, 'occurredAt': '<redacted5>', 'p2pHandle': None, 'p2pMessage': None, 'spendMerchant': None, 'securityId': None, 'billPayCompanyName': None, 'billPayPayeeNickname': None, 'redactedExternalAccountNumber': None, 'opposingAccountId': None, 'status': 'completed', 'subType': 'AFT', 'type': 'WITHDRAWAL', 'strikePrice': None, 'contractType': None, 'expiryDate': None, 'chequeNumber': None, 'provisionalCreditAmount': None, 'primaryBlocker': None, 'interestRate': None, 'frequency': 'ONE_TIME', 'counterAssetSymbol': None, 'rewardProgram': None, 'counterPartyCurrency': None, 'counterPartyCurrencyAmount': None, 'counterPartyName': None, 'fxRate': None, 'fees': None, 'reference': None, '__typename': 'ActivityFeedItem', 'description': 'WITHDRAWAL: AFT'}

    ▪ Potential approach:

        elif act['type'] == 'PROMOTION' and act['subType'] == 'INCENTIVE_BONUS':
            type_ = act['type'].capitalize()
            subtype = act['subType'].replace('_', ' ').capitalize()
            act['description'] = f"{type_}: {subtype}"
  1. 'REFERRAL' / None
    ▪ Activity Dict:
    Unknown activity: {'accountId': 'ca-cash-msb-<redacted1>', 'aftOriginatorName': None, 'aftTransactionCategory': None, 'aftTransactionType': None, 'amount': '<redacted2>', 'amountSign': 'positive', 'assetQuantity': None, 'assetSymbol': None, 'canonicalId': 'user_bonus_<redacted3>', 'currency': 'CAD', 'eTransferEmail': None, 'eTransferName': None, 'externalCanonicalId': '<redacted3>', 'identityId': None, 'institutionName': None, 'occurredAt': '<redacted4>', 'p2pHandle': None, 'p2pMessage': None, 'spendMerchant': None, 'securityId': None, 'billPayCompanyName': None, 'billPayPayeeNickname': None, 'redactedExternalAccountNumber': None, 'opposingAccountId': None, 'status': None, 'subType': None, 'type': 'REFERRAL', 'strikePrice': None, 'contractType': None, 'expiryDate': None, 'chequeNumber': None, 'provisionalCreditAmount': None, 'primaryBlocker': None, 'interestRate': None, 'frequency': None, 'counterAssetSymbol': None, 'rewardProgram': None, 'counterPartyCurrency': None, 'counterPartyCurrencyAmount': None, 'counterPartyName': None, 'fxRate': None, 'fees': None, 'reference': None, '__typename': 'ActivityFeedItem', 'description': 'REFERRAL: None'}

    ▪ Potential approach:

        elif act['type'] == 'REFERRAL' and act['subType'] is None:
            type_ = act['type'].capitalize()
            act['description'] = f"{type_}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions