Package: django-atol
Application for integrating Django andhttps://online.atol.ru/Important limitations:Python 3.5+Support Django 1.11+PostgreSQL ≥ 9.4 (JSONB field) (PostgreSQL ≥ 11 for Django 4.0)only 1 purchase is supported in receipt (1 product)only v3 protocol version is supportedQuick startAddatolto your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'atol',
]Addatolsettings like this:RECEIPTS_ATOL_LOGIN = 'login'
RECEIPTS_ATOL_PASSWORD = 'secret'
RECEIPTS_ATOL_GROUP_CODE = 'ATOL-ProdTest-1'
RECEIPTS_ATOL_TAX_NAME = 'vat18'
RECEIPTS_ATOL_TAX_SYSTEM = 'osn'
RECEIPTS_ATOL_INN = '112233445573'
RECEIPTS_ATOL_PAYMENT_METHOD = 'full_payment'
RECEIPTS_ATOL_PAYMENT_OBJECT = 'service'
RECEIPTS_ATOL_CALLBACK_URL = None
RECEIPTS_ATOL_PAYMENT_ADDRESS = 'www.<your_company>.ru'
RECEIPTS_ATOL_COMPANY_EMAIL = '<your_company>@gmail.com'
RECEIPTS_OFD_URL_TEMPLATE = u'https://lk.platformaofd.ru/web/noauth/cheque?fn={fn}&fp={fp}'Add celery-beat tasks to CELERYBEAT_SCHEDULE settings like this:CELERYBEAT_SCHEDULE = {
    ...
    'atol_retry_created_receipts': {
        'task': 'atol_retry_created_receipts',
        'schedule': crontab(minute=25)
    },
    'atol_retry_initiated_receipts': {
        'task': 'atol_retry_initiated_receipts',
        'schedule': crontab(minute=35)
    }
}Include theatolURLconf in your project urls.py like this:from atol.views import ReceiptView

url(r'^r/(?P<short_uuid>[\w]+)/$', ReceiptView.as_view(), name='receipt')Runpython manage.py migrate atolto create the receipt model.Add receipt field to your payment model:from atol.models import Receipt

receipt = models.OneToOneField(Receipt, verbose_name=_('Чек'), blank=True, null=True, on_delete=models.SET_NULL)Add the mechanics of calling a receipt creation after a successful payment. For example, this can be done through a signal that will be called upon successful payment:# <your_app>/signals.py

payment_accepted = Signal(providing_args=['payment'])

# <your_app>/providers/googleplay.py

def process_payment(payment)

    ...

    payment_accepted.send(sender='google-play', payment=payment)

# <your_app>/receivers.py

@receiver(payment_accepted)
@transaction.atomic
def init_payment_receipt(sender, payment, **kwargs):

    ...

    receipt = Receipt.objects.create(
        user_email=payment.user.email,
        purchase_price=payment.amount
    )
    payment.receipt = receipt
    payment.save(update_fields=['receipt'])
    transaction.on_commit(
        lambda: atol_create_receipt.apply_async(args=(receipt.id,), fallback_sync=True)
    )Run testspytestChangelog1.4.1 (2022-09-13)Fix JSONField module for django>=3.11.4.0 (2022-08-17)Add Django 4.0 supportAdd Python ≥ 3.7 and Django ≥ 3.0 CI testsUpgrade CI Linux dist to Ubuntu 18.04 (Bionic) for Python 3.10 testsUpgrade CI Postgres version to 11 for Django 4.x tests1.3.4 (2021-10-05)Fix bug with payment_method parameter1.3.3 (2021-06-28)Add task for sell_refund request1.3.2 (2020-08-17)Upgrade shortuuid 0.5.0 -> 1.0.11.3.1 (2018-12-19)Sell method: do not insert empty email or phone1.3.0 (2018-12-19)Support Atol protocol v4 (FFD 1.05)1.2.2 (2018-10-08)Change maximum retry counts for taskatol_receive_receipt_report. Now its awaiting report for 29 hours.Changedatol_retry_created_receiptsandatol_retry_initiated_receiptstasks retry period.
Now it will retry receipts from day before yesterday1.2.1 (2018-05-22)AtolAPI.base_url specifying in settings1.2.0 (2017-12-14)Support retried not processed receipt1.1.0 (2017-12-13)Django 2.0 support1.0.0 (2017-12-01)Initial release