Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: django-oscar/django-oscar-paypal
...
head fork: django-oscar/django-oscar-paypal
Checking mergeability… Don't worry, you can still create the pull request.
  • 9 commits
  • 13 files changed
  • 4 commit comments
  • 1 contributor
View
3  .travis.yml
@@ -1,8 +1,9 @@
language: python
python:
+ - "2.6"
- "2.7"
install:
- python setup.py develop
- pip install -r requirements.txt
script:
- - ./run_tests.py
+ - ./runtests.py
View
3  MANIFEST.in
@@ -1,2 +1,3 @@
include *.rst
-recursive-include paypal/express/templates/paypal *.txt *.html
+include LICENSE
+recursive-include paypal/templates/ *.html
View
12 README.rst
@@ -10,7 +10,8 @@ Express`_ and `PayPal Payflow Pro`_.
.. _`PayPal Express`: https://www.paypal.com/uk/cgi-bin/webscr?cmd=_additional-payment-ref-impl1
.. _`PayPal Payflow Pro`: https://merchant.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=merchant/payment_gateway
-The package is structured so that it can be used without Oscar if you so wish.
+These payment options can be used individually or both together. Further, the
+package is structured so that it can be used without Oscar if you so wish.
* `Full documentation`_
* `Continuous integration status`_
@@ -21,7 +22,8 @@ The package is structured so that it can be used without Oscar if you so wish.
Having problems or got a question?
* Have a look at the sandbox installation as this is a sample Oscar project
- integrated with both PayPal options.
+ integrated with both PayPal options. See the contributing guide within the
+ docs for instructions on how to set up the sandbox locally.
* Ping `@django_oscar`_ with quick queries.
* Ask more detailed questions on the Oscar mailing list: django-oscar@googlegroups.com.
* Use Github for submitting issues and pull requests.
@@ -33,6 +35,12 @@ The package is released under the new BSD license.
Changelog
---------
+0.2.1
+~~~~~
+* Fix packaging issues
+* Remove dead templates
+* With API docs
+
0.2
~~~
Includes support for Payflow Pro.
View
1  docs/conf.py
@@ -18,6 +18,7 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, PROJECT_ROOT)
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sandbox.settings')
# -- General configuration -----------------------------------------------------
View
12 docs/index.rst
@@ -9,10 +9,14 @@ Welcome to django-oscar-paypal's documentation!
This package provides integration between django-oscar and two of PayPal's
payment options:
-* PayPal Express -
-
-* PayPal PayFlow Pro - Allows you to accept customer payments on your site
- without requiring a redirect to PayPal.
+* *PayPal Express* - Involves redirecting customer's over to PayPal's site where
+ they can choose shipping options and confirm payment using their PayPal
+ account. The customer is then redirected back to the merchant site where they
+ confirm the order.
+
+* *PayPal PayFlow Pro* - Allows you to accept customer payments on your site
+ without requiring a redirect to PayPal. This allows the customer to pay with
+ a normal bankcard rather than their PayPal account.
It's possible to use both of these options individually or at the same time.
Further, it's possible to use either without Oscar.
View
29 docs/payflow.rst
@@ -109,3 +109,32 @@ Not included
* SWIPE transactions (eg card present)
* Non-referenced credits (eg refunding to an arbitrary bankcard). All refunds
must correspond to a previously settled transaction.
+
+-------------------
+Using without Oscar
+-------------------
+
+To use Payflow Pro without an Oscar install, you need to use the
+``paypal.payflow.gateway`` module directly. This module is agnostic of Oscar
+and can be used independently.
+
+The ``paypal.payflow.facade`` module is a bridging module that provides a
+simpler API designed to link Oscar to the gateway module.
+
+---
+API
+---
+
+Facade
+------
+
+.. automodule:: paypal.payflow.facade
+ :members:
+
+Gateway
+-------
+
+.. automodule:: paypal.payflow.gateway
+ :members:
+
+
View
2  paypal/__init__.py
@@ -1 +1 @@
-VERSION = '0.2'
+VERSION = '0.2.1'
View
2  paypal/express/views.py
@@ -91,7 +91,7 @@ def get_redirect_url(self, **kwargs):
class SuccessResponseView(PaymentDetailsView):
- template_name_preview = 'paypal/preview.html'
+ template_name_preview = 'paypal/express/preview.html'
preview = True
def get(self, request, *args, **kwargs):
View
58 paypal/payflow/facade.py
@@ -10,7 +10,13 @@
def authorize(order_number, amt, bankcard, billing_address=None):
"""
- Make an authorisation request to PayPal.
+ Make an *authorisation* request
+
+ This holds the money on the customer's bank account but does not mark the
+ transaction for settlement. This is the most common method to use for
+ fulfilling goods that require shipping. When the goods are ready to be
+ shipped, the transaction can be marked for settlement by calling the
+ delayed_capture method.
If successful, return nothing ("silence is golden") - if unsuccessful raise
an exception which can be caught and handled within view code.
@@ -18,9 +24,9 @@ def authorize(order_number, amt, bankcard, billing_address=None):
:order_number: Order number for request
:amt: Amount for transaction
:bankcard: Instance of Oscar's Bankcard class (which is just a dumb wrapper
- around the pertinent bankcard attributes).
+ around the pertinent bankcard attributes).
:billing_address: A dict of billing address information (which can come from
- the `cleaned_data` of a billing address form.
+ the `cleaned_data` of a billing address form).
"""
return _submit_payment_details(gateway.authorize, order_number, amt, bankcard,
billing_address)
@@ -28,7 +34,11 @@ def authorize(order_number, amt, bankcard, billing_address=None):
def sale(order_number, amt, bankcard, billing_address=None):
"""
- Make a sale request to PayPal.
+ Make a *sale* request
+
+ This holds the money on the customer's bank account and marks the
+ transaction for settlement that night. This is appropriate method to use
+ for products that can be immediately fulfilled - such as digital products.
If successful, return nothing ("silence is golden") - if unsuccessful raise
an exception which can be caught and handled within view code.
@@ -36,9 +46,9 @@ def sale(order_number, amt, bankcard, billing_address=None):
:order_number: Order number for request
:amt: Amount for transaction
:bankcard: Instance of Oscar's Bankcard class (which is just a dumb wrapper
- around the pertinent bankcard attributes).
+ around the pertinent bankcard attributes).
:billing_address: A dict of billing address information (which can come from
- the `cleaned_data` of a billing address form.
+ the `cleaned_data` of a billing address form.
"""
return _submit_payment_details(gateway.sale, order_number, amt, bankcard,
billing_address)
@@ -77,17 +87,18 @@ def delayed_capture(order_number, pnref=None, amt=None):
"""
Capture funds that have been previously authorized.
- Note:
+ Notes:
+
* It's possible to capture a lower amount than the original auth
- transaction - however..
- * Only one delayed capture is allowed for a given PNREF.
- * If multiple captures are required, a 'reference transaction' needs to be
+ transaction - however...
+ * ...only one delayed capture is allowed for a given PNREF...
+ * ...If multiple captures are required, a 'reference transaction' needs to be
used.
* It's safe to retry captures if the first one fails or errors
:order_number: Order number
:pnref: The PNREF of the authorization transaction to use. If not
- specified, the order number is used to retrieve the appropriate transaction.
+ specified, the order number is used to retrieve the appropriate transaction.
:amt: A custom amount to capture.
"""
if pnref is None:
@@ -110,6 +121,21 @@ def delayed_capture(order_number, pnref=None, amt=None):
def referenced_sale(order_number, pnref, amt):
"""
Capture funds using the bank/address details of a previous transaction
+
+ This is equivalent to a *sale* transaction but without the user having to
+ enter their payment details.
+
+ There are two main uses for this:
+
+ 1. This allows customers to checkout without having to re-enter their
+ payment details.
+
+ 2. It allows an initial authorisation to be settled in multiple parts. The
+ first settle should use delayed_capture but any subsequent ones should use this method.
+
+ :order_number: Order number.
+ :pnref: PNREF of a previous transaction to use.
+ :amt: The amount to settle for.
"""
txn = gateway.reference_transaction(order_number,
pnref,
@@ -121,7 +147,10 @@ def referenced_sale(order_number, pnref, amt):
def void(order_number, pnref):
"""
- Void an auth transaction to prevent it from being settled
+ Void an authorisation transaction to prevent it from being settled
+
+ :order_number: Order number
+ :pnref: The PNREF of the transaction to void.
"""
txn = gateway.void(order_number, pnref)
if not txn.is_approved:
@@ -135,8 +164,9 @@ def credit(order_number, pnref=None, amt=None):
:order_number: Order number
:pnref: The PNREF of the authorization transaction to use. If not
- specified, the order number is used to retrieve the appropriate transaction.
- :amt: A custom amount to capture.
+ specified, the order number is used to retrieve the appropriate transaction.
+ :amt: A custom amount to capture. If not specified, the entire transaction
+ is refuneded.
"""
if pnref is None:
# No PNREF specified, look-up the auth/sale transaction for this order number
View
39 paypal/templates/paypal/cancel.html
@@ -1,39 +0,0 @@
-{% extends "checkout/checkout.html" %}
-{% load currency_filters %}
-
-{% block title %}
-Order preview | {{ block.super }}
-{% endblock %}
-
-{% block checkout-nav %}
-{% include 'checkout/nav.html' with step=4 %}
-{% endblock %}
-
-{# Null out the actions as they can't be used here #}
-{% block shipping_address_actions %}{% endblock %}
-{% block order_contents_actions %}{% endblock %}
-
-{% block payment_method %}
-<div class="span6">
- <div class="sub-header">
- <h2>Payment</h2>
- </div>
- <div class="well well-success">
- <p>PayPal Express Checkout</p>
- <p>PayPal user: {{ paypal_user_email }}</p>
- <p>Amount: {{ paypal_amount|currency }}</p>
- </div>
-</div>
-{% endblock %}
-
-{% block place_order %}
-<h3>Please review the information above, then click "Place Order"</h3>
-<form method="post" action="{% url paypal-place-order %}">
- {% csrf_token %}
- <input type="hidden" name="payer_id" value="{{ payer_id }}" />
- <input type="hidden" name="token" value="{{ token }}" />
- <div class="form-actions">
- <input id='place-order' type="submit" value="Place order" class="pull-right btn btn-primary btn-large js-disable-on-click" />
- </div>
-</form>
-{% endblock place_order %}
View
1  paypal/templates/paypal/error.html
@@ -1 +0,0 @@
-asdf asdfas
View
0  paypal/templates/paypal/preview.html → paypal/templates/paypal/express/preview.html
File renamed without changes
View
3  setup.py
@@ -13,8 +13,7 @@
keywords="Payment, PayPal, Oscar",
license=open('LICENSE').read(),
platforms=['linux'],
- packages=find_packages(),
- include_package_data = True,
+ packages=find_packages(exclude=['sandbox*', 'tests*']),
# See http://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=['Environment :: Web Environment',
'Framework :: Django',

Showing you all comments on commits in this comparison.

@smaggs

Removing this line prevents the templates under paypal from getting installed. The MANIFEST line only gets them into the source distribution, but in order to be installed by pip they need to be included in setup.py through include_package_data or individual listings.

@codeinthehole

Good spot - thanks. I'll push a new release with this fixed

@codeinthehole

Try version 0.2.4 - should be fixed.

@smaggs

Thanks!

Something went wrong with that request. Please try again.