Changeset 12689


Ignore:
Timestamp:
8 Mar 2015, 18:24:20 (10 years ago)
Author:
uli
Message:

Disply avail. gateway providers on select page.

Location:
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/browser.py

    r12663 r12689  
    15061506    label = _('Select payment method')
    15071507
     1508    @property
     1509    def payment_gateways(self):
     1510        """Get an iter over registered and enabled gateway service providers.
     1511
     1512        We provide tuples ``(value, description)`` for each supported
     1513        payment gateway.
     1514        """
     1515        from waeup.ikoba.payments.interfaces import IPaymentGatewayServicesLister
     1516        lister = getUtility(IPaymentGatewayServicesLister)
     1517        for name, service in lister().items():
     1518            yield {'name': name, 'title': service.title}
     1519
    15081520    def update(self, CANCEL=None):
    15091521        if self.context.state != CREATED or not self.context.fee_based:
     
    15131525        return
    15141526
    1515     @action(_('Select payment method and proceed to payment gateway (final submission)'),
     1527    @action(_('Select payment method and proceed to payment gateway'
     1528              ' (final submission)'),
    15161529            style='primary', warning=WARNING_CON,)
    15171530    def confirm(self, **data):
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/browser_templates/selectpaymentmethodpage.pt

    r12663 r12689  
    11<form action="." tal:attributes="action request/URL" method="post"
    22      i18n:domain="waeup.ikoba" enctype="multipart/form-data">
     3
     4  <div class="form-group">
     5
     6    <div class="radio" tal:repeat="service view/payment_gateways">
     7      <label>
     8        <input type="radio" name="gw" tal:attributes="value service/name" />
     9        <b><span tal:replace="service/title" /></b>
     10      </label>
     11    </div>
     12
     13  </div>
    314
    415  <table class="form-table">
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/tests/test_browser.py

    r12663 r12689  
    14931493        self.browser.getControl("Apply").click()
    14941494        self.assertEqual(IWorkflowState(self.contract).getState(), 'approved')
     1495
     1496    def add_product_option(self, contract):
     1497        prodoption = ProductOption()
     1498        prodoption.title = u'Any product option'
     1499        prodoption.fee = Decimal('88.8')
     1500        prodoption.currency = 'EUR'
     1501        contract.product_options = [prodoption,]
     1502
     1503    def test_select_payment(self):
     1504        # select payment
     1505        IWorkflowState(self.customer).setState('approved')
     1506        IWorkflowState(self.document).setState('verified')
     1507        self.contract.document_object = self.document
     1508        self.add_product_option(self.contract)
     1509        IWorkflowState(self.contract).setState('created')
     1510        # login as customer
     1511        self.browser.open(self.login_path)
     1512        self.browser.getControl(name="form.login").value = self.customer_id
     1513        self.browser.getControl(name="form.password").value = 'cpwd'
     1514        self.browser.getControl("Login").click()
     1515        # go to our contract
     1516        self.browser.open('%s/CON1/edit' % self.contracts_path)
     1517        self.browser.getControl("Proceed to checkout").click()
     1518        self.assertTrue(
     1519            "Select payment method" in self.browser.contents)
     1520        self.assertTrue(
     1521            'Credit Card (Demo Payments)' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.