# 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
    def card_holder(self):
        return "%s %s" % (self.log.req_bill_to_forename, self.log.req_bill_to_surname)

    def __str__(self):
        return "%s" % self.masked_card_number


class TransactionMixin(ReplyLogMixin, models.Model):
    log = models.ForeignKey(
        CyberSourceReply,
        related_name="transactions",
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
    )
    token = models.ForeignKey(
        PaymentToken,
        related_name="transactions",
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
    )
    request_token = models.CharField(max_length=200, null=True, blank=True)
    processed_datetime = models.DateTimeField(default=timezone.now)

    class Meta:
        abstract = True

    @property
    def is_pending_review(self):

# 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

    def card_holder(self):
        return "%s %s" % (self.log.req_bill_to_forename, self.log.req_bill_to_surname)

    def __str__(self):
        return "%s" % self.masked_card_number


class TransactionMixin(ReplyLogMixin, models.Model):
    log = models.ForeignKey(
        CyberSourceReply,
        related_name="transactions",
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
    )
    token = models.ForeignKey(
        PaymentToken,
        related_name="transactions",
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
    )
    request_token = models.CharField(max_length=200, null=True, blank=True)
    processed_datetime = models.DateTimeField(default=timezone.now)

    class Meta:
        abstract = True

    @property
    def is_pending_review(self):

        return self.status == DECISION_REVIEW