django-giropay
is a lightweight django plugin which provides the integration of the payment service giropay.
There are just two steps needed to install django-giropay:
-
Install django-giropay to your virtual env:
pip install django-giropay
-
Configure your django installation with the following lines:
# django-giropay INSTALLED_APPS += ('django_giropay', ) GIROPAY = True GIROPAY_ROOT_URL = 'http://example.com' # Those are dummy test data - change to your data GIROPAY_MERCHANT_ID = "from-payment-provider" GIROPAY_PROJECT_ID = "from-payment-provider" GIROPAY_PROJECT_PASSWORD = b"from-payment-provider"
There is a list of other settings you could set down below.
-
Include the notification View in your URLs:
# urls.py from django.conf.urls import include, url urlpatterns = [ url('^giropay/', include('django_giropay.urls')), ]
- An merchant account for Giropay
- Django >= 1.11
from django_giropay.wrappers import GiropayWrapper
giropay_wrapper = GiropayWrapper()
giropay_transaction = giropay_wrapper.start_transaction(
merchant_tx_id='first-test',
amount=1000, # 10 Euro
purpose='first test'
)
You may want to customize django-giropay to fit your needs.
The first and most straight forward way to customize it, is to adjust the settings.
… to be done …
There are a few methods in the NotificationView you may want to override to match your system.
class MyNotifyGiropayView(NotifyGiropayView):
# For all checkouts you want to customize the status callback method
def handle_updated_transaction(self, giropay_transaction, expected_statuses=django_giropay_settings.GIROPAY_VALID_TRANSACTION_STATUSES):
# Be sure to check whether the giropay status is in a valid status
if giropay_transaction.result_payment not in expected_statuses:
logger.error(
_("GiroPay Result faulty: {}").format(RESULT_PAYMENT_STATUS[giropay_transaction.result_payment] if giropay_transaction.result_payment in RESULT_PAYMENT_STATUS else giropay_transaction.result_payment)
)
# do whateveer you want here
return HttpResponse(status=400)
# or do whateveer you want
return HttpResponse(status=200)
There is no sandbox/production switch at Giropay.
Copyright 2018 Particulate Solutions GmbH, under MIT license.