Changeset 12655 for main/waeup.ikoba


Ignore:
Timestamp:
2 Mar 2015, 14:07:26 (10 years ago)
Author:
uli
Message:

Provide an overridable gateway lister.

Location:
main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/interfaces.py

    r12649 r12655  
    103103
    104104
     105class IPaymentGatewayServicesLister(Interface):
     106    """A utility that lists all valid payment gateways.
     107
     108    This is a subset of the available payment methods, as some might
     109    be disabled in some site.
     110
     111    Register your own lister in customized sites!
     112    """
     113
     114
    105115class PaymentCategorySource(ContextualDictSourceFactoryBase):
    106116    """A payment category source delivers all categories of payments.
     
    222232        )
    223233
    224 
    225234    currency = schema.Choice(
    226235        title=u'Currency',
  • main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/payment.py

    r12648 r12655  
    2929    IPayment, STATE_UNPAID, STATE_FAILED, STATE_PAID,
    3030    IPaymentGatewayService, IPayer, IPaymentItem, IPayee,
     31    IPaymentGatewayServicesLister,
    3132    )
    3233from waeup.ikoba.utils.logger import Logger
     
    3940        getUtilitiesFor(IPaymentGatewayService)
    4041        )
     42
     43grok.global_utility(get_payment_providers, IPaymentGatewayServicesLister)
    4144
    4245
  • main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/tests/test_payment.py

    r12648 r12655  
    2020import re
    2121import unittest
    22 from zope.component import getUtilitiesFor, getSiteManager
     22from zope.component import getUtilitiesFor, getSiteManager, queryUtility
    2323from zope.interface import implements
    2424from zope.interface.verify import verifyClass, verifyObject
    2525from waeup.ikoba.payments.interfaces import (
    2626    IPayment, STATE_UNPAID, STATE_PAID, STATE_FAILED,
    27     IPaymentGatewayService, IPaymentItem
     27    IPaymentGatewayService, IPaymentItem, IPaymentGatewayServicesLister,
    2828    )
    2929from waeup.ikoba.payments.payment import (
    3030    Payment, get_payment_providers, PaymentItem,
    3131    )
     32from waeup.ikoba.testing import (FunctionalLayer, FunctionalTestCase)
    3233
    3334
     
    5960        assert result.keys() == ['some_name', ]
    6061        assert result['some_name'] is fake_util
     62
     63class FunctionalHelperTests(FunctionalTestCase):
     64
     65    layer = FunctionalLayer
     66
     67    def test_services_lister_is_registered(self):
     68        # a lister of gateway services is registered on startup
     69        util = queryUtility(IPaymentGatewayServicesLister)
     70        assert util is not None
    6171
    6272
Note: See TracChangeset for help on using the changeset viewer.