Changeset 12734 for main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/demo_provider.py
- Timestamp:
- 11 Mar 2015, 17:08:34 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/demo_provider.py
r12723 r12734 2 2 from waeup.ikoba.interfaces import MessageFactory as _ 3 3 from waeup.ikoba.browser.layout import IkobaEditFormPage, action 4 from waeup.ikoba.payments.interfaces import IPaymentGatewayService, IPayment 4 from waeup.ikoba.payments.interfaces import ( 5 IPaymentGatewayService, IPayment, IPayable, IPayer, IPayee,) 5 6 from waeup.ikoba.payments.payment import ( 6 Payment, get_payment, find_payable_from_payable_id) 7 Payment, get_payment, find_payable_from_payable_id, 8 PaymentProviderServiceBase) 7 9 8 10 … … 10 12 11 13 12 class DemoCreditcardPaymentService( grok.GlobalUtility):14 class DemoCreditcardPaymentService(PaymentProviderServiceBase): 13 15 """A demo payment gateway service. 14 16 … … 20 22 title = _(u'Credit Card (Demo Payments)') 21 23 22 def create_payment(self, payer, pay ment_item_list=[], payee=None):24 def create_payment(self, payer, payable, payee=None): 23 25 """Create a payment. 24 26 """ 25 payment = Payment() 27 if not IPayer.providedBy(payer): 28 payer = IPayer(payer) 29 if not IPayable.providedBy(payable): 30 payable = IPayable(payable) 31 if (payee is not None) and (not IPayee.providedBy(payee)): 32 payee = IPayee(payee) 33 payment = Payment(payer, payable, payee) 26 34 payment.gateway_service = 'demo_creditcard' # must be grok.name above 27 payment.payer_id = payer.payer_id28 # XXX: we should not have to store a payment before adding items29 site = grok.getSite()30 site['payments'][payment.payment_id] = payment31 for item in payment_item_list:32 payment.add_payment_item(item)33 35 return payment 34 36
Note: See TracChangeset for help on using the changeset viewer.