def build_submission(self, **kwargs):
"""
Return a dict of data that contains everything required for an order
submission. This includes payment details (if any).
This can be the right place to perform tax lookups and apply them to
the basket.
"""
basket = kwargs.get('basket', self.request.basket)
shipping_address = self.get_shipping_address(basket)
shipping_method = self.get_shipping_method(
basket, shipping_address)
if not shipping_method:
total = None
else:
total = self.get_order_totals(
basket, shipping_method=shipping_method)
submission = {
'user': self.request.user,
'basket': basket,
'shipping_address': shipping_address,
'shipping_method': shipping_method,
'order_total': total,
'order_kwargs': {},
'payment_kwargs': {}}
# Allow overrides to be passed in
submission.update(kwargs)
# Set guest email after overrides as we need to update the order_kwargs
# entry.
if (not submission['user'].is_authenticated() and
'guest_email' not in submission['order_kwargs']):
email = self.checkout_session.get_guest_email()
submission['order_kwargs']['guest_email'] = email
return submission