summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2015-03-04 13:48:38 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2015-03-04 13:50:03 (GMT)
commite5d5cb888112c88313d27267d244a9ce8fe9477a (patch)
treec03ae9a4b9beadfe657ce920401a20f3846e2df5
parent4ae04f39c4ce4bc97dde0b08c1fd0304d462f949 (diff)
downloadeopayment-4ae04f3.zip
eopayment-4ae04f3.tar.gz
eopayment-4ae04f3.tar.bz2
Add get_backends() function4ae04f3
-rw-r--r--eopayment/__init__.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/eopayment/__init__.py b/eopayment/__init__.py
index 6f21b9e..a2da06d 100644
--- a/eopayment/__init__.py
+++ b/eopayment/__init__.py
@@ -5,7 +5,7 @@ import logging
from common import URL, HTML
__all__ = ['Payment', 'URL', 'HTML', '__version__', 'SIPS', 'SYSTEMPAY',
- 'SPPLUS', 'DUMMY', 'get_backend']
+ 'SPPLUS', 'DUMMY', 'get_backend', 'get_backends']
__version__ = "0.0.22"
@@ -22,6 +22,17 @@ def get_backend(kind):
module = __import__(kind, globals(), locals(), [])
return module.Payment
+__BACKENDS = [ DUMMY, SIPS, SYSTEMPAY, SPPLUS ]
+
+def get_backends():
+ '''Return a dictionnary mapping existing eopayment backends name to their
+ description.
+
+ >>> get_backends()['dummy'].description['caption']
+ 'Dummy payment backend'
+
+ '''
+ return {backend: get_backend(backend) for backend in __BACKENDS}
class Payment(object):
'''