Skip to content

Commit

Permalink
render the paypal logo in the payment method choice field
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacrymology committed Feb 21, 2013
1 parent 85755d0 commit d555603
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions boilerplate/apps/store/modules/payment/paypal/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@
from django.utils.translation import ugettext_lazy as _
from boilerplate.apps.store.modules.payment.base.app import PaymentModule
from boilerplate.apps.store.modules.payment.paypal import views
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe

class PaypalPaymentModule(PaymentModule):
name = 'paypal'
verbose_name = _('Paypal')
root_view = views.PaypalRootView

#: Template to generate the "paypal" button for the choice field. PayPal
#: recommends this to be taken from here:
#: https://www.paypal.com/express-checkout-buttons
choice_template_name = "checkout/paypal/choice_button.html"

def get_urls(self):
from paypal.express import urls
base_urls = super(PaypalPaymentModule, self).get_urls()
return urls.urlpatterns + base_urls

def get_choice(self):
text = render_to_string(self.choice_template_name)
return (self.name, mark_safe(text))

application = PaypalPaymentModule()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% load i18n %}
<img src="https://www.paypal.com/en_US/i/logo/PayPal_mark_37x23.gif" style="margin-right:7px;" alt="PayPal">
<span style="font-size:11px; font-family: Arial, Verdana;">{% trans "The safer, easier way to pay." %}</span>

0 comments on commit d555603

Please sign in to comment.