128 lines
5.0 KiB
Python
128 lines
5.0 KiB
Python
# 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 include, url
|
|
|
|
from combo.urls_utils import decorated_includes, manager_required
|
|
|
|
from .manager_views import (
|
|
BasketItemErrorListView,
|
|
BasketItemMarkAsNotifiedView,
|
|
PaymentBackendCreateView,
|
|
PaymentBackendDeleteView,
|
|
PaymentBackendListView,
|
|
PaymentBackendUpdateView,
|
|
RegieCreateView,
|
|
RegieDeleteView,
|
|
RegieListView,
|
|
RegieUpdateView,
|
|
TransactionListView,
|
|
download_transactions_csv,
|
|
)
|
|
from .views import (
|
|
AddBasketItemApiView,
|
|
BasketItemPayView,
|
|
CallbackView,
|
|
CancelItemView,
|
|
CancelTransactionApiView,
|
|
ItemDownloadView,
|
|
ItemView,
|
|
PaymentStatusView,
|
|
PayView,
|
|
RegiesApiView,
|
|
RemoveBasketItemApiView,
|
|
ReturnView,
|
|
SelfInvoiceView,
|
|
TransactionStatusApiView,
|
|
ValidateTransactionApiView,
|
|
)
|
|
|
|
lingo_manager_urls = [
|
|
url('^$', TransactionListView.as_view(), name='lingo-manager-homepage'),
|
|
url('^payments/error/$', BasketItemErrorListView.as_view(), name='lingo-manager-payment-error-list'),
|
|
url(
|
|
r'^item/(?P<item_id>\d+)/mark-as-notified/$',
|
|
BasketItemMarkAsNotifiedView.as_view(),
|
|
name='lingo-manager-basket-item-mark-as-notified',
|
|
),
|
|
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'),
|
|
url('^paymentbackends/$', PaymentBackendListView.as_view(), name='lingo-manager-paymentbackend-list'),
|
|
url(
|
|
'^paymentbackends/add/$', PaymentBackendCreateView.as_view(), name='lingo-manager-paymentbackend-add'
|
|
),
|
|
url(
|
|
r'^paymentbackends/(?P<pk>\w+)/edit$',
|
|
PaymentBackendUpdateView.as_view(),
|
|
name='lingo-manager-paymentbackend-edit',
|
|
),
|
|
url(
|
|
r'^paymentbackends/(?P<pk>\w+)/delete$',
|
|
PaymentBackendDeleteView.as_view(),
|
|
name='lingo-manager-paymentbackend-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(
|
|
'^api/lingo/transaction-status/(?P<transaction_signature>.+)/$',
|
|
TransactionStatusApiView.as_view(),
|
|
name='api-transaction-status',
|
|
),
|
|
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/callback-payment-backend/(?P<payment_backend_pk>\w+)/$',
|
|
CallbackView.as_view(),
|
|
name='lingo-callback-payment-backend',
|
|
),
|
|
url(r'^lingo/return/(?P<regie_pk>\w+)/$', ReturnView.as_view(), name='lingo-return'),
|
|
url(
|
|
r'^lingo/return-payment-backend/(?P<payment_backend_pk>\w+)/(?P<transaction_signature>.+)/$',
|
|
ReturnView.as_view(),
|
|
name='lingo-return-payment-backend',
|
|
),
|
|
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_signature>.+)/pay$', BasketItemPayView.as_view(), name='basket-item-pay-view'),
|
|
url(r'^lingo/payment-status$', PaymentStatusView.as_view(), name='payment-status'),
|
|
url(r'^lingo/self-invoice/(?P<cell_id>\w+)/$', SelfInvoiceView.as_view(), name='lingo-self-invoice'),
|
|
]
|