onepercentclub/bluebottle — pull request #1032 by aethemba (2014-09-25 15:05:56+00:00)
Title: Feature/book 766

This PR filters the payment methods based on country.

The PAYMENT_METHODS dictionary in the Booking settings file contains a field 'restricted_countries'. If this key is specified in the payment method a user's IP address must match a country in that list.

To determine the IP address of the user we first grap the ip address via the request using the library django-ipware. Next, we run the IP address through a geoIP database with the pygeoip library.

If the IP address is 127.0.0.1 its assumed that we are in a dev environment and all payment methods are allowed.

The setup.py file contains the two new requirements.

There is a corresponding PR in Booking that updates the payment method settings.