Code Monkey home page Code Monkey logo

django-oscar-paypal's Introduction

PayPal package for django-oscar

This package provides integration between django-oscar and both PayPal REST API, PayPal Express (NVP) and PayPal Payflow Pro.

These payment options can be used individually or together. Further, the package is structured so that it can be used without Oscar if you so wish.

License

The package is released under the New BSD license.

Support

Having problems or got a question?

  • Have a look at the sandbox site as this is a sample Oscar project 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: [email protected]
  • Use Github for submitting issues and pull requests.

Tests

Coverage

Changelog

2.0.0 (released December 20th, 2019)

  • Add support for Oscar 2.0 and Django 2.2.
  • Drop support for Oscar 1.6 and lower and Django 2.0 and lower.
  • Drop support for Python 2.

1.0.0 (released May 30th, 2018)

  • Add support for Oscar 1.6 and Django 2.
  • Drop support for Oscar 1.4 and lower and Django 1.10 and lower.

0.9.7 (released January 12th, 2016)

  • Fix breakage when using Oscar's DeferredTaxMixin. #98 #121

0.9.6 (released November 13th, 2015)

  • Add support for Oscar 1.1 and Django 1.8.
  • Drop support for Django 1.6 and Oscar 0.7.
  • Store submitted shipping method instead of falling back to FixedPrice. #107
  • Display original Paypal error message instead of generic error message. #101
  • Bugfix: Hide form buttons as expected. #94
  • Bugfix: Correct signature for call to get_shipping_methods. #99
  • Bugfix: Don't fail in countries without postcode. #100

0.9.5

  • Fix issue with missing templates in PyPI package.

0.9.4

  • Use Bankcard.number instead of the deprecated Bankcard.card_number attribute.
  • Add support for Django 1.7 and Oscar 1.0.
  • Drop support for Oscar 0.6 and Django 1.5.

0.9.3

  • Use the correct key to look up a previous transaction ID (for refund/capture/void operations). #81

0.9.2

  • Include templates in package (they were missing from 0.9.1)
  • Dynamically load view classes in Express views module

0.9.1

  • Add support for Python 3.3 and 3.4
  • Add preliminary support for (unreleased) Oscar 0.8

0.9

  • Support Oscar 0.7 (note that this release only works with 0.7.1 onwards)
  • Drop support for Oscar 0.5
  • Fix bug around unicode handling
  • Allow scheme of callback URL to be specified in a setting

0.8.1

  • Ensure sandbox demo site works correctly with Oscar 0.6
  • Fix a bug with Payflow Pro using wrong bankcard attribute for expiry dates.
  • Remove Oscar version verification in setup.py
  • Use content-type text/namevalue when submitting key-value pairs to PayPal.

0.8

  • Support Oscar 0.6
  • Fix bug with offers not being applied to basket on return from PayPal site.

0.7

  • Remove Oscar from install_requires

0.6.1

  • Persist shipping method name when using PayPal Express as a payment method only.

0.6

  • Add support for NO_SHIPPING option with PayPal Express.

0.5

  • Addresses a security issue where baskets could be manipulated while the customer was on the PayPal site. This would cause the final order to contain more items that were paid for.

0.4.1

  • Fixes a bug where the second line of a user's address was not being used to create the order shipping address.

0.4

  • We now require Oscar >= 0.5
  • Full i18 support
  • New dashboard views for PayPal Express

0.3.3

  • Restrict to Oscar < 0.5

0.3.2

  • Pass shipping address name when using Express checkout
  • Docs update

0.3.1

  • Fix issue with currency formatting
  • Fix issue with i18n proxies being passed to PayPal

0.3

  • Order discounts are now passed correctly to PayPal as separate lines
  • Fix unicode issue when reading data back from PayPal
  • Use Tox for testsuite

0.2.5

  • Fix silly bug with reference transactions

0.2.4

  • Fix bug with installing templates

0.2.3

  • Fix bug with amount formats not being validated properly
  • Adjust txn model to allow virtually everything to be nullable

0.2.2

  • Add support for specifying transaction currency

0.2.1

  • Fix packaging issues
  • Remove dead templates
  • With API docs

0.2

Includes support for Payflow Pro.

0.1

Includes support for Express Checkout.

