summaryrefslogtreecommitdiffstats
path: root/combo/apps/lingo/urls.py
blob: eede96a02fc38ca18b83bf43c63d8e02845d4be1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# lingo - basket and payment system
# Copyright (C) 2015  Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from django.conf.urls import url, include

from combo.urls_utils import decorated_includes, manager_required

from .views import (RegiesApiView, AddBasketItemApiView, PayView, CallbackView,
                    ReturnView, ItemDownloadView, ItemView, CancelItemView,
                    RemoveBasketItemApiView, ValidateTransactionApiView,
                    CancelTransactionApiView, SelfInvoiceView, BasketItemPayView)
from .manager_views import (RegieListView, RegieCreateView, RegieUpdateView,
        RegieDeleteView, TransactionListView, download_transactions_csv)

lingo_manager_urls = [
    url('^$', TransactionListView.as_view(), name='lingo-manager-homepage'),
    url('^transactions/download-csv/$', download_transactions_csv, name='lingo-manager-transactions-download'),
    url('^regies/$', RegieListView.as_view(), name='lingo-manager-regie-list'),
    url('^regies/add/$', RegieCreateView.as_view(), name='lingo-manager-regie-add'),
    url(r'^regies/(?P<pk>\w+)/edit$', RegieUpdateView.as_view(),
        name='lingo-manager-regie-edit'),
    url(r'^regies/(?P<pk>\w+)/delete$', RegieDeleteView.as_view(),
        name='lingo-manager-regie-delete'),
]

urlpatterns = [
    url('^api/lingo/regies$', RegiesApiView.as_view(), name='api-regies'),
    url('^api/lingo/add-basket-item$', AddBasketItemApiView.as_view(),
        name='api-add-basket-item'),
    url('^api/lingo/remove-basket-item$', RemoveBasketItemApiView.as_view(),
        name='api-remove-basket-item'),
    url('^api/lingo/validate-transaction$', ValidateTransactionApiView.as_view(),
        name='api-validate-transaction'),
    url('^api/lingo/cancel-transaction$', CancelTransactionApiView.as_view(),
        name='api-cancel-transaction'),
    url(r'^lingo/pay$', PayView.as_view(), name='lingo-pay'),
    url(r'^lingo/cancel/(?P<pk>\w+)/$', CancelItemView.as_view(), name='lingo-cancel-item'),
    url(r'^lingo/callback/(?P<regie_pk>\w+)/$', CallbackView.as_view(), name='lingo-callback'),
    url(r'^lingo/return/(?P<regie_pk>\w+)/$', ReturnView.as_view(), name='lingo-return'),
    url(r'^manage/lingo/', decorated_includes(manager_required,
        include(lingo_manager_urls))),
    url(r'^lingo/item/(?P<regie_id>[\w,-]+)/(?P<item_crypto_id>[\w,-]+)/pdf$',
        ItemDownloadView.as_view(), name='download-item-pdf'),
    url(r'^lingo/item/(?P<regie_id>[\w,-]+)/(?P<item_crypto_id>[\w,-]+)/$',
        ItemView.as_view(), name='view-item'),
    url(r'^lingo/item/(?P<item_id>\d+)/pay$',
        BasketItemPayView.as_view(), name='basket-item-pay-view'),
    url(r'^lingo/self-invoice/(?P<cell_id>\w+)/$', SelfInvoiceView.as_view(),
        name='lingo-self-invoice'),
]