Пример #1
0
 def test_get_context_gives_correct_order(self):
     view = ThankYouView(request=self.request)
     self.assertNotEqual(view, None)
     res = view.get_context_data()
     self.assertNotEqual(res, None)
     # refresh self.order from db (it was saved in the view)
     self.order = Order.objects.get(pk=self.order.pk)
     self.assertEqual(self.order.status, Order.COMPLETED)
     ctx_order = res.get('order', None)
     self.assertNotEqual(ctx_order, None)
     self.assertEqual(ctx_order, self.order)
Пример #2
0
 def test_get_context_gives_correct_order(self):
     # first send the order through the payment API
     PaymentAPI().confirm_payment(self.order, 10, 'None', 'magic payment')
     # then call the view
     view = ThankYouView(request=self.request)
     self.assertNotEqual(view, None)
     res = view.get_context_data()
     self.assertNotEqual(res, None)
     # refresh self.order from db (it was saved in the view)
     self.order = Order.objects.get(pk=self.order.pk)
     self.assertEqual(self.order.status, Order.COMPLETED)
     ctx_order = res.get('order', None)
     self.assertNotEqual(ctx_order, None)
     self.assertEqual(ctx_order, self.order)
Пример #3
0
    url(
        r'^checkout/ship/$',
        ShippingBackendRedirectView.as_view(),
        name='checkout_shipping'  # First step of the checkout process
    ),
    #url(r'^checkout/pay/$', SelectPaymentView.as_view(),
    #    name='checkout_payment' # Second step of the checkout process
    #    ),
    url(
        r'^checkout/pay/$',
        PaymentBackendRedirectView.as_view(),
        name='checkout_payment'  # First step of the checkout process
    ),
    url(
        r'^checkout/thank_you/$',
        ThankYouView.as_view(),
        name='thank_you_for_your_order'  # Second step of the checkout process
    ),
    # Products
    url(r'^products/$',
        ShopListView.as_view(model=Product),
        name='product_list'),
    url(r'^products/(?P<slug>[0-9A-Za-z-_.//]+)/$',
        ProductDetailView.as_view(),
        name='product_detail'),

    # Orders
    url(r'^orders/$', OrderListView.as_view(), name='order_list'),
    url(r'^orders/(?P<pk>\d+)/$',
        OrderDetailView.as_view(),
        name='order_detail'),
Пример #4
0
    url(r'^checkout/$', CheckoutSelectionView.as_view(), 
        name='checkout_selection' # First step of the checkout process
        ),
    #url(r'^checkout/ship/$', SelectShippingView.as_view(), 
    #    name='checkout_shipping' # First step of the checkout process
    #    ),
    url(r'^checkout/ship/$', ShippingBackendRedirectView.as_view(), 
        name='checkout_shipping' # First step of the checkout process
        ),
    #url(r'^checkout/pay/$', SelectPaymentView.as_view(), 
    #    name='checkout_payment' # Second step of the checkout process
    #    ),
    url(r'^checkout/pay/$', PaymentBackendRedirectView.as_view(), 
        name='checkout_payment' # First step of the checkout process
        ),
    url(r'^checkout/thank_you/$', ThankYouView.as_view(), 
        name='thank_you_for_your_order' # Second step of the checkout process
        ),
    # Products
    url(r'^products/$',
        ShopListView.as_view(model=Product),
        name='product_list'
        ),
    url(r'^products/(?P<slug>[0-9A-Za-z-_.//]+)/$',
        ProductDetailView.as_view(),
        name='product_detail'
        ),

    # Orders
    url(r'^orders/$',
        OrderListView.as_view(),
Пример #5
0
from django.conf.urls import patterns, url
from shop.util.decorators import cart_required

from shop.views.checkout import (
    CheckoutSelectionView,
    PaymentBackendRedirectView,
    ShippingBackendRedirectView,
    OrderConfirmView,
    ThankYouView,
)

urlpatterns = patterns('',
    url(r'^$', cart_required(CheckoutSelectionView.as_view()),
        name='checkout_selection'  # first step of the checkout process
        ),
    url(r'^ship/$', ShippingBackendRedirectView.as_view(),
        name='checkout_shipping'  # second step of the checkout process
        ),
    url(r'^confirm/$', OrderConfirmView.as_view(),
        name='checkout_confirm'  # third step of the checkout process
        ),
    url(r'^pay/$', PaymentBackendRedirectView.as_view(),
        name='checkout_payment'  # fourth step of the checkout process
        ),
    url(r'^thank_you/$', ThankYouView.as_view(),
        name='thank_you_for_your_order'  # final step of the checkout process
        ),
    )
Пример #6
0
 ),
 # Checkout
 url(r'^checkout/$',
     MyCheckoutSelectionView.as_view(),
     name='checkout_selection'  # First step of the checkout process
 ),
 url(r'^checkout/ship/$',
     ShippingBackendRedirectView.as_view(),
     name='checkout_shipping'  # First step of the checkout process
 ),
 url(r'^checkout/pay/$',
     PaymentBackendRedirectView.as_view(),
     name='checkout_payment'  # First step of the checkout process
     ),
 url(r'^checkout/thank_you/$',
     ThankYouView.as_view(),
     name='thank_you_for_your_order'  # Second step of the checkout process
     ),
 # Orders
 url(r'^orders/$',
     OrderListView.as_view(),
     name='order_list'),
 url(r'^orders/(?P<pk>\d+)/$',
     OrderDetailView.as_view(),
     name='order_detail'),
 url(r'^catalog/$',
     ListView.as_view(
         model=CustomProduct,
         paginate_by=12
     ),
     name='product_list'
Пример #7
0
    ),
    # Checkout
    url(r'^checkout/$',
        MyCheckoutSelectionView.as_view(
            template_name="customshop/selection.html"
        ),
        name='checkout_selection' # First step of the checkout process
    ),
    url(r'^checkout/ship/$',
        ShippingBackendRedirectView.as_view(),
        name='checkout_shipping' # First step of the checkout process
    ),
    url(r'^checkout/pay/$',
        PaymentBackendRedirectView.as_view(),
        name='checkout_payment' # First step of the checkout process
    ),
    url(r'^checkout/thank_you/$',
        ThankYouView.as_view(template_name="customshop/thank_you.html"),
        name='thank_you_for_your_order' # Second step of the checkout process
    ),
    # Orders
    url(r'^orders/$',
        OrderListView.as_view(),
        name='order_list'
    ),
    url(r'^orders/(?P<pk>\d+)/$',
        OrderDetailView.as_view(),
        name='order_detail'
    ),
)
Пример #8
0
    url(r'^cart/$', CartDetails.as_view(), name='cart'), # GET
    url(r'^cart/update/$', CartDetails.as_view(action='put'), 
        name='cart_update'),

    # CartItems
    url('^cart/item/(?P<id>[0-9A-Za-z-_.//]+)$', CartItemDetail.as_view(),
        name='cart_item' ),
    
    # Checkout
    url(r'^checkout/ship/$', SelectShippingView.as_view(), 
        name='checkout_shipping' # First step of the checkout process
        ),
    url(r'^checkout/pay/$', SelectPaymentView.as_view(), 
        name='checkout_payment' # Second step of the checkout process
        ),
    url(r'^checkout/thank_you/$', ThankYouView.as_view(), 
        name='thank_you_for_your_order' # Second step of the checkout process
        ),
    # Products
    url(r'^products/$',
        ShopListView.as_view(model=Product),
        name='product_list'
        ),
    url(r'^products/(?P<slug>[0-9A-Za-z-_.//]+)/$',
        ProductDetailView.as_view(),
        name='product_detail'
        ),

    # Orders
    url(r'^orders/$',
        OrderListView.as_view(),
Пример #9
0
from shop.views.checkout import (
    # SelectPaymentView,
    # SelectShippingView,
    CheckoutSelectionView,
    PaymentBackendRedirectView,
    ShippingBackendRedirectView,
    ThankYouView,
)

urlpatterns = patterns('',
    url(r'^checkout/$', CheckoutSelectionView.as_view(),
        name='checkout_selection'  # First step of the checkout process
        ),
    #url(r'^checkout/ship/$', SelectShippingView.as_view(),
    #    name='checkout_shipping'  # First step of the checkout process
    #    ),
    url(r'^checkout/ship/$', ShippingBackendRedirectView.as_view(),
        name='checkout_shipping'  # First step of the checkout process
        ),
    #url(r'^checkout/pay/$', SelectPaymentView.as_view(),
    #    name='checkout_payment'  # Second step of the checkout process
    #    ),
    url(r'^checkout/pay/$', PaymentBackendRedirectView.as_view(),
        name='checkout_payment'  # First step of the checkout process
        ),
    url(r'^checkout/thank_you/$', csrf_exempt(ThankYouView.as_view()),
        name='thank_you_for_your_order'  # Second step of the checkout process
        ),
    )
Пример #10
0
urlpatterns = patterns(
    '',
    url(
        r'^checkout/$',
        CheckoutSelectionView.as_view(),
        name='checkout_selection'  # First step of the checkout process
    ),
    #url(r'^checkout/ship/$', SelectShippingView.as_view(),
    #    name='checkout_shipping'  # First step of the checkout process
    #    ),
    url(
        r'^checkout/ship/$',
        ShippingBackendRedirectView.as_view(),
        name='checkout_shipping'  # First step of the checkout process
    ),
    #url(r'^checkout/pay/$', SelectPaymentView.as_view(),
    #    name='checkout_payment'  # Second step of the checkout process
    #    ),
    url(
        r'^checkout/pay/$',
        PaymentBackendRedirectView.as_view(),
        name='checkout_payment'  # First step of the checkout process
    ),
    url(
        r'^checkout/thank_you/$',
        csrf_exempt(ThankYouView.as_view()),
        name='thank_you_for_your_order'  # Second step of the checkout process
    ),
)