Beispiel #1
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        g1 = ConfigurationGroup("req2", "Requirements 2", ordering=1000)

        self.g1 = g1

        choices1 = config_register(
            MultipleStringValue(SHOP_GROUP, "rc1", ordering=1))

        self.g1c1 = config_register(
            IntegerValue(g1, "c1", requires=choices1, ordering=3))
        self.g1c2 = config_register(
            IntegerValue(g1, "c2", requires=choices1, ordering=4))
        self.g1c3 = config_register(IntegerValue(g1, "c3", ordering=5))

        choices1.update("c1")

        g2 = ConfigurationGroup("req3", "Requirements 3", ordering=1000)

        self.g2 = g2

        choices2 = config_register(
            StringValue(SHOP_GROUP, "choices2", ordering=1))

        self.g2c1 = config_register(
            IntegerValue(g2, "c1", requires=choices2, ordering=3))
        self.g2c2 = config_register(
            IntegerValue(g2, "c2", requires=choices2, ordering=4))
        self.g2c3 = config_register(
            IntegerValue(g2, "c3", requires=choices2, ordering=5))

        choices2.update("c1")
Beispiel #2
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        g1 = ConfigurationGroup("reqval", "Requirements 3", ordering=1000)

        self.g1 = g1

        choices1 = config_register(
            MultipleStringValue(SHOP_GROUP, "valchoices", ordering=1))

        self.g1c1 = config_register(
            IntegerValue(g1,
                         "c1",
                         requires=choices1,
                         requiresvalue="foo",
                         ordering=3))
        self.g1c2 = config_register(
            IntegerValue(g1,
                         "c2",
                         requires=choices1,
                         requiresvalue="bar",
                         ordering=4))
        self.g1c3 = config_register(IntegerValue(g1, "c3", ordering=5))

        choices1.update("foo")

        g2 = ConfigurationGroup("reqval2", "Requirements 4", ordering=1000)

        self.g2 = g2

        choices2 = config_register(
            StringValue(
                SHOP_GROUP,
                "valchoices2",
                ordering=1,
                choices=(("a", "test a"), ("b", "test b"), ("c", "test c")),
            ))

        self.g2c1 = config_register(
            IntegerValue(g2,
                         "c1",
                         requires=choices2,
                         requiresvalue="a",
                         ordering=3))
        self.g2c2 = config_register(
            IntegerValue(g2,
                         "c2",
                         requires=choices2,
                         requiresvalue="b",
                         ordering=4))
        self.g2c3 = config_register(
            IntegerValue(g2,
                         "c3",
                         requires=choices2,
                         requiresvalue="c",
                         ordering=5))

        choices2.update("a")
Beispiel #3
0
 def setUp(self):
     # clear out cache from previous runs
     caching.cache_delete()
     g = ConfigurationGroup("test2", "test2")
     self.g = g
     config_register(StringValue(g, "s1"))
     config_register(IntegerValue(g, "s2", default=10))
     config_register(IntegerValue(g, "s3", default=10))
Beispiel #4
0
    def testSetTwoConfigItems(self):
        s = [
            IntegerValue(SHOP_GROUP, "testTwoA"),
            StringValue(SHOP_GROUP, "testTwoB")
        ]
        config_register_list(*s)

        self.assertTrue(config_exists(SHOP_GROUP, "testTwoA"))
        self.assertTrue(config_exists(SHOP_GROUP, "testTwoB"))
Beispiel #5
0
    def setUp(self):
        caching.cache_delete()
        choices = config_register(
            MultipleStringValue(SHOP_GROUP, "collect", ordering=1))
        self.choices = choices

        g1 = ConfigurationGroup("coll1", "Collection 1")
        g2 = ConfigurationGroup("coll2", "Collection 2")
        g3 = ConfigurationGroup("coll3", "Collection 3")

        g1c1 = config_register(StringValue(g1, "test"))
        g1c2 = config_register(StringValue(g1, "test1"))
        g2c1 = config_register(StringValue(g2, "test"))
        g3c1 = config_register(StringValue(g3, "test"))

        g1c1.update("set a")
        g1c2.update("set b")
        g2c1.update("set a")
        g3c1.update("set d")

        choices.update(["coll1", "coll3"])
Beispiel #6
0
    def testAddPreregisteredChoice(self):
        """Test that we can register choices before the config is actually set up."""
        config_add_choice("ctg1", "c1", ("a", "Item A"))
        config_add_choice("ctg1", "c1", ("b", "Item B"))
        config_add_choice("ctg1", "c1", ("c", "Item C"))

        g1 = ConfigurationGroup("ctg1", "Choice 1", ordering=1000)
        config_register(StringValue(g1, "c1"))

        c = config_get("ctg1", "c1")

        self.assertEqual(c.choices, [("a", "Item A"), ("b", "Item B"),
                                     ("c", "Item C")])
Beispiel #7
0
def config_tax():
    TAX_MODULE = config_get("TAX", "MODULE")
    TAX_MODULE.add_choice(("satchmo.tax.modules.area", _("By Country/Area")))
    TAX_GROUP = config_get_group("TAX")

    _tax_classes = []
    ship_default = ""

    try:
        for tax in TaxClass.objects.all():
            _tax_classes.append((tax.title, tax))
            if "ship" in tax.title.lower():
                ship_default = tax.title
    except:
        log.warn(
            "Ignoring database error retrieving tax classes - OK if you are in syncdb."
        )

    if ship_default == "" and len(_tax_classes) > 0:
        ship_default = _tax_classes[0][0]

    config_register(
        BooleanValue(
            TAX_GROUP,
            "TAX_SHIPPING",
            description=_("Tax Shipping?"),
            requires=TAX_MODULE,
            requiresvalue="satchmo.tax.modules.area",
            default=False,
        ))

    config_register(
        StringValue(
            TAX_GROUP,
            "TAX_CLASS",
            description=_("TaxClass for shipping"),
            help_text=_(
                "Select a TaxClass that should be applied for shipments."),
            default=ship_default,
            choices=_tax_classes,
        ))
Beispiel #8
0
from satchmo.shop.satchmo_settings import get_satchmo_setting
from satchmo.utils import load_module
from . import signals

import logging

log = logging.getLogger(__name__)

PAYMENT_GROUP = ConfigurationGroup("PAYMENT", _("Payment Settings"))

CRON_KEY = config_register(
    StringValue(
        PAYMENT_GROUP,
        "CRON_KEY",
        description=_("Cron Passkey"),
        help_text=_(
            "Enter an authentication passkey to secure your recurring billing cron url."
        ),
        default="x1234replace_me",
    )
)

ALLOW_URL_CRON = config_register(
    BooleanValue(
        PAYMENT_GROUP,
        "ALLOW_URL_REBILL",
        description=_("Allow URL Access to Cron for subscription rebills"),
        help_text=_("Do you want to allow remote url calls for subscription billing?"),
        default=False,
    )
)
Beispiel #9
0
            "Users will not be required to provide billing address and phone number. If authentication "
            "before checkout is required, this allows instant purchase (all required contact data will "
            "have already been provided in registration form). Otherwise be careful, as this may leave "
            "you orders with almost no customer data!"
        ),
        default=False,
    )
)
# I am doing it this way instead of a boolean for email verification because I
# intend to add a "manual approval" style of account verification. -Bruce
ACCOUNT_VERIFICATION = config_register(
    StringValue(
        SHOP_GROUP,
        "ACCOUNT_VERIFICATION",
        description=_("Account Verification"),
        help_text=_(
            "Select the style of account verification.  'Immediate' means no verification needed."
        ),
        default="IMMEDIATE",
        choices=[("IMMEDIATE", _("Immediate")), ("EMAIL", _("Email"))],
    )
)

config_register(
    IntegerValue(
        SHOP_GROUP,
        "ACCOUNT_ACTIVATION_DAYS",
        description=_("Days to verify account"),
        default=7,
        requires=ACCOUNT_VERIFICATION,
        requiresvalue="EMAIL",
    )
Beispiel #10
0
PAYMENT_GROUP = ConfigurationGroup(
    "PAYMENT_GIFTCERTIFICATE", _("Gift Certificate Settings"), requires=PAYMENT_MODULES
)

config_register_list(
    BooleanValue(
        PAYMENT_GROUP,
        "SSL",
        description=_("Use SSL for the checkout pages?"),
        default=False,
    ),
    StringValue(
        PAYMENT_GROUP,
        "CHARSET",
        description=_("Character Set"),
        default="BCDFGHKPRSTVWXYZbcdfghkprstvwxyz23456789",
        help_text=_(
            "The characters allowable in randomly-generated certficate codes.  No vowels means no unfortunate words."
        ),
    ),
    StringValue(
        PAYMENT_GROUP,
        "KEY",
        description=_("Module key"),
        hidden=True,
        default="GIFTCERTIFICATE",
    ),
    StringValue(
        PAYMENT_GROUP,
        "FORMAT",
        description=_("Code format"),
Beispiel #11
0
PAYMENT_MODULES = config_get("PAYMENT", "MODULES")
PAYMENT_MODULES.add_choice(("PAYMENT_INGENICO", _("Ingenico")))

PAYMENT_GROUP = ConfigurationGroup(
    "PAYMENT_INGENICO",
    _("Ingenico Payment Settings"),
    requires=PAYMENT_MODULES,
    ordering=101,
)

config_register_list(
    StringValue(
        PAYMENT_GROUP,
        "CONNECTION",
        description=_("URL to submit live transactions."),
        hidden=True,
        default="https://secure.ogone.com/ncol/prod/orderstandard_utf8.asp",
    ),
    StringValue(
        PAYMENT_GROUP,
        "CONNECTION_TEST",
        description=_("URL to submit test transactions."),
        hidden=True,
        default="https://secure.ogone.com/ncol/test/orderstandard_utf8.asp",
    ),
    StringValue(
        PAYMENT_GROUP,
        "PSPID",
        description=_("Your Ingenico affiliation name"),
        default="",
Beispiel #12
0
from satchmo.configuration.functions import config_register
from satchmo.configuration.values import ConfigurationGroup, StringValue, BooleanValue
from satchmo.utils import load_module
from satchmo.shop.satchmo_settings import get_satchmo_setting

import logging

logger = logging.getLogger(__name__)

TAX_GROUP = ConfigurationGroup("TAX", _("Tax Settings"))
TAX_MODULE = config_register(
    StringValue(
        TAX_GROUP,
        "MODULE",
        description=_("Active tax module"),
        help_text=
        _("Select a module, save and reload to set any module-specific settings."
          ),
        default="satchmo.tax.modules.no",
        choices=[("satchmo.tax.modules.no", _("No Tax"))],
    ))
DEFAULT_VIEW_TAX = config_register(
    BooleanValue(
        TAX_GROUP,
        "DEFAULT_VIEW_TAX",
        description=_("Show with tax included"),
        help_text=
        _("If yes, then all products and the cart will display with tax included."
          ),
        default=False,
    ))
Beispiel #13
0
    MultipleStringValue(
        SHOP_GROUP,
        "MEASUREMENT_SYSTEM",
        description=_("Measurement system to use in store"),
        choices=[("metric", _("Metric")), ("imperial", _("Imperial"))],
        default="imperial",
    )
)

LOGO_URI = config_register(
    StringValue(
        SHOP_GROUP,
        "LOGO_URI",
        description=_("URI to the logo for the store"),
        help_text=_(
            (
                "For example http://www.example.com/images/logo.jpg or "
                "file:///var/www/html/images/logo.jpg"
            )
        ),
        default=default_icon_url,
    )
)

ENFORCE_STATE = config_register(
    BooleanValue(
        SHOP_GROUP,
        "ENFORCE_STATE",
        description=_("State required?"),
        help_text=_(
            "Require a state during registration/checkout for countries that have states?"
        ),
Beispiel #14
0
SHIP_MODULES.add_choice(("satchmo.shipping.modules.flat", _("Flat rate")))
SHIPPING_GROUP = config_get_group("SHIPPING")

config_register_list(
    DecimalValue(
        SHIPPING_GROUP,
        "FLAT_RATE",
        description=_("Flat shipping"),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.flat",
        default="4.00",
    ),
    StringValue(
        SHIPPING_GROUP,
        "FLAT_SERVICE",
        description=_("Flat Shipping Service"),
        help_text=_("Shipping service used with Flat rate shipping"),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.flat",
        default="U.S. Mail",
    ),
    StringValue(
        SHIPPING_GROUP,
        "FLAT_DAYS",
        description=_("Flat Delivery Days"),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.flat",
        default="3 - 4 business days",
    ),
)
Beispiel #15
0
        default=["product::ConfigurableProduct", "product::ProductVariation"],
        choices=[
            ("product::ConfigurableProduct", _("Configurable Product")),
            ("product::ProductVariation", _("Product Variation")),
            ("product::CustomProduct", _("Custom Order")),
            ("product::SubscriptionProduct", _("Subscription Product")),
            ("product::DownloadableProduct", _("Downloadable Product")),
        ],
    ))

config_register(
    StringValue(
        PRODUCT_GROUP,
        "IMAGE_DIR",
        description=_("Upload Image Dir"),
        help_text=_("""Directory name for storing uploaded images.
    This value will be appended to MEDIA_ROOT.  Do not worry about slashes.
    We can handle it any which way."""),
        default="images",
    ))

config_register(
    StringValue(
        PRODUCT_GROUP,
        "PROTECTED_DIR",
        description=_("Protected dir"),
        help_text=_("""This is only used if you use Downloadable Products.
This value will be appended to MEDIA_ROOT.  Do not worry about slashes.
We can handle it any which way."""),
        default="protected",
        requires=PRODUCT_TYPES,
Beispiel #16
0
     "LIVE",
     description=_("Accept real payments"),
     help_text=_("False if you want to be in test mode"),
     default=False,
 ),
 ModuleValue(
     PAYMENT_GROUP,
     "MODULE",
     description=_("Implementation module"),
     hidden=True,
     default="satchmo.payment.modules.autosuccess",
 ),
 StringValue(
     PAYMENT_GROUP,
     "KEY",
     description=_("Module key"),
     hidden=True,
     default="AUTOSUCCESS",
 ),
 StringValue(
     PAYMENT_GROUP,
     "LABEL",
     description=_("English name for this group on the checkout screens"),
     default="Pay Now",
     help_text=_("This will be passed to the translation utility"),
 ),
 StringValue(
     PAYMENT_GROUP,
     "URL_BASE",
     description=
     _("The url base used for constructing urlpatterns which will use this module"
Beispiel #17
0
SHIPPING_GROUP = config_get_group("SHIPPING")

config_register_list(
    DecimalValue(
        SHIPPING_GROUP,
        "PER_RATE",
        description=_("Per item price"),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.per",
        default="4.00",
    ),
    StringValue(
        SHIPPING_GROUP,
        "PER_SERVICE",
        description=_("Per Item Shipping Service"),
        help_text=_("Shipping service used with per item shipping"),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.per",
        default="U.S. Mail",
    ),
    StringValue(
        SHIPPING_GROUP,
        "PER_DAYS",
        description=_("Per Item Delivery Days"),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.per",
        default="3 - 4 business days",
    ),
)
Beispiel #18
0
    "PAYMENT_PAYPAL",
    _("Paypal Payment Settings"),
    requires=PAYMENT_MODULES,
    ordering=101,
)

config_register_list(
    BooleanValue(
        PAYMENT_GROUP,
        "LIVE",
        description=_("Accept real payments"),
        help_text=_("False if you want to be in test mode"),
        default=False,
    ),
    StringValue(PAYMENT_GROUP,
                "WEBHOOK_ID",
                description=_("Live Webhook ID"),
                default="xxx"),
    StringValue(
        PAYMENT_GROUP,
        "SANDBOX_WEBHOOK_ID",
        description=_("Sandbox Webhook ID"),
        default="xxx",
        help_text=_("This is used for asynchronous callbacks"),
    ),
    StringValue(PAYMENT_GROUP,
                "SECRET_KEY",
                description=_("Live Secret key"),
                default="xxx"),
    StringValue(PAYMENT_GROUP,
                "CLIENT_ID",
                description=_("Live Client ID"),
Beispiel #19
0
log = logging.getLogger(__name__)

ACTIVE_FULILMENT_HOUSE.add_choice(("satchmo.fulfilment.modules.six", _("Six")))

FULILMENT_HOUSE = ConfigurationGroup(
    "satchmo.fulfilment.modules.six",
    _("Six Fulfilment Settings"),
    requires=ACTIVE_FULILMENT_HOUSE,
    ordering=101,
)

config_register_list(
    StringValue(
        FULILMENT_HOUSE,
        "API_KEY",
        description=_("API Key"),
        help_text=_("Client's API key, provided by fulfiller."),
        default="",
    ),
    BooleanValue(
        FULILMENT_HOUSE,
        "TEST_MODE",
        description=_("Test mode"),
        help_text=_(
            "Test identifier, must equal false for order to be processed."),
        default=True,
    ),
    StringValue(
        FULILMENT_HOUSE,
        "URL",
        description=_("API URL"),