From e8a9f54222b961aeaca07ab0f384ecc915fef4b7 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Wed, 3 Sep 2025 10:43:01 +0200 Subject: [PATCH] Support CARD_CASHBACK transactions in Wise They behave the same as BALANCE_CASHBACK, but are labeled differently. --- postgresqleu/transferwise/api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/postgresqleu/transferwise/api.py b/postgresqleu/transferwise/api.py index 6be5834e..0b8f5b3e 100644 --- a/postgresqleu/transferwise/api.py +++ b/postgresqleu/transferwise/api.py @@ -193,7 +193,7 @@ class TransferwiseApi(object): 'paymentref': reference, 'fulldescription': fulldescription, } - elif activity['type'] == 'BALANCE_CASHBACK': + elif activity['type'] in ('BALANCE_CASHBACK', 'CARD_CASHBACK'): # No API endpoint to get this so we have to parse it out of # a ridiculously formatted field. @@ -203,13 +203,13 @@ class TransferwiseApi(object): continue yield { - 'id': 'BALANCE_CASHBACK-{}'.format(activity['resource']['id']), + 'id': '{}-{}'.format(activity['type'], activity['resource']['id']), 'datetime': activity['updatedOn'], 'amount': parsed_amount, 'feeamount': 0, - 'transtype': 'BALANCE_CASHBACK', + 'transtype': activity['type'], 'paymentref': '', - 'fulldescription': 'Balance Cashback', + 'fulldescription': activity['type'].title().replace('_', ' '), } elif activity['type'] == 'CARD_PAYMENT': # For card payments, normal tokens appear not to have permissions -- 2.39.5