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

        g = ConfigurationGroup("test3", "test3")
        self.g = g
        c1 = config_register(BooleanValue(g, "s1", default=True))
        c2 = config_register(IntegerValue(g, "s2", default=10))
        c2.update(100)
示例#2
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        g1 = ConfigurationGroup("req1", "Requirements 1", ordering=1000)

        self.g1 = g1

        bool1 = config_register(
            BooleanValue(g1, "bool1", default=False, ordering=1))
        bool2 = config_register(BooleanValue(g1, "bool2", ordering=2))

        self.g1c1 = config_register(
            IntegerValue(g1, "c1", requires=bool1, ordering=3))

        self.g1c2 = config_register(
            IntegerValue(g1, "c2", requires=bool2, ordering=4))
        self.g1c3 = config_register(IntegerValue(g1, "c3", ordering=5))

        bool2.update(True)
示例#3
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,
        ))
示例#4
0
    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,
    )
)

PAYMENT_LIVE = config_register(
    BooleanValue(
        PAYMENT_GROUP,
        "LIVE",
        description=_("Accept real payments"),
        help_text=_(
            "False if you want to be in test mode.  This is the master switch, turn it off to force all payments into test mode."
        ),
        default=False,
    )
示例#5
0
)

PAYMENT_MODULES = config_get("PAYMENT", "MODULES")
PAYMENT_MODULES.add_choice(("PAYMENT_GIFTCERTIFICATE", "Gift Certificates"))

PRODUCTS = config_get("PRODUCT", "PRODUCT_TYPES")
PRODUCTS.add_choice(("giftcertificate::GiftCertificateProduct", _("Gift Certificate")))

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"),
示例#6
0
from satchmo.configuration.functions import config_register
from satchmo.configuration.values import (
    StringValue,
    IntegerValue,
    BooleanValue,
    SHOP_GROUP,
)

from django.utils.translation import ugettext_lazy as _

config_register(
    BooleanValue(
        SHOP_GROUP,
        "AUTHENTICATION_REQUIRED",
        description=_("Only authenticated users can check out"),
        help_text=_(
            "Users will be required to authenticate (and create an account if neccessary) before checkout."
        ),
        default=False,
    )
)

config_register(
    BooleanValue(
        SHOP_GROUP,
        "BILLING_DATA_OPTIONAL",
        description=_("Billing data is optional"),
        help_text=_(
            "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 "
示例#7
0
    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,
    ))

# --- Load default tax modules.  Ignore import errors, user may have deleted them. ---
_default_modules = ("percent", "area")
for module in _default_modules:
    try:
        load_module("satchmo.tax.modules.%s.config" % module)
    except ImportError as ie:
        logger.debug("Could not load default tax module configuration: %s\n%s",
                     module, ie)

# --- Load any extra tax modules. ---
示例#8
0
PAYMENT_MODULES = config_get("PAYMENT", "MODULES")
PAYMENT_MODULES.add_choice(("PAYMENT_PAYPAL", _("Paypal Payment Settings")))

PAYMENT_GROUP = ConfigurationGroup(
    "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,
示例#9
0
    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"),
        help_text=_("URL of fulfillers API."),
        default="https://[client].sixworks.co.uk/api/1/",
    ),
    BooleanValue(
        FULILMENT_HOUSE,
        "UPDATE_STOCK",
        description=_("Update Stock"),
        help_text=_(
示例#10
0
    config_register,
)

from satchmo.configuration.values import DecimalValue, BooleanValue


TAX_MODULE = config_get("TAX", "MODULE")
TAX_MODULE.add_choice(("satchmo.tax.modules.percent", _("Percent Tax")))
TAX_GROUP = config_get_group("TAX")

config_register(
    DecimalValue(
        TAX_GROUP,
        "PERCENT",
        description=_("Percent tax"),
        requires=TAX_MODULE,
        requiresvalue="satchmo.tax.modules.percent",
    )
)

config_register(
    BooleanValue(
        TAX_GROUP,
        "TAX_SHIPPING",
        description=_("Tax Shipping?"),
        requires=TAX_MODULE,
        requiresvalue="satchmo.tax.modules.percent",
        default=False,
    )
)
示例#11
0
    MultipleStringValue,
    PositiveIntegerValue,
    SHOP_GROUP,
    StringValue,
)

default_icon_url = urllib.parse.urlunsplit(
    ("file", "", os.path.join(settings.MEDIA_ROOT, "images/sample-logo.bmp"), "", "")
)


# Shop Group
RANDOM_FEATURED = config_register(
    BooleanValue(
        SHOP_GROUP,
        "RANDOM_FEATURED",
        description=_("Enable random display of featured products on home page"),
        default=False,
    )
)

NUMBER_FEATURED = config_register(
    PositiveIntegerValue(
        SHOP_GROUP,
        "NUM_DISPLAY",
        description=_("Total number of featured items to display"),
        default=20,
    )
)

NUMBER_PAGINATED = config_register(
    PositiveIntegerValue(
示例#12
0
     PAYMENT_GROUP,
     "PSPID",
     description=_("Your Ingenico affiliation name"),
     default="",
 ),
 StringValue(
     PAYMENT_GROUP,
     "SECRET",
     description=_("Your Ingenico secret passphrase for transactions"),
     help_text=_("Uses SHA-512 to create the SHASIGN"),
     default="",
 ),
 BooleanValue(
     PAYMENT_GROUP,
     "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.ingenico",
 ),
 StringValue(
     PAYMENT_GROUP,
     "KEY",
     description=_("Module key"),
     hidden=True,
示例#13
0
from satchmo.configuration.values import BooleanValue, ConfigurationGroup, DecimalValue


CURRENCY_GROUP = ConfigurationGroup("CURRENCY", _("Currency Settings"), ordering=1)

CURRENCY = config_register_list(
    DecimalValue(
        CURRENCY_GROUP,
        "BUFFER",
        description=_("Exchange Rate Buffer"),
        help_text=_(
            "Add a small buffer before calculating the exchange rate (to cover exchange fees etc.)"
        ),
        default="0.20",
    ),
    BooleanValue(
        CURRENCY_GROUP,
        "ROUND_UP",
        description=_("Round up"),
        help_text=_("Round currency exchanged prices up to the nearest whole unit"),
    ),
    BooleanValue(
        CURRENCY_GROUP,
        "PSYCHOLOGICAL_PRICING",
        description=_("Psychological pricing"),
        help_text=_(
            "£1.00 would become £0.99. Applied after exchanged prices are rounded up"
        ),
    ),
)