# -*- coding: utf-8 -*-
""" This object's purpose is to expose an API to the shop system. Ideally, shops (Django shop or others) should implement this API, so that shipping plugins are interchangeable between systems.
This implementation is the interface reference for Django Shop
Methods defined in BaseBackendAPI: getOrder(request): Return the Order object for the current shopper """
""" Add shipping costs to the given order, with the given label (text), and for the given value. Please not that the value *should* be negative (it's a cost). """ # Check if we already have one shipping cost entry is_shipping=True)
# Tweak the total (since the value might have changed)
# Update the existing fields
# Re-add the shipping costs to the total
else: # In this case, there was no shipping cost already associated with # the order - let's simply create a new one (theat should be the # default case) label=label, value=value, is_shipping=True)
""" A helper for backends, so that they can call this when their job is finished i.e. shipping costs are added to the order. This will redirect to the "select a payment method" page. """ payment_selection.send(self, order=order) # Emit the signal to say we're now selecting payment return redirect('checkout_payment') |