Git Product home page Git Product logo

django-sofortueberweisung's Introduction

django-sofortueberweisung Build Status

What do you need for django-sofortueberweisung?

  1. An account on sofort.com
  2. Django >= 1.8
  3. xmltodict >= 0.9.2

How to install django-sofortueberweisung?

There are just two steps needed to install django-sofortueberweisung:

  1. Install django-sofortueberweisung to your virtual env:

    pip install django-sofortueberweisung
  2. Configure your django installation with the following lines:

    # django-sofortueberweisung
    INSTALLED_APPS += ('django_sofortueberweisung', )
    
    SOFORT = True
    SOFORT_USER = '99999'
    SOFORT_API_KEY = 'a12b34cd567890123e456f7890123456'
    SOFORT_PROJECT_ID = '999999'
    SOFORT_SUCCESS_URL = 'https://www.example.com/'
    SOFORT_SUCCESS_REDIRECT = True
    SOFORT_ABORT_URL = 'https://www.example.com/abort/'
    SOFORT_TIMEOUT_URL = 'https://www.example.com/timeout/'
    SOFORT_NOTIFICATION_URLS = [{
        'url': 'https://www.example.com/sofortueberweisung/notify/',
        'notify_on': 'pending, loss'
    }, {
        'url': 'https://www.example.com/sofortueberweisung/notify/'
    }]
    SOFORT_NOTIFICATION_EMAILS = [{
        'email': '[email protected]',
        'notify_on': 'pending, loss'
    }, {
        'email': '[email protected]'
    }]
    SOFORT_CUSTOMER_PROTECTION = False
    SOFORT_LANGUAGE_CODE = None
    SOFORT_TIMEOUT = None
    SOFORT_VALID_TRANSACTION_STATUS = ['received', 'untraceable', 'pending']
  3. Use methods for initialization and updating transaction where you need it:

    Initialization:

    sofort_payment = SofortWrapper(auth={
                        'USER': settings.SOFORT_USER,
                        'API_KEY': settings.SOFORT_API_KEY,
                        'PROJECT_ID': settings.SOFORT_PROJECT_ID
                    })
    sofort_payment.init(amount=10.0)

    Include the notification View in your URLs:

    # urls.py
    from django.conf.urls import include, url
    
    urlpatterns = [
        url('^sofortueberweisung/', include('django_sofortueberweisung.urls')),
    ]

refunds

To initiate a refund, you need to pass an instance of SofortWrapper as first parameter, and sender_data as second. sender_data should be a dict containing keys for holder, iban and bic. Those are your own bank details, not the receiver's.

Refunds are sent with test data by default. To use the values passed for sender_data change SOFORT_REFUNDS_TEST inside your settings to False.

sofort_transaction = SofortTransaction.objects.get(transaction_id=<transaction_id>)
sofort_transaction.create_refund(sofort_wrapper, sender_data, <optional params>)

This will create and return an instance of SofortRefund if request has been successful. If errors have occurred, relations to SofortError are being created.

For more options, read the code and Sofort API documentation

django-sofortueberweisung's People

Contributors

shin-- avatar tech-particulate avatar ceata avatar codezeilen avatar

Watchers

 avatar

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.