diff options
author | Magnus Hagander | 2025-07-02 12:53:32 +0000 |
---|---|---|
committer | Magnus Hagander | 2025-07-02 12:55:50 +0000 |
commit | 4108e192d235e96496c8996a0f7883a714d8b818 (patch) | |
tree | aae481223f6a25838a2a597e3c9604285a0ffad8 /postgresqleu/transferwise/api.py | |
parent | 1febf08ad2ff6ff835dc51433d52d6d0766056bb (diff) |
Attempt to make transferwise payouts half-complete
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.
Diffstat (limited to 'postgresqleu/transferwise/api.py')
-rw-r--r-- | postgresqleu/transferwise/api.py | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/postgresqleu/transferwise/api.py b/postgresqleu/transferwise/api.py index ed8c40a9..0f16ca38 100644 --- a/postgresqleu/transferwise/api.py +++ b/postgresqleu/transferwise/api.py @@ -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) |