Giter Site home page Giter Site logo

mamona's Introduction

Mamona

Fully portable Django payments application

Mamona is a Django application for handling online payments. It can work with any existing setup without a need of changing other applications' models.

Features:
  • accepts any model as order and creates ForeignKey relation to it,
  • requires no interface on order model,
  • can handle different payment gateways, just by enabling backends (at the moment, only PayPal and testing "dummy" backends are present),
  • can pass items list and customer data to the payment gateway,
  • offers signals to watch payment progress.

Any model as order, really?

Yes, thanks to great AbstractMixin we can attach Payment model to any other model, which represents an order, single item, subscription plan, donation... whatever. We're not using generic relations here, but good old ForeignKey which makes your data consistent on DB level.

There are no interface requirements regarding the order model (it doesn't need to be called order, either). The only thing you have to do, is to implement basic set of signal listeners which extract essential data from your order.

These signals can reside in a standalone application, so there is no need to touch the code of the app containing order model.

OK, tell me how to use it!

First of all, you have to install Mamona and add it to your settings.py file.

Second, you should enable the backends in settings.py and configure essential parameters for gateways. The following example is for testing purposes, using PayPal sandbox server and a test module called dummy.

MAMONA_ACTIVE_BACKENDS = (
    'dummy',
    'paypal',
)
MAMONA_BACKENDS_SETTINGS = {
    'paypal': {
        'url': 'https://www.sandbox.paypal.com/cgi-bin/webscr',
        'email': '[email protected]',
    },
}

Third, knowing how your order model and it's environment is organized, you need to implement listeners for two signals:

  • return_urls_query, where you provide return URLs for successful and failed payments.
  • order_items_query, where you fill a list of order items (or just return single item for simple orders).

Finally, build a Payment model connected together with your order model:

from mamona.models import build_payment_model

Payment = build_payment_model(MyOrderModel, unique=True, related_name='payments')

To check an example implementation, see test-project/. And also refer to the source code of Mamona itself.

mamona's People

Contributors

emesik avatar tbarbugli avatar

Watchers

Aleksey Negodyaev 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.