Changeset 12757 for main/waeup.ikoba


Ignore:
Timestamp:
12 Mar 2015, 22:28:55 (10 years ago)
Author:
Henrik Bettermann
Message:

Add PaymentsPage? (work in progress).

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py

    r12748 r12757  
    4141from waeup.ikoba.browser.interfaces import ICaptchaManager
    4242from waeup.ikoba.mandates.mandate import PasswordMandate
    43 from waeup.ikoba.payments.payment import format_payment_item_values
     43from waeup.ikoba.payments.payment import (
     44    get_payments_from_payer_id,
     45    find_payable_from_payable_id,
     46    get_payment_providers
     47    )
    4448from waeup.ikoba.payments.interfaces import (
    45     IPaymentGatewayServicesLister, IPaymentGatewayService, IPayer, IPayable
     49    IPaymentGatewayServicesLister, IPaymentGatewayService, IPayer, IPayable,
     50    payment_states
    4651    )
    4752from waeup.ikoba.widgets.hrefwidget import HREFDisplayWidget
     
    16991704            sigs_in_footer=self._sigsInFooter(),
    17001705            omit_fields=self.omit_fields)
     1706
     1707
     1708class PaymentsPage(IkobaPage):
     1709    """ Page to display all payments made by customer.
     1710
     1711    """
     1712    grok.context(ICustomer)
     1713    grok.name('payments')
     1714    grok.require('waeup.manageCustomer')
     1715    grok.template('paymentspage')
     1716    pnav = 4
     1717
     1718    @property
     1719    def label(self):
     1720        return _('${a}: Payments', mapping={'a':self.context.display_fullname})
     1721
     1722    @property
     1723    def payment_states(self):
     1724        return payment_states
     1725
     1726    @property
     1727    def gateway_services(self):
     1728        return get_payment_providers()
     1729
     1730    def payments(self):
     1731        values = []
     1732        payable = None
     1733        for payment in get_payments_from_payer_id(
     1734            self.context.customer.customer_id):
     1735            payable_object = find_payable_from_payable_id(payment.payable_id)
     1736            if payable_object is not None:
     1737                payable = IPayable(payable_object)
     1738            values.append((payment, payable, payable_object))
     1739        return values
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py

    r12527 r12757  
    166166    text = _(u'Documents')
    167167
     168class CustomerManagePaymentsLink(CustomerManageLink):
     169    grok.order(5)
     170    link = 'payments'
     171    text = _(u'Payments')
     172
    168173
    169174class CustomerManageHistoryLink(CustomerManageLink):
Note: See TracChangeset for help on using the changeset viewer.