Skip to content

Django reusable app for integration with Admitad CPA via postback requests

License

Notifications You must be signed in to change notification settings

Picasel/django-admitad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-admitad

Build Status codecov Python versions Pypi

Django reusable app for integration with Admitad CPA via postback requests

Requirements

Installation

$ pip install django-admitad

Configuration

To enable django-admitad for your project you need to add admitad to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'admitad'
]

You also need to configure some Admitad CPA settings:

ADMITAD_COMPAIN_CODE = 'example_compain'
ADMITAD_POSTBACK_URL = 'https://ad.admitad.com/r'
ADMITAD_POSTBACK_KEY = 'example_postback_key'

Don't forget to run migrations:

$ python manage.py makemigrations
$ python manage.py migrate

Usage

To send a postback requests, you need to create an Order and Item objects:

from admitad.gateway import Order, Item

item = Item(internal_id=1, item_price=100, tariff_code=1, quantity=2)
order = Order(internal_id=1, admitad_uid='12345', action_code=1)

And add Item objects to Order:

order.add_item(item)

Items can also be directly transferred to the order:

items = [Item(internal_id=1, item_price=100, tariff_code=1, quantity=2)]
order = Order(internal_id=1, admitad_uid='12345', action_code=1, items=items)

And finally send postback requests

order.send_postback_requests()

All sent requests and parameters are saved to the database and are accessible from the admin test

Changelog

Available here

TODO

  • Celery integration
  • Integration tests & test coverage (>90%)
  • Support for old versions of Python/Django

License

MIT

About

Django reusable app for integration with Admitad CPA via postback requests

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages