# 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
    for key, state in new_states.items():
        _update_payment_method_state(request, key, state)


def update_payment_method_state(order, request, method_key, state):
    _update_payment_method_state(request, method_key, state)
    _update_order_status(order, request)


def set_payment_method_states(order, request, states):
    clear_payment_method_states(request)
    for method_key, state in states.items():
        _update_payment_method_state(request, method_key, state)
    _update_order_status(order, request)


def mark_payment_method_completed(order, request, method_key, amount, source_id=None):
    update_payment_method_state(
        order, request, method_key, Complete(amount, source_id=source_id)
    )


def mark_payment_method_declined(order, request, method_key, amount, source_id=None):
    update_payment_method_state(
        order, request, method_key, Declined(amount, source_id=source_id)
    )


def mark_payment_method_consumed(order, request, method_key, amount, source_id=None):
    update_payment_method_state(

# 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

    for key, state in new_states.items():
        _update_payment_method_state(request, key, state)


def update_payment_method_state(order, request, method_key, state):
    _update_payment_method_state(request, method_key, state)
    _update_order_status(order, request)


def set_payment_method_states(order, request, states):
    clear_payment_method_states(request)
    for method_key, state in states.items():
        _update_payment_method_state(request, method_key, state)
    _update_order_status(order, request)


def mark_payment_method_completed(order, request, method_key, amount, source_id=None):
    update_payment_method_state(
        order, request, method_key, Complete(amount, source_id=source_id)
    )


def mark_payment_method_declined(order, request, method_key, amount, source_id=None):
    update_payment_method_state(
        order, request, method_key, Declined(amount, source_id=source_id)
    )


def mark_payment_method_consumed(order, request, method_key, amount, source_id=None):
    update_payment_method_state(

        order, request, method_key, Consumed(amount, source_id=source_id)