# Path: src/cybersource/constants.py
# DECISION_REVIEW = "REVIEW"
# 
# DECISION_ACCEPT = "ACCEPT"


from unittest import skipUnless, mock
from decimal import Decimal as D
from django.conf import settings
from django.core import mail
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_random_string
from oscar.core.loading import get_model
from oscar.test import factories
from rest_framework import status
from rest_framework.test import APITestCase
from cybersource.models import CyberSourceReply
from ..constants import DECISION_REVIEW, DECISION_ACCEPT
from . import factories as cs_factories
import datetime
import uuid
        self.assertEqual(lines.count(), 1)
        line = lines[0]
        self.assertEqual(line.quantity, quantity)
        self.assertEqual(line.product_id, product_id)

        payment_events = order.payment_events.filter(event_type__name="Authorise")
        self.assertEqual(payment_events.count(), 1)
        self.assertEqual(payment_events[0].amount, order.total_incl_tax)

        payment_sources = order.sources.all()
        self.assertEqual(payment_sources.count(), 1)
        self.assertEqual(payment_sources[0].currency, order.currency)
        self.assertEqual(payment_sources[0].amount_allocated, order.total_incl_tax)
        self.assertEqual(payment_sources[0].amount_debited, D("0.00"))
        self.assertEqual(payment_sources[0].amount_refunded, D("0.00"))

        transactions = payment_sources[0].transactions.all()
        self.assertEqual(transactions.count(), 1)
        self.assertEqual(transactions[0].txn_type, "Authorise")
        self.assertEqual(transactions[0].amount, order.total_incl_tax)
        self.assertEqual(transactions[0].status, status)

        self.assertEqual(transactions[0].log.order, order)
        self.assertEqual(transactions[0].log.req_reference_number, order.number)
        self.assertEqual(transactions[0].token.card_last4, card_last4)
        self.assertEqual(transactions[0].token.log.order, order)
        self.assertEqual(transactions[0].token.log.req_reference_number, order.number)

        self.assertEqual(len(mail.outbox), 1)


# Path: src/cybersource/constants.py
# DECISION_REVIEW = "REVIEW"
# 
# DECISION_ACCEPT = "ACCEPT"


# Path: src/cybersource/tests/test_checkout.py
from unittest import skipUnless, mock
from decimal import Decimal as D
from django.conf import settings
from django.core import mail
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_random_string
from oscar.core.loading import get_model
from oscar.test import factories
from rest_framework import status
from rest_framework.test import APITestCase
from cybersource.models import CyberSourceReply
from ..constants import DECISION_REVIEW, DECISION_ACCEPT
from . import factories as cs_factories
import datetime
import uuid

        self.assertEqual(lines.count(), 1)
        line = lines[0]
        self.assertEqual(line.quantity, quantity)
        self.assertEqual(line.product_id, product_id)

        payment_events = order.payment_events.filter(event_type__name="Authorise")
        self.assertEqual(payment_events.count(), 1)
        self.assertEqual(payment_events[0].amount, order.total_incl_tax)

        payment_sources = order.sources.all()
        self.assertEqual(payment_sources.count(), 1)
        self.assertEqual(payment_sources[0].currency, order.currency)
        self.assertEqual(payment_sources[0].amount_allocated, order.total_incl_tax)
        self.assertEqual(payment_sources[0].amount_debited, D("0.00"))
        self.assertEqual(payment_sources[0].amount_refunded, D("0.00"))

        transactions = payment_sources[0].transactions.all()
        self.assertEqual(transactions.count(), 1)
        self.assertEqual(transactions[0].txn_type, "Authorise")
        self.assertEqual(transactions[0].amount, order.total_incl_tax)
        self.assertEqual(transactions[0].status, status)

        self.assertEqual(transactions[0].log.order, order)
        self.assertEqual(transactions[0].log.req_reference_number, order.number)
        self.assertEqual(transactions[0].token.card_last4, card_last4)
        self.assertEqual(transactions[0].token.log.order, order)
        self.assertEqual(transactions[0].token.log.req_reference_number, order.number)

        self.assertEqual(len(mail.outbox), 1)


        if status == DECISION_REVIEW: