Commits

Josh VanderLinden committed 5f8d3b2

#124 - Handling some problems with affiliate account confirmation

  • Participants
  • Parent commits 9368516

Comments (0)

Files changed (2)

 # HG changeset patch
-# Parent af5861e14c3b9545ff4eff244d970695c6292ebe
+# Parent 5575c9c1a8beab252ef29c69e3a685e1c8a9fdc7
 #111 - affiliates have to confirm their site
 
 diff --git a/satchmo/apps/payment/views/checkout.py b/satchmo/apps/payment/views/checkout.py
 new file mode 100644
 --- /dev/null
 +++ b/satchmo/apps/satchmo_ext/affiliates/models.py
-@@ -0,0 +1,67 @@
+@@ -0,0 +1,75 @@
 +from uuid import uuid4
 +
 +from django.db import models
 +
 +        return currency(self.balance())
 +
++    def save(self, *args, **kwargs):
++        """Cleans up the affiliate object before saving"""
++
++        if 'http' in self.website:
++            self.website = self.website.split('://')[1].strip('/ ')
++
++        super(Affiliate, self).save(*args, **kwargs)
++
 +class AffiliateSale(models.Model):
 +    affiliate = models.ForeignKey(Affiliate, related_name='sales')
 +    order = models.ForeignKey(Order, related_name='affiliate_sales')
 new file mode 100644
 --- /dev/null
 +++ b/satchmo/apps/satchmo_ext/affiliates/views.py
-@@ -0,0 +1,114 @@
+@@ -0,0 +1,115 @@
 +from datetime import date
 +import urllib2
 +
 +                affiliate.save()
 +                messages.error(request, 'Affiliate account validation failed.')
 +            else:
-+                print html
++                # remove useless unicode from the HTML
++                html = html.decode('ascii', 'ignore')
 +                if affiliate.confirm_code in html:
 +                    affiliate.is_active = True
 +                    affiliate.save()
 +    return views.confirm_info(request, config, 'moneybookers',
 +            extra_notes='Please send the payment to DailyVarianceBook@gmail.com.')
 +
+diff --git a/satchmo/apps/payment/modules/paypal/views.py b/satchmo/apps/payment/modules/paypal/views.py
+--- a/satchmo/apps/payment/modules/paypal/views.py
++++ b/satchmo/apps/payment/modules/paypal/views.py
+@@ -69,6 +69,7 @@
+     processor_module = payment_module.MODULE.load_module('processor')
+     processor = processor_module.PaymentProcessor(payment_module)
+     processor.create_pending_payment(order=order)
++    order.add_status(status='New', notes=_("Billed through PayPal."))
+     default_view_tax = config_value('TAX', 'DEFAULT_VIEW_TAX')
+ 
+     recurring = None
+@@ -148,7 +149,7 @@
+             # If the payment hasn't already been processed:
+             order = Order.objects.get(pk=invoice)
+ 
+-            order.add_status(status='New', notes=_("Paid through PayPal."))
++            order.add_status(status='Billed', notes=_("Paid through PayPal."))
+             processor = get_processor_by_key('PAYMENT_PAYPAL')
+             payment = processor.record_payment(order=order, amount=gross, transaction_id=txn_id)
+ 
 diff --git a/satchmo/apps/payment/modules/site_transfer/__init__.py b/satchmo/apps/payment/modules/site_transfer/__init__.py
 new file mode 100644
 diff --git a/satchmo/apps/payment/modules/site_transfer/config.py b/satchmo/apps/payment/modules/site_transfer/config.py