# Path: src/oscarapicheckout/settings.py
# ORDER_STATUS_AUTHORIZED = overridable("ORDER_STATUS_AUTHORIZED", "Authorized")
# 
# ORDER_STATUS_PAYMENT_DECLINED = overridable(
#     "ORDER_STATUS_PAYMENT_DECLINED", "Payment Declined"
# )
# 
# Path: src/oscarapicheckout/signals.py

# 
# Path: src/oscarapicheckout/states.py
# COMPLETE = "Complete"
# 
# DECLINED = "Declined"
# 
# CONSUMED = "Consumed"
# 
# class Complete(SourceBoundPaymentStatus):
#     status = COMPLETE
# 
# class Declined(SourceBoundPaymentStatus):
#     status = DECLINED
# 
# class Consumed(SourceBoundPaymentStatus):
#     status = CONSUMED


from decimal import Decimal
from django.db.models import F
from django.utils.translation import gettext_lazy as _
from oscar.core.loading import get_class, get_model
from oscarapi.basket import operations
from .settings import ORDER_STATUS_AUTHORIZED, ORDER_STATUS_PAYMENT_DECLINED
from .signals import order_payment_declined, order_payment_authorized
from .states import COMPLETE, DECLINED, CONSUMED, Complete, Declined, Consumed
import pickle
import base64
    current_user = request.user
    if current_user and current_user.is_authenticated:
        return current_user, None
    return None, guest_email


class OrderUpdater(object):
    def update_order(
        self,
        order,
        basket,
        order_total,
        shipping_method,
        shipping_charge,
        user=None,
        shipping_address=None,
        billing_address=None,
        order_number=None,
        status=None,
        request=None,
        **kwargs
    ):
        """
        Similar to OrderCreator.place_order, except this updates an existing "Payment Declined" order instead
        of creating a new order.
        """
        if basket.is_empty:
            # Translators: Error message in checkout
            raise ValueError(_("Empty baskets cannot be submitted"))


# Path: src/oscarapicheckout/settings.py
# ORDER_STATUS_AUTHORIZED = overridable("ORDER_STATUS_AUTHORIZED", "Authorized")
# 
# ORDER_STATUS_PAYMENT_DECLINED = overridable(
#     "ORDER_STATUS_PAYMENT_DECLINED", "Payment Declined"
# )
# 
# Path: src/oscarapicheckout/signals.py

# 
# Path: src/oscarapicheckout/states.py
# COMPLETE = "Complete"
# 
# DECLINED = "Declined"
# 
# CONSUMED = "Consumed"
# 
# class Complete(SourceBoundPaymentStatus):
#     status = COMPLETE
# 
# class Declined(SourceBoundPaymentStatus):
#     status = DECLINED
# 
# class Consumed(SourceBoundPaymentStatus):
#     status = CONSUMED


# Path: src/oscarapicheckout/utils.py
from decimal import Decimal
from django.db.models import F
from django.utils.translation import gettext_lazy as _
from oscar.core.loading import get_class, get_model
from oscarapi.basket import operations
from .settings import ORDER_STATUS_AUTHORIZED, ORDER_STATUS_PAYMENT_DECLINED
from .signals import order_payment_declined, order_payment_authorized
from .states import COMPLETE, DECLINED, CONSUMED, Complete, Declined, Consumed
import pickle
import base64

    current_user = request.user
    if current_user and current_user.is_authenticated:
        return current_user, None
    return None, guest_email


class OrderUpdater(object):
    def update_order(
        self,
        order,
        basket,
        order_total,
        shipping_method,
        shipping_charge,
        user=None,
        shipping_address=None,
        billing_address=None,
        order_number=None,
        status=None,
        request=None,
        **kwargs
    ):
        """
        Similar to OrderCreator.place_order, except this updates an existing "Payment Declined" order instead
        of creating a new order.
        """
        if basket.is_empty:
            # Translators: Error message in checkout
            raise ValueError(_("Empty baskets cannot be submitted"))


        if order.status != ORDER_STATUS_PAYMENT_DECLINED: