On Wed, Aug 26, 2009 at 7:47 AM, dhmorgan<[email protected]> wrote:
>
> Just starting to tinker with creating a custom payment module. Am
> having difficulty getting the module to show up in the Payment
> Settings section of config/settings.
>
> While exploring possible causes, I found that if I remove a module
> from site-packages/satchmo...egg/payment/modules/, it is taken out of
> list. Add it back and it shows up again. Rename it, however and it
> doesn't (even though I think I've taken care of all self-references
> within its files).
OK, here's what to do. First, add the module to your INSTALLED_APPS
in your settings.py. Make sure the config.py is getting loaded. The
easiest way to do that is to add "import config" at the bottom of a
models.py file in that directory.
Also, in your config.py for the module, a couple things are required.
Look at the comments.
PAYMENT_MODULES = config_get('PAYMENT', 'MODULES')
# note the name 'PAYMENT_MYMODULE', it is required to be formatted that way.
# the "PAYMENT_" part is not optional.
PAYMENT_MODULES.add_choice(('PAYMENT_MYMODULE', 'Mymodule'))
# these are the minimum items you must have in your module config
config_register_list(
BooleanValue(PAYMENT_GROUP,
'SSL',
description=_("Use SSL for the checkout pages?"),
default=False),
BooleanValue(PAYMENT_GROUP,
'LIVE',
description=_("Accept real payments"),
help_text=_("False if you want to submit to the test urls."),
default=False),
# this is *key*, you must have this for the system to find and
load your module
ModuleValue(PAYMENT_GROUP,
'MODULE',
description=_('Implementation module'),
hidden=True,
default = 'mysite.mymodule'),
StringValue(PAYMENT_GROUP,
'KEY',
description=_("Module key"),
hidden=True,
default = 'AUTHORIZENET'),
StringValue(PAYMENT_GROUP,
'LABEL',
description=_('English name for this group on the checkout screens'),
default = 'Credit Cards',
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'),
default = r'^credit/'),
BooleanValue(PAYMENT_GROUP,
'EXTRA_LOGGING',
description=_("Verbose logs"),
help_text=_("Add extensive logs during post."),
default=False)
)
--
Bruce Kroeze
http://www.ecomsmith.com
It's time to hammer your site into shape.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Satchmo users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/satchmo-users?hl=en
-~----------~----~----~----~------~----~------~--~---