django-oscar-paypal's People

Contributors

aaugustin avatar airtonix avatar anentropic avatar arussil avatar bezidejni avatar caioariede avatar ch0ate avatar ckepper avatar codeinthehole avatar daniel-butler avatar ddiazpinto avatar dependabot-preview[bot] avatar dependabot[bot] avatar dorianfm avatar dragonjun avatar dulacp avatar emidiotorre avatar fghaas avatar itbabu avatar izidormatusov avatar jmaupetit avatar maiksprenger avatar marcofucci avatar mbelarbi avatar phedoreanu avatar pxg avatar samitnuk avatar solarissmoke avatar vdboor avatar woutdp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-oscar-paypal's Issues

transaction_detail.html actions form visibility setting

Firstly I don't know if this is the right place to post this as I am a newbie for web applications and github. Please warn me if I'm wrong...

Authorization setting is missing for transaction_detail.html actions form visibility which is set by
{% if show_forms %}
or it should be show_form_buttons

Module name conflicts with django-paypal

django-oscar-paypal conflicts with django-paypal; they both use the same app name paypal. So depending on resolution order, one will mask the other.

Changing the name to e.g. oscar_paypal would be the right thing to do, but that probably has to wait for a major release.

NoneType has no method quantize

We've detected the following error on paypal/express/gateway.py when there are several shipping methods but the one to use is chosen at the e-commerce, not within Paypal.

"NoneType has no meethod quantize"

The problem occurs when gateway.py tries to access the shipping_method.charge_incl_tax attribute. This attribute is no longer guaranteed since oscar 0.8 and gateway.py should call the shipping_method.calculate(basket) method instead (as it is already doing for the shipping_methods list).

A pull request is on its way.

pip install error with some templates

Hi,

I saw that when I install django-oscar-paypal (0.9.1) with pip, I get this warrning :

warning: no files found matching '*.html' under directory 'paypal/templates/'

The consequences is that you get an error in your shop after the PayPal payment. For exemple : TemplateDoesNotExist: paypal/express/preview.html

I had to add the template manually in my project, but it's not realy clean.

Maybe a problem with the pypi package.

Regards

The Basket Offers are disappeared after Paypal payment (in preview step and in the Dashboard orders)

I'm using
Django-Oscar VERSION = 0.6 pre-alpha
Django-Oscar-Paypal branch #34 fo compatibility with Django-Oscar

The problem is that, after i have done a payment with Paypal, i lose offers on my frozen basket?
Anyone has resolved this issue? If it has been resolved in in the default branch could anyone tell me how to monkey patch in this Django-Oscar-Paypal version?
@codeinthehole can you help me?
I attach an image in which you can see at the top the cost with the discount and in the bottom the form with the price without discount.
In the dashboad, then, i see the order of that basket without the offers, too.
paypal_bug

Here the difference in dashboard:orders and dashboard:paypal views
paypal_bug2
paypal_bug3

Can't install django-oscar-paypal without django-oscar coming too (and Django 1.4)

rachel$ pip install django-oscar-paypal
Downloading/unpacking django-oscar-paypal
Downloading django-oscar-paypal-0.6.1.tar.gz
Running setup.py egg_info for package django-oscar-paypal

Downloading/unpacking django-oscar>=0.5,<0.6 (from django-oscar-paypal)
Downloading django-oscar-0.5.1.tar.gz (1.5MB): 1.5MB downloaded
Running setup.py egg_info for package django-oscar

build_submission() got multiple values for keyword argument 'basket'

Hello,
I am seeing the error "build_submission() got multiple values for keyword argument 'basket'" in checkout/session.py when processing the success view from PayPal Express. It seems that we set the basket in the kwargs in express/views.py as follows:

Reload frozen basket which is specified in the URL

    kwargs['basket'] = self.load_frozen_basket(kwargs['basket_id'])
    if not kwargs['basket']:
        logger.warning(
            "Unable to load frozen basket with ID %s", kwargs['basket_id'])
        messages.error(
            self.request,
            _("No basket was found that corresponds to your "
              "PayPal transaction"))
        return HttpResponseRedirect(reverse('basket:summary'))

    logger.info(
        "Basket #%s - showing preview with payer ID %s and token %s",
        kwargs['basket'].id, self.payer_id, self.token)

    return super(SuccessResponseView, self).get(request, *args, **kwargs)

And then in checkout/session.py it tries to pass basket as an explicit argument as well as in the kwargs for build_submission():

def get_context_data(self, *_kwargs):
# Use the proposed submission as template context data. Flatten the
# order kwargs so they are easily available too.
ctx = self.build_submission(
basket=self.request.basket, *_kwargs)
ctx.update(kwargs)
ctx.update(ctx['order_kwargs'])
return ctx

This causes the error shown above. I am using oscar 0.7 and oscar-paypal 0.9.3

Any help is much appreciated!

Thank you.

SuccessResponseView overrides the chosen shipping method

I have been tracking down why my orders come through with the wrong shipping method code, but correct method name.

It's because in express checkout we have this code:

    def get_shipping_method(self, basket, shipping_address=None, **kwargs):
        """
        Return the shipping method used
        """
        if not basket.is_shipping_required():
            return NoShippingRequired()

        # Instantiate a new FixedPrice shipping method instance
        charge_incl_tax = D(self.txn.value('PAYMENTREQUEST_0_SHIPPINGAMT'))

        # Assume no tax for now
        charge_excl_tax = charge_incl_tax
        method = FixedPrice(charge_excl_tax, charge_incl_tax)
        name = self.txn.value('SHIPPINGOPTIONNAME')

        if not name:
            session_method = super(SuccessResponseView, self).get_shipping_method(
                basket, shipping_address, **kwargs)
            if session_method:
                method.name = session_method.name
        else:
            method.name = name
        return method

Is there a reason we don't attempt to use the real shipping method class and instead instantiate a FixedPrice and set attributes on it? Is this deliberately to avoid recalculating the price? We have the basket object here and in build_submission method, can we not trust the real shipping method object to calculate the same price again?

If we're going to do it like above it should also set the code attribute at least

Question: How to set paypal as default payment?

Hi,

I just installed djang-oscar on my project and I was able to create the connection with Paypal, right now I can add items to the basket and there I have two options:

a) Checkout; which bring a page that saids:
'Enter payment details, This page needs implementing within your project. You may want to use on one of Oscar's payment gateway libraries: django-oscar-paypal ...'

b) Cart; which shows me the items on the cart and it gives two options:
- pay with Paypal
- checkout; this options sent me to a)

Is there any way to set that when a user clicks on "checkout" it appears a default payment method? in this case Paypal?

Thanks in advanced,
Regards.

PD. Maybe this wasn't the correct place to post this, sorry for that.

Exception Value: no such table: paypal_expresstransaction

I have run ./manage.py syncdb and even ./manage.py migrate after installing django-oscar-paypal, and when I click on the Paypal Express button on the payment details page, I get the error:

Environment:


Request Method: GET
Request URL: http://localhost:8000/checkout/paypal/payment/

Django Version: 1.6.3
Python Version: 2.7.6
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.flatpages',
 'django.contrib.staticfiles',
 'django.contrib.sitemaps',
 'compressor',
 'south',
 'oscar_stripe',
 'oscar',
 'oscar.apps.analytics',
 'oscar.apps.checkout',
 'oscar.apps.address',
 'oscar.apps.shipping',
 'oscar.apps.catalogue',
 'oscar.apps.catalogue.reviews',
 'oscar.apps.partner',
 'oscar.apps.basket',
 'oscar.apps.payment',
 'oscar.apps.offer',
 'oscar.apps.order',
 'oscar.apps.customer',
 'oscar.apps.promotions',
 'oscar.apps.search',
 'oscar.apps.voucher',
 'oscar.apps.wishlists',
 'oscar.apps.dashboard',
 'oscar.apps.dashboard.reports',
 'oscar.apps.dashboard.users',
 'oscar.apps.dashboard.orders',
 'oscar.apps.dashboard.promotions',
 'oscar.apps.dashboard.catalogue',
 'oscar.apps.dashboard.offers',
 'oscar.apps.dashboard.partners',
 'oscar.apps.dashboard.pages',
 'oscar.apps.dashboard.ranges',
 'oscar.apps.dashboard.reviews',
 'oscar.apps.dashboard.vouchers',
 'oscar.apps.dashboard.communications',
 'haystack',
 'treebeard',
 'sorl.thumbnail']
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'oscar.apps.basket.middleware.BasketMiddleware',
 'django.middleware.transaction.TransactionMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')


Traceback:
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/transaction.py" in inner
  371.                 return func(*args, **kwargs)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/views/generic/base.py" in view
  69.             return self.dispatch(request, *args, **kwargs)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/oscar/apps/checkout/session.py" in dispatch
  45.             request, *args, **kwargs)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  87.         return handler(request, *args, **kwargs)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/views/generic/base.py" in get
  189.         url = self.get_redirect_url(*args, **kwargs)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/paypal/express/views.py" in get_redirect_url
  54.             url = self._get_redirect_url(basket, **kwargs)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/paypal/express/views.py" in _get_redirect_url
  121.         return get_paypal_url(**params)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/paypal/express/facade.py" in get_paypal_url
  82.                    paypal_params=paypal_params)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/paypal/express/gateway.py" in set_txn
  328.     txn = _fetch_response(SET_EXPRESS_CHECKOUT, params)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/paypal/express/gateway.py" in _fetch_response
  103.     txn.save()
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/paypal/express/models.py" in save
  34.         return super(ExpressTransaction, self).save(*args, **kwargs)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/models/base.py" in save
  545.                        force_update=force_update, update_fields=update_fields)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  573.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/models/base.py" in _save_table
  654.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/models/base.py" in _do_insert
  687.                                using=using, raw=raw)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/models/manager.py" in _insert
  232.         return insert_query(self.model, objs, fields, **kwargs)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/models/query.py" in insert_query
  1511.     return query.get_compiler(using=using).execute_sql(return_id)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  903.             cursor.execute(sql, params)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  69.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  99.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/Users/nateaune/.virtualenvs/smallslivestore/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py" in execute
  451.         return Database.Cursor.execute(self, query, params)

Exception Type: OperationalError at /checkout/paypal/payment/
Exception Value: no such table: paypal_expresstransaction

order.user is null upon reauthenticating and 'place order' page

original post https://groups.google.com/forum/#!topic/django-oscar/_YOuXutSzBM

Problem:

A tester is reporting that on oscar paypal's preview order page (after directing back to my app from paypal), if he idle for some time (~5mins) on that page without clicking on 'confirm order', session is expired and hey got redirected to the authentication page, and upon authentication, although order is successfully placed, order.user is null. (Note that OSCAR_ALLOW_ANON_CHECKOUT)

This is tested on the actual paypal payment gateway but should also happens on the sandbox.

how to transition from sandbox to live

In the documentation, there are instructions for hooking into the Paypal Sandbox apis. The only mention of transitioning to a live environment is setting the boolean setting PAYPAL_SANDBOX_MODE to False.

When I change this setting to False, I get an error returned from paypal:
ERROR Error 10002 - Security header is not valid

Do I have to change my credential settings when going live as well?

I can't seem to find any other password / username / signature settings on the Paypal developer site. Should my app be using the classic apis or the REST paypal api?

Purchasing from Hong Kong

Hong Kong has no postal codes, so when Django Oscar Paypal calls back into Oscar from a purchase made by a Hong Kong user, I get this error.

Internal Server Error: /checkout/paypal/place-order/490/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/oscar/apps/checkout/session.py", line 68, in dispatch
    request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/paypal/express/views.py", line 281, in post
    return self.submit(**submission)
  File "/usr/local/lib/python2.7/dist-packages/oscar/apps/checkout/views.py", line 632, in submit
    shipping_charge, billing_address, order_total, **order_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/oscar/apps/checkout/mixins.py", line 113, in handle_order_placement
    billing_address=billing_address, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/oscar/apps/checkout/mixins.py", line 125, in place_order
    shipping_address = self.create_shipping_address(user, shipping_address)
  File "/usr/local/lib/python2.7/dist-packages/oscar/apps/checkout/mixins.py", line 161, in create_shipping_address
    shipping_address.save()
  File "/usr/local/lib/python2.7/dist-packages/oscar/apps/address/abstract_models.py", line 250, in save
    super(AbstractAddress, self).save(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 589, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 617, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 698, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 731, in _do_insert
    using=using, raw=raw)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 921, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 920, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 134, in execute
    six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 129, in execute
    return self.cursor.execute(query, args)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
IntegrityError: (1048, "Column 'postcode' cannot be null")

Save user addresses in success view

We don't save user addresses at the moment when processing the response from PayPal during the success callback. We should probably change this.

Discrepancy with application.urls

I'm using Oscar Commerce 0.7.1 and django-oscar-paypal 0.9, and when I follow the instructions here:

http://django-oscar.readthedocs.org/en/latest/internals/getting_started.html#urls

It says to import application from oscar.app:

from oscar.app import application

urlpatterns = [
    ...
    url(r'', include(application.urls))
]

But the django-oscar-paypal also imports application, as instructed here:
http://django-oscar-paypal.readthedocs.org/en/latest/express.html#getting-started

...

from paypal.express.dashboard.app import application

urlpatterns = patterns('',
    (r'^admin/', include(admin.site.urls)),
    (r'^checkout/paypal/', include('paypal.express.urls')),
    # Optional
    (r'^dashboard/paypal/express/', include(application.urls)),
    (r'', include(shop.urls)),

If I remove the line (r'^dashboard/paypal/express/', include(application.urls)), then the site works but when I get to the payment details page it says that it hasn't been implemented yet, and the PayPal section doesn't appear in the dashboard.

If I remove from oscar.app import application, then I get an 404 page not found error.

Is there an example Oscar Commerce site that has successfully implemented PayPal that I can take a look at to compare it with what I have?

PayPal Express redirect fails when using DeferredTax mixin

The following error occurs when clicking the PayPal icon at the payment step of the checkout process when using the DeferredTax mixin:

Can't calculate price.incl_tax as tax isn't known
Request Method: GET
Request URL:    http://127.0.0.1:5000/checkout/paypal/payment/
Django Version: 1.7.7
Exception Type: TaxNotKnown
Exception Value:    Can't calculate price.incl_tax as tax isn't known

Bearing in mind this is the first time I've used Oscar, the problem appears to be that the PayPal Express RedirectView uses the basket in the request object rather than the basket after it has had tax applied by the the overridden build_submission() method in CheckoutSessionMixin.

The solution that works in my scenario is to call build_submission() directly to get the basket with deferred taxes calculated.

Old code:

class RedirectView(CheckoutSessionMixin, RedirectView):
    ....
    def get_redirect_url(self, **kwargs):
        try:
            basket = self.request.basket
            url = self._get_redirect_url(basket, **kwargs)
        except PayPalError:
        ....

Patched code:

class RedirectView(CheckoutSessionMixin, RedirectView):
    ....
    def get_redirect_url(self, **kwargs):
        try:
            basket = self.build_submission()['basket']
            url = self._get_redirect_url(basket, **kwargs)
        except PayPalError:
        ....

Signature of Repository.get_shipping_methods

Line 447 of paypal/express/views.py calls repo.get_shipping_methods with the signature:

def get_shipping_methods(self, user, basket, shipping_address):
    repo = Repository()
    return repo.get_shipping_methods(
        user, basket, shipping_addr=shipping_address)

But in oscar/apps/shipping/repository.py it's given as:

# API
def get_shipping_methods(self, basket, shipping_addr=None, **kwargs):

ie with no "user" argument. I'm not sure which is correct?

Ignoring local currency

From mailing list:

I am having a silly problem. I was testing checkout using PayPal but when I go to Sandbox Site, I see the currecy was altered, like I am trying Chinese currency 'CNY', but in paypal sandbox it shows GBP. screen shot here:
Checkout snap:

checkout

PayPal sandbox image:

PayPal

Configuration settings :

PAYPAL_PAYFLOW_CURRENCY = 'CNY'
PAYPAL_PAYFLOW_DASHBOARD_FORMS = True

PAYPAL_SANDBOX_MODE = True
PAYPAL_API_VERSION = '109.0'

#Oscar default currency
OSCAR_DEFAULT_CURRENCY='CNY'

Paypal ExpressCheckout fails with multiple shipping methods

If there are multiple shipping methods for an order, express checkout fails when trying to SetExpressCheckout since the total (PAYMENTREQUEST_0_AMT) doesn't add up a shipping method but it specifies one (PAYMENTREQUEST_0_SHIPPINGAMT) on the default shipping method.

I don't know if this solution is ok, but has made it work.

on paypal/express/gateway.py
if is_default:
params['PAYMENTREQUEST_0_SHIPPINGAMT'] = _format_currency(charge)
+++ params['PAYMENTREQUEST_0_AMT'] += charge

Reference Transaction asking for a ACCT

Attempting to execute a reference transaction results in the following error: RuntimeError: A ACCT parameter must be supplied for a S transaction This happens because the constraints demand an ACCT value for any sale code transaction, even though reference transactions don't require a credit card number.

order_paymentevent.reference may not be NULL

  1. add item to cart
  2. checkout
  3. click continue bottom left (not paypal at bottom left)
  4. click express icon
  5. login with sandbox as buyer
  6. confirm purchase
  7. return to oscar sandbox, place order page
  8. click place order
  9. witness failure page citing :
Environment:


Request Method: POST
Request URL: http://nova.local:8000/checkout/paypal/place-order/

Django Version: 1.4.5
Python Version: 2.7.4
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'django.contrib.flatpages',
 'django.contrib.staticfiles',
 'django_extensions',
 'debug_toolbar',
 'cache_panel',
 'template_timings_panel',
 'south',
 'rosetta',
 'oscar',
 'oscar.apps.analytics',
 'oscar.apps.order',
 'oscar.apps.checkout',
 'oscar.apps.shipping',
 'oscar.apps.catalogue',
 'oscar.apps.catalogue.reviews',
 'oscar.apps.basket',
 'oscar.apps.payment',
 'oscar.apps.offer',
 'oscar.apps.address',
 'oscar.apps.partner',
 'oscar.apps.customer',
 'oscar.apps.promotions',
 'oscar.apps.search',
 'oscar.apps.voucher',
 'oscar.apps.dashboard',
 'oscar.apps.dashboard.reports',
 'oscar.apps.dashboard.users',
 'oscar.apps.dashboard.orders',
 'oscar.apps.dashboard.promotions',
 'oscar.apps.dashboard.catalogue',
 'oscar.apps.dashboard.offers',
 'oscar.apps.dashboard.partners',
 'oscar.apps.dashboard.ranges',
 'oscar.apps.dashboard.vouchers',
 'oscar.apps.dashboard.communications',
 'haystack',
 'treebeard',
 'sorl.thumbnail',
 'compressor',
 'paypal',
 'apps.shipping',
 'apps.checkout',
 'apps.user']
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.transaction.TransactionMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'oscar.apps.basket.middleware.BasketMiddleware')


Traceback:
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  48.             return self.dispatch(request, *args, **kwargs)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/oscar/apps/checkout/session.py" in dispatch
  24.         return super(CheckoutSessionMixin, self).dispatch(request, *args, **kwargs)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  69.         return handler(request, *args, **kwargs)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/paypal/express/views.py" in post
  146.         return self.submit(request.basket, order_kwargs=order_kwargs)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/oscar/apps/checkout/views.py" in submit
  554.                 **order_kwargs)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/oscar/apps/checkout/mixins.py" in handle_order_placement
  57.             total_excl_tax, user, **kwargs)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/oscar/apps/checkout/mixins.py" in place_order
  144.         self.save_payment_details(order)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/oscar/apps/checkout/mixins.py" in save_payment_details
  263.         self.save_payment_events(order)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/oscar/apps/checkout/mixins.py" in save_payment_events
  274.             event.save()
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/db/models/base.py" in save
  463.         self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  551.                 result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/db/models/manager.py" in _insert
  203.         return insert_query(self.model, objs, fields, **kwargs)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/db/models/query.py" in insert_query
  1593.     return query.get_compiler(using=using).execute_sql(return_id)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  912.             cursor.execute(sql, params)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  40.             return self.cursor.execute(sql, params)
File "<VALID_VIRTUALENV>/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py" in execute
  344.             return Database.Cursor.execute(self, query, params)

Exception Type: IntegrityError at /checkout/paypal/place-order/
Exception Value: order_paymentevent.reference may not be NULL

Add support for recurring payments

In PayPal Express, you can create recurring billing profiles, which is something we should support.

Tasks:

  • Extend the SetExpressCheckout call to allow recurring billing params
  • Create a gateway function for CreateRecurringPaymentsProfile
  • Create a gateway function for SetCustomerBillingAgreement.
  • Create a gateway function for ManageRecurringPaymentsProfileStatus

Cancelling from PayPal loses basket

The thawing in the cancel view isn't working, possibly due as the basket middleware runs first. This happens when using PayPal as a payment method only - it may happen from the basket page route too.

Reload correct page when Paypal errors

Relocated from django-oscar/django-oscar#1651

When Paypal returns an error placing order (i.e. incorrect credit card) PaymentDetails view raises UnableToTakePayment. It redirects to "render_payment_details" to introduce again payment details.
When checking out with paypal from basket this makes no sense.
Redirecting to basket with the error might be a solution but I don't know if it fits all scenarios.

Wrong parameters passed to Applicator with Oscar 1.1

In the recent Oscar version 1.1, Applicator expects next parameters - basket, user, request:

class Applicator(object):

    def apply(self, basket, user=None, request=None):

Per https://github.com/django-oscar/django-oscar/blob/master/src/oscar/apps/offer/applicator.py#L19.
However, Applicator in django-oscar-paypal sends:

# Re-apply any offers
        Applicator().apply(basket, self.request.user, self.request)

Per https://github.com/sasha0/django-oscar-paypal/blob/master/paypal/express/views.py#L228

PayPal Payments Standard support

I'd like to know if there are any plans to add support to PayPal Payments Standard (previously known as Website Payments Standard): the "normal" paypal system where you just post a form to paypal and then receive confirmation via an "ipn" (Instant Payment Notification), different from the paypal express checkout.

Paypal email recipt has no description and always Qty 1.

Whatever I buy from my Oscar shop, the email receipt that Paypal sends (both the customer and the merchant) has Qty 1 and no item descriptions, whatever I buy.

I wonder if this is because Paypal recommend that you send the same set of parameters for DoExpressCheckout as they list for SetExpressCheckout? At the moment, Django-oscar-paypal only sends a small set.

https://developer.paypal.com/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_NVP/

The example below is the email that Paypal sends when I make a purchase of two things costing 49p.


Dear NAME,

You sent a payment of £0.98 GBP to Steve Bradshaw's Test Store.

It may take a few moments for this transaction to appear in your account.


Merchant:
Steve Bradshaw's Test Store
[email protected]

Instructions to merchant:
You haven't entered any instructions.


Purchase Details

Description: , No shipping required:
Unit price: 0.98 GBP
Qty: 1
Amount: 0.98 GBP

Subtotal: 0.98 GBP
Postage and packaging£0.00 GBP
Insurance£0.00 GBP

Insurance£0.00 GBP

Total: 0.98 GBP

Payment: 0.98 GBP
Payment sent to: [email protected]


Better integration with PayPal's address validation

When trying to checkout with a US address leaving the 'state' field empty (not marked as required), I get:

An error occurred communicating with PayPal

After adding the logger:

    'paypal.express': {
        'handlers': ['console', 'file'],
        'propagate': True,
        'level': 'DEBUG',
    },

I can see paypal returning errors like:

The field Shipping Address State is required

or

A match of the Shipping Address City, State, and Postal Code failed.

Could we display those error messages while redirecting to the address input page?

Documentation: sandbox buyer/seller account

http://django-oscar-paypal.readthedocs.org/en/latest/express.html#getting-started

You need to create a PayPal sandbox account which is different from your normal paypal account then use this account to create two ‘test’ users: a buyer and a seller. Once the seller is created, you will have access to a username, password and ‘signature’ which are used to authenticate API requests.

Add the following settings using the details from your sandbox buyer account:

...shouldn't that last line say "from your sandbox seller account" ?

Payments are only authorized, not processed (sandbox, Express Checkout)

I've set up Express Checkout with this and made an order against my sandbox account

If I log in to the seller's sandbox account their paypal.com dashboard shows the payments as 'unclaimed' and has a button to 'Accept' the payment

I don't want to have to do this.

It seems like this is the Sale/Authorization/Order thing... but I don't understand as the django-oscar-paypal code all appears to default to Sale which seems to be what I want. It looks like I'm getting Authorization instead

Any ideas?

Replace U.S. State freeform text field with dropdown list

I was using the sandbox site that ships with django-oscar-paypal, and when I clicked on the PayPal Express button on the payment details page, I was getting the message
"An error occurred communicating with PayPal"

I looked in the log and saw this error (note: i've replaced the sensitive values with 'xxxxx')

DEBUG 2014-05-09 15:25:42,868 gateway 48455 4551610368 Making SetExpressCheckout request to https://api-3t.sandbox.paypal.com/nvp with params:
L_PAYMENTREQUEST_0_QTY0: 1
MAXAMT: 30.00
L_PAYMENTREQUEST_0_DESC0: test CD
REQCONFIRMSHIPPING: 0
SHIPTOCITY: Somerville
SHIPTONAME: Nate Aune
USER: smallslive+seller_api1.appsembler.com
SIGNATURE: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SHIPTOCOUNTRYCODE: US
EMAIL: [email protected]
SHIPTOZIP: 02144
ALLOWNOTE: 1
SHIPTOSTREET: 55 Franklin St. #2
CALLBACKTIMEOUT: 3
PAYMENTREQUEST_0_AMT: 30.00
PAYMENTREQUEST_0_HANDLINGAMT: 0.00
PAYMENTREQUEST_0_TAXAMT: 0.00
METHOD: SetExpressCheckout
PAYMENTREQUEST_0_ITEMAMT: 20.00
RETURNURL: http://localhost:8000/en-us/checkout/paypal/preview/1/
L_PAYMENTREQUEST_0_NAME0: Peter Bernstein
PAYMENTREQUEST_0_CURRENCYCODE: USD
VERSION: 88.0
PAYMENTREQUEST_0_MAXAMT: 30.00
L_PAYMENTREQUEST_0_AMT0: 20.00
SHIPTOSTREET2: 
L_PAYMENTREQUEST_0_NUMBER0: 1234567
SHIPTOSTATE: Massachusetts
PWD: xxxxxxxxxxxx
PAYMENTREQUEST_0_PAYMENTACTION: Sale
PAYMENTREQUEST_0_SHIPPINGAMT: 10.00
CANCELURL: http://localhost:8000/en-us/checkout/paypal/cancel/1/
ADDROVERRIDE: 1
DEBUG 2014-05-09 15:25:44,957 gateway 48455 4551610368 Response with params:
ACK: Failure
BUILD: 10952652
CORRELATIONID: 6e8c1e2c7d1d
L_ERRORCODE0: 10736
L_LONGMESSAGE0: A match of the Shipping Address City, State, and Postal Code failed.
L_SEVERITYCODE0: Error
L_SHORTMESSAGE0: Shipping Address Invalid City State Postal Code
TIMESTAMP: 2014-05-09T19:25:45Z
VERSION: 88.0
ERROR 2014-05-09 15:25:44,984 gateway 48455 4551610368 Error 10736 - A match of the Shipping Address City, State, and Postal Code failed.

Once I put in the form for the State field "MA" instead of "Massachusetts", then PayPal accepted the transaction and didn't report an error.

So I think it would be best to modify the payment details form to have a dropdown field instead of a freeform text field for the US State, to avoid this error if the user inadvertently types in the full state name, rather than the two letter abbreviation.

Unable to use PayPal Express (HEAD) with OrderAndItemCharges shipping method

AttributeError at /checkout/paypal/redirect/
'OrderAndItemCharges' object has no attribute 'basket_charge_incl_tax'

Request Method: GET
Request URL: http://localhost/checkout/paypal/redirect/
Django Version: 1.6.1
Exception Type: AttributeError
Exception Value:
'OrderAndItemCharges' object has no attribute 'basket_charge_incl_tax'
Exception Location: /usr/local/lib/python2.6/dist-packages/paypal/express/gateway.py in set_txn, line 294
Python Executable: /usr/bin/python
Python Version: 2.6.6

django-oscar-paypal change currency to Turkish lira

It is supported by paypal but only for turkish paypal accounts I think. When I added paypal_currency = 'TRY' in settings.

I'm taking these errors ;

10605 Currency is not supported
99998 Currency is not supported
So, How should I convert normal currency of paypal to TRY

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.