Changeset 12157 for main/waeup.ikoba/branches/uli-payments
- Timestamp:
- 5 Dec 2014, 23:16:13 (10 years ago)
- Location:
- main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/__init__.py
r11949 r12157 3 3 # Make this a package. 4 4 from waeup.ikoba.payments.container import PaymentsContainer 5 from waeup.ikoba.payments.payment import OnlinePayment5 from waeup.ikoba.payments.payment import Payment 6 6 7 7 __all__ = [ 8 8 'PaymentsContainer', 9 ' OnlinePayment',9 'Payment', 10 10 ] -
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/payment.py
r12152 r12157 80 80 self.state = STATE_FAILED 81 81 notify(grok.ObjectModifiedEvent(self)) 82 83 84 class OnlinePayment(Payment):85 """This is an online payment.86 """87 grok.implements(IOnlinePayment)88 grok.provides(IOnlinePayment)89 90 def approve(self):91 "Approve online payment and set to paid."92 self.r_amount_approved = self.amount_auth93 self.r_code = u'AP'94 self.p_state = 'paid'95 user = get_current_principal()96 if user is None:97 # in tests98 usertitle = 'system'99 else:100 usertitle = getattr(user, 'public_name', None)101 if not usertitle:102 usertitle = user.title103 r_desc = _('Payment approved by ${a}', mapping={'a': usertitle})104 portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE105 self.r_desc = translate(r_desc, 'waeup.ikoba',106 target_language=portal_language)107 self.payment_date = datetime.utcnow()108 # Update catalog109 notify(grok.ObjectModifiedEvent(self))110 return111 112 OnlinePayment = attrs_to_fields(OnlinePayment, omit=['display_item']) -
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_interfaces.py
r12060 r12157 20 20 """ 21 21 from zope.interface.verify import verifyClass, verifyObject 22 from waeup.ikoba.payments.interfaces import ( 23 IPaymentsContainer, IOnlinePayment) 22 from waeup.ikoba.payments.interfaces import IPaymentsContainer 24 23 from waeup.ikoba.payments.container import PaymentsContainer 25 from waeup.ikoba.payments.payment import OnlinePayment24 from waeup.ikoba.payments.payment import Payment 26 25 from waeup.ikoba.testing import (FunctionalLayer, FunctionalTestCase) 27 26 … … 41 40 IPaymentsContainer, PaymentsContainer()) 42 41 ) 43 self.assertTrue(44 verifyClass(45 IOnlinePayment, OnlinePayment)46 )47 self.assertTrue(48 verifyObject(49 IOnlinePayment, OnlinePayment())50 )51 42 return 52 43
Note: See TracChangeset for help on using the changeset viewer.