# Path: src/cybersource/constants.py
# DECISION_ACCEPT = "ACCEPT"
# 
# DECISION_REVIEW = "REVIEW"
# 
# DECISION_DECLINE = "DECLINE"
# 
# DECISION_ERROR = "ERROR"


from cryptography.fernet import InvalidToken
from django.conf import settings
from django.db import models
from django.contrib.postgres.fields import HStoreField
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from oscar.core.compat import AUTH_USER_MODEL
from oscar.models.fields import NullCharField
from fernet_fields import EncryptedTextField
from .constants import (
    DECISION_ACCEPT,
    DECISION_REVIEW,
    DECISION_DECLINE,
    DECISION_ERROR,
)
import dateutil.parser
import logging

    # Reply Metadata
    user = models.ForeignKey(
        AUTH_USER_MODEL,
        related_name="cybersource_replies",
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
    )
    order = models.ForeignKey(
        "order.Order",
        related_name="cybersource_replies",
        null=True,
        on_delete=models.SET_NULL,
    )

    # Denotes what kind of response this is: Secure Acceptance or SOAP
    reply_type = models.SmallIntegerField(
        choices=REPLY_TYPE_CHOICES, default=REPLY_TYPE_SA
    )

    # Full Log of the reply data (raw data, so formats will differ between SA and SOAP replies)
    data = HStoreField()

    # More normalized view of the above reply data
    auth_avs_code = NullCharField(max_length=20)
    auth_code = NullCharField(max_length=20)
    auth_response = NullCharField(max_length=20)
    auth_trans_ref_no = NullCharField(max_length=128)
    decision = NullCharField(max_length=20)

# Path: src/cybersource/constants.py
# DECISION_ACCEPT = "ACCEPT"
# 
# DECISION_REVIEW = "REVIEW"
# 
# DECISION_DECLINE = "DECLINE"
# 
# DECISION_ERROR = "ERROR"


# Path: src/cybersource/models.py
from cryptography.fernet import InvalidToken
from django.conf import settings
from django.db import models
from django.contrib.postgres.fields import HStoreField
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from oscar.core.compat import AUTH_USER_MODEL
from oscar.models.fields import NullCharField
from fernet_fields import EncryptedTextField
from .constants import (
    DECISION_ACCEPT,
    DECISION_REVIEW,
    DECISION_DECLINE,
    DECISION_ERROR,
)
import dateutil.parser
import logging


    # Reply Metadata
    user = models.ForeignKey(
        AUTH_USER_MODEL,
        related_name="cybersource_replies",
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
    )
    order = models.ForeignKey(
        "order.Order",
        related_name="cybersource_replies",
        null=True,
        on_delete=models.SET_NULL,
    )

    # Denotes what kind of response this is: Secure Acceptance or SOAP
    reply_type = models.SmallIntegerField(
        choices=REPLY_TYPE_CHOICES, default=REPLY_TYPE_SA
    )

    # Full Log of the reply data (raw data, so formats will differ between SA and SOAP replies)
    data = HStoreField()

    # More normalized view of the above reply data
    auth_avs_code = NullCharField(max_length=20)
    auth_code = NullCharField(max_length=20)
    auth_response = NullCharField(max_length=20)
    auth_trans_ref_no = NullCharField(max_length=128)
    decision = NullCharField(max_length=20)

    message = NullCharField(max_length=100)