summaryrefslogtreecommitdiff
path: root/postgresqleu/paypal
AgeCommit message (Collapse)Author
2024-06-06Accept paypal code T0700 as a paymentMagnus Hagander
This is one never seen before and seems to be used for shipping labels. Bring it in and treat it like any other. Noted by Christophe Pettus, but not his patch - going for a minimalistic one. This code may need some further refactoring down the road.
2023-12-04Add support for another type of paypal withdrawalsMagnus Hagander
Apparently some bank withdrawals are "General Withdrawal - Bank account" and others are "Withdrawals initiated by user".
2023-12-04Fall back to treasurer email in incomplete paypal transactionsMagnus Hagander
Seems paypal sometimes can give back transactions without an email address even if the email address is mandatory. Because why not. When this happens, just fall back to our treasurer email from the config - it's almost guaranteed to be the wrong but but it is also guaranteed to exist, so the treasurer will just have to clean up the records manually in accounting later.
2023-10-03Accept T0003 as yet another type of paypal payment codeMagnus Hagander
2023-05-22Fix incorrect error return messageMagnus Hagander
2023-03-22Another new paypal transaction codeMagnus Hagander
Now a separate code for donations made using a mobile device, as if we'd care...
2022-01-05Centralize creation of invoice return URLsMagnus Hagander
This code was copy/pasted between several different places, so centralize it into the InvoiceManager class to reduce the risk of furhter off-by-one mistakes when editing.
2021-12-28Ignore paypal "general hold" transactionMagnus Hagander
Unsure exactly what this is, but they have no sender and no receiver, and they don't show up in the Paypal UI, so they can most likely be ignored. If not, it'll have to be dealt with manually.
2021-08-25Use balances API to verify PayPal balanceMagnus Hagander
It seems PayPal now has an API to get balances again, so use that one instead of the previous ugly hack to figure out the balances. With luck this means no multi-day wait for balances to match up.
2020-07-13Remove unused importsMagnus Hagander
2020-04-09Teach paypal code about code T0300, "general funding of account"Magnus Hagander
2020-04-07Add support for T0303 codes to paypalMagnus Hagander
This is a direct-bank-deposit, such as when doing an IBAN payment to ones own account. There are no details at all available in the message from paypal, so just make one up and fake the email, like we do with paypal withdrawals.
2020-04-01Specify on_delete for all ForeignKey and OneToOneFieldsMagnus Hagander
This was already done once in 8289e05cd but had not been properly maintained.
2020-03-29Remove date parameter to create_accounting_entryMagnus Hagander
This should always be set to todays date, so set it in the function instaed. This changes the behaviour of the paypal plugin to actually use todays date rather than a date parsed out from the notification. In theory this could change the accounting entry date in case the notification is so delayed it ends up on a different day, but either one could be argued to be equally correct in this case, and using the date of creation of the transaction makes tracking things a lot easier. While at it, clean up some imports that have been missed earlier.
2020-03-12Replace datetime.now() with timezone.now()Magnus Hagander
As a step on the way to better timezone support, use the django function timezone.now() instead of datetime.now(). As long as we haven't enabled timezones globally this becomes a no-op and does exactly what it did before, but once timezones are enabled it will generate datetimes that are aware of this. No functionality change but gets a lot of boiler-plate out of the way making the verification of the rest of the timezone work easier.
2020-01-08Style and minor fixes pointed out by newer version of pep8Magnus Hagander
2019-08-07Try to deal with new paypal chargeback feesMagnus Hagander
2019-07-31Handle that paypal T1106 is sometimes accompanied by a T1108Magnus Hagander
2019-07-31Set paypal name to paypal email if missingMagnus Hagander
Seems there are also cases where there is no name on the paypal transaction (again inconsistently). So if we have exchausted all known ways to find the name, just fall back and set it to the email.
2019-07-31Work around the latest weirdness from paypalMagnus Hagander
Seems code T1106 *sometimes* has an email address, and sometimes not, attached to it. It's not documented when these differ, so just try to get it and if it fails fall back to our own email address.
2019-07-30Treat unmatched paypal transaction strings as empty onesMagnus Hagander
For historical reasons (pre-accounting-system, really) we treated payments we didn't know what they were as errors, *except* if they were sent with a completely empty string. This changes them to instead be treated the same as the empty ones, which means create an open accounting entry and let the operator deal with it (but through the nicer interface, not through having to hack the backend tables). It does this by separating out the "did not match regexp" as a separate return value, and using that. Any other errors in processing (such as actually finding the pattern with an invoice number in it, but then not finding the invoice) is still treated as an error like before.
2019-06-25Add support for tracking paypal chargebacksMagnus Hagander
Yet another event code that started appearing. Previously, chargebacks were posted as refunds.
2019-04-06Also properly match the recurring unknown paymentsMagnus Hagander
2019-04-06Another attempt at fixing paypal recurring paymentsMagnus Hagander
They may look similar in some places, but are different in others.
2019-04-06Handle paypal payment type T0002Magnus Hagander
Apparently you get "subscriptino payments" from people even if you don't support subscriptions. It shows up if somebody voluntarily sets up for example a monthly donation (as far as I can tell, I can't find any documentation about it)
2019-03-27Trap authorization errors in Paypal APIMagnus Hagander
Trap errors and show them instead of just crashing with a json key lookup error. In passing, also store the tokenscope in a member variable on the API in case it's needed later.
2019-03-25Fix two message typosMagnus Hagander
One spotted by Guillaume, the other by grep
2019-02-10Update the Paypal access to use the new REST based APIMagnus Hagander
The API we've been using has been deprecated for a while, and they've now apparently started randomly dropping parts of it. So bite the bullet and migrate to the new one. This is a bit cleaner for some things, lots of things are missing, and transactions take several hours before they show up in the reporting parts of it. Luckily, those parts are only used in cronjobs running every few hours anyway... There are new transaction codes for everything, so there are probably some missed. There are also new and fancy inconsistencies in the different ways that transaction texts can be reported, so there are most likely some missed cases, but the common ones are covered. Regular payment information is still using the PDT system (which is independent of both APIs) and should not be affected. Only the fetching of transactions, balances and issuing of refunds are. NOTE: This requires reconfiguration of all paypal integrations. Instead of api user/password/signature, an OAuth client and secret is used, and the app itself has to be registered on each account. Instructions are in the documentation.
2019-02-09Register paypal transfer-to-bank as pending bank matchersMagnus Hagander
2019-02-08Complete the band-aid fixMagnus Hagander
2019-02-08Band-aid fix for Paypal moduleMagnus Hagander
It seems Paypal no longer includes the currency for Transfer records in the old API. This API is deprecated so we should switch to a newer one, but for now just make sure we don't crash and just give the same error as we would if the wrong currency was used.
2019-01-28Schedule existing django management commandsMagnus Hagander
This adds the scheduling metadata to all the existing management commands. In passing, also makes the description nicer on a couple of them, since it is now shown in the admin web.
2019-01-19Re-factor payment methods and move configuration to the databaseMagnus Hagander
This is a major refactoring of how the payment method integrates, with the intetion of making it more flexible and more easy to use. 1. Configuration now lives in the database instead of local_settings.py. 2. This configuration is edited through the /admin/ interface, which makes it a lot easier to add constraints (and instructions), thus preventing misconfiguration. 3. Invoice payment methods are now separate from invoice payment implementations. That means there can be multiple instances of the same payment method, such as multiple different paypal accounts, being managed. 4. All payment method implementations are now available in all installations, including Braintree and Trustly. This retires the x_ENABLED settings in local_settings.py. The code won't actually run unless there are any payment methods defined with them. 5. On migration, all payment methods that are marked as inactive and have never been used are removed. Any payment method that has been used is left around, since there are old invoices connected to it. Likewise, any payment method that is selected as available for any sponsorship level (past or future) is left in the system. XXXXXX manual action needed on production systems XXXXXX 1. Settings for payment methods should be migrated automatically, but should of course be verified! 2. The template for Manual Bank Transfer is *not* migrated, since it wasn't in settings.py, but in a template and overriden downstream. Migrate the contents of the template invoices/banktransfer.html to the database using the /admin/ interface. When this is done, the template can be removed. 3. Notification URLs in Adyen must be updated in the Adyen backoffice to include the payment method id in the url (adding a /n/ to the end of the URL, with n being the id of the payment method). 4. Notification URLs in Paypal must be updated the same way.
2019-01-10Fix more unicode issuesMagnus Hagander
2019-01-10Replace __unicode__ with __str__Magnus Hagander
2to3 doesn't do this automatically, probably because weird things can happen if you had both. We know we didn't, so just do a straight replacement.
2019-01-10Import related fixes from 2to3Magnus Hagander
2019-01-10Generic changes for python3 from 2to3Magnus Hagander
2019-01-06Fix paypal refunds for organisations not named PostgreSQL EuropeMagnus Hagander
A long time ago the string was made non-hardcoded, but the length of the string was not.
2019-01-06Fix remaining pep8 errorsVik Fearing
It may look worse, but it makes pep8 happy
2019-01-04Put decode statement in the correct placeMagnus Hagander
2019-01-04Add missing importMagnus Hagander
2019-01-04Switch to using requests for http requestsMagnus Hagander
It's a lot cleaner API than urllib2, and will be easier once we port version. Hopefully this doesn't break something. Probably it does break encoding somewhere, because py2.
2019-01-04Fix sibling importsMagnus Hagander
Sibling imports should be prefixed with a period. Good idea in py2, will eventually become required in py3, so another small step.
2019-01-04Switch to new style try/except handlingMagnus Hagander
Python 2.6 introduced the better syntax, Python 3 removes the old one, so one small step towards py3.
2018-12-15Replace usage of has_key()Magnus Hagander
It has been deprecated, and instead we should use "in" and "not in", so make that change across the board.
2018-12-14Avoid using stupid variable name lMagnus Hagander
Disencouraged by pep8 due to hard-to-read
2018-12-14Fix blankline related warningsMagnus Hagander
2018-12-14Fix comment warningsMagnus Hagander
In passing remove some comments that were pointless
2018-12-14Fix spaces before/after comma and colonMagnus Hagander
Mostly not important, but getting rid of the PIP warnings will help catch errors in the future.
2018-12-14Fix spacing around parameter namesMagnus Hagander
Surprisingly many of these were pure copy/paste errors from the same source...