From: Dave Page Date: Wed, 3 Sep 2025 08:43:01 +0000 (+0200) Subject: Support CARD_CASHBACK transactions in Wise X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=e8a9f54222b961aeaca07ab0f384ecc915fef4b7;p=pgeu-system.git Support CARD_CASHBACK transactions in Wise They behave the same as BALANCE_CASHBACK, but are labeled differently. --- 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