Purchasing from Hong Kong
st8st8 opened this issue · 2 comments
st8st8 commented
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")
maiksprenger commented
Oscar has blank=True
set for postcodes, so it doesn't require them. My best guess is that instead of the empty string, django-oscar-paypal
passes None
for the postcode.
Either way, this is a bug and I'd happily accept a pull request for it.
maiksprenger commented