This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Python library for implementing Omnikassa

Project Description

Omnikassa

Python library for implementing Omnikassa.

Generating payment request

from omnikassa import Omnikassa
from omnikassa.constants import Currency

settings = {
    'currencyCode': Currency.EURO,  # Default value, can be overriden per request
    'automaticResponseUrl': 'https://example.com/callback',
    'normalReturnUrl': 'https://example.com/omnikassa',
    'merchantId': '0123456789',
}
secret = 'secret key'  # set this to None to use test environment

omnikassa = Omnikassa(settings, secret)
data = omnikassa.generate_request({
    'transactionReference': 'transaction123',  # unique reference
    'amount': 456,  # in cents
    'orderId': 123,  # optional
})

data contains relevant info to create a form:

<form action="${url}" method="post" id="form">
    <input type="hidden" name="Seal" value="${seal}">
    <input type="hidden" name="InterfaceVersion" value="${version}">
    <input type="hidden" name="Data" value="${data}">
    <button type="submit">
        Start payment
    </button>
</form>

Handling return

from omnikassa import Omnikassa
from omnikassa.constants import Currency

settings = {
    'currencyCode': Currency.EURO,
    'automaticResponseUrl': 'https://example.com/callback',
    'normalReturnUrl': 'https://example.com/omnikassa',
    'merchantId': '0123456789',
}
secret = 'secret key'

omnikassa = Omnikassa(settings, secret)
try:
    data = omnikassa.verify_callback(request.POST)
except InvalidSeal:
    ...
except InvalidResponseCode as exc:
    # `exc.data` contains responseData
    ...

# `data` is a dict of validated omnikassa data
Release History

Release History

This version
History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
omnikassa-0.0.4.tar.gz (3.4 kB) Copy SHA256 Checksum SHA256 Source Oct 22, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting