From 3d67c09311385cdcfd286b3eee38606e23cff02a Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Tue, 12 Feb 2013 18:56:33 +0100 Subject: [PATCH] paypal: Support transaction types --- modules/paypal/pages.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/paypal/pages.py b/modules/paypal/pages.py index 3926f5cd..99e844dd 100644 --- a/modules/paypal/pages.py +++ b/modules/paypal/pages.py @@ -292,8 +292,20 @@ class HistoryPage(BasePage): trans.rdate = date trans.label = to_unicode(row.xpath('.//td[@class="emailInfo"]')[0].text_content().strip()) - trans.raw = to_unicode(row.xpath('.//td[@class="paymentTypeInfo"]')[0].text_content().strip()) \ - + u' ' + trans.label + info = to_unicode(row.xpath('.//td[@class="paymentTypeInfo"]')[0].text_content().strip()) + trans.raw = info + u' ' + trans.label + + if u'Authorization' in info or u'Autorisation' in info: + continue + + if u'Credit Card' in trans.label or u'Carte bancaire' in trans.label: + trans.type = Transaction.TYPE_CARD + elif info.startswith(u'Payment') or info.startswith(u'Paiement'): + trans.type = Transaction.TYPE_ORDER + elif u'Currency Conversion' in info or u'Conversion de devise' in info: + trans.type = Transaction.TYPE_BANK + else: + trans.type = Transaction.TYPE_UNKNOWN yield trans