Attempt to make transferwise payouts half-complete
authorMagnus Hagander <magnus@hagander.net>
Wed, 2 Jul 2025 12:53:32 +0000 (14:53 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 2 Jul 2025 12:55:50 +0000 (14:55 +0200)
Due to the new transferwise restrictions, creating payouts would crash.
This change attempts to make it complete the parts that work and leave
the rest for a manual approval in the transferwise web interface,
hopefully keeping the rest of the system working.

When half way complete, send a notification to the user to go complete
it manually.

postgresqleu/transferwise/api.py

index ed8c40a976193485bb8eda97e3df39db6bb313a5..0f16ca386673638f71b59039337e4655a8c58923 100644 (file)
@@ -12,6 +12,8 @@ from base64 import b64encode
 
 from postgresqleu.util.time import today_global
 from postgresqleu.util.crypto import rsa_sign_string_sha256
+from postgresqleu.mailqueue.util import send_simple_mail
+
 from .models import TransferwiseRefund
 
 
@@ -326,13 +328,27 @@ class TransferwiseApi(object):
         )
         transferid = transfer['id']
 
+        # We can no longer fund the transfer, because Wise decided it's not allowed to access our own money.
+        # So we have to tell the user to do it.
+
         # Fund the transfer from our account
-        fund = self.post(
-            'profiles/{}/transfers/{}/payments'.format(self.get_profile(), transferid),
-            {
-                'type': 'BALANCE',
-            },
-            version='v3',
-        )
+#        fund = self.post(
+#            'profiles/{}/transfers/{}/payments'.format(self.get_profile(), transferid),
+#            {
+#                'type': 'BALANCE',
+#            },
+#            version='v3',
+#        )
+
+        send_simple_mail(settings.INVOICE_SENDER_EMAIL,
+                         self.pm.config('notification_receiver'),
+                         'TransferWise payout initiated!',
+                         """A TransferWise payout of {0} with reference {1}
+has been initiated. Unfortunately, it can not be completed
+through the API due to restrictions at TransferWise, so you need to
+log into the account and confirm it manually.
+
+OPlease do so as soon as possible.
+""".format(amount, reference))
 
         return (accid, quoteid, transferid